Decompiled source of BagWheel v1.0.2

BagWheel.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BagWheel.Behaviours;
using BagWheel.CustomInputs;
using BagWheel.Managers;
using BagWheel.NetcodePatcher;
using BagWheel.Patches;
using BagWheel.Patches.ModsPatches;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BagWheel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BagWheel")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("47887bf3-e7ab-477d-90c1-522fd9d328a9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BagWheel
{
	public class Constants
	{
		public const string GLOBAL = "_Global_";

		public const string DISABLED = "DISABLED";

		public const string FLASHLIGHT = "FLASHLIGHT";

		public const string SHOVEL = "SHOVEL";

		public const string SPRAY_PAINT = "SPRAY PAINT";

		public const string WALKIE_TALKIE = "WALKIE TALKIE";

		public const string STUN_GRENADE = "STUN GRENADE";

		public const string BOOMBOX = "BOOMBOX";

		public const string ZAP_GUN = "ZAP GUN";

		public const string TZP = "TZP";

		public const string LOCKPICKER = "LOCKPICKER";

		public const string JETPACK = "JETPACK";

		public const string EXTENSION_LADDER = "EXTENSION LADDER";

		public const string RADAR_BOOSTER = "RADAR BOOSTER";
	}
	[BepInPlugin("Lega.BagWheel", "Bag Wheel", "1.0.2")]
	public class BagWheel : BaseUnityPlugin
	{
		private const string modGUID = "Lega.BagWheel";

		private const string modName = "Bag Wheel";

		private const string modVersion = "1.0.2";

		private readonly Harmony harmony = new Harmony("Lega.BagWheel");

		private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "bagwheel"));

		internal static ManualLogSource mls;

		public static ConfigFile configFile;

		public static GameObject bagWheelInterface;

		public static GameObject bagWheelPrefab;

		public static Sprite flashlightSprite;

		public static Sprite shovelSprite;

		public static Sprite sprayPaintSprite;

		public static Sprite walkieTalkieSprite;

		public static Sprite stunGrenadeSprite;

		public static Sprite boomboxSprite;

		public static Sprite zapGunSprite;

		public static Sprite tzpSprite;

		public static Sprite lockpickerSprite;

		public static Sprite jetpackSprite;

		public static Sprite extensionLadderSprite;

		public static Sprite radarBoosterSprite;

		public static GameObject managerPrefab = NetworkPrefabs.CreateNetworkPrefab("BagWheelNetworkManager");

		public void Awake()
		{
			mls = Logger.CreateLogSource("BagWheel");
			configFile = ((BaseUnityPlugin)this).Config;
			ConfigManager.Load();
			_ = BagWheelInputs.Instance;
			BagWheelInputs.Instance.EnableInputs();
			LoadManager();
			NetcodePatcher();
			LoadUI();
			LoadSprites();
			harmony.PatchAll(typeof(HUDManagerPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			PatchOtherMods(harmony);
		}

		public static void LoadManager()
		{
			Utilities.FixMixerGroups(managerPrefab);
			managerPrefab.AddComponent<BagWheelNetworkManager>();
		}

		private static void NetcodePatcher()
		{
			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);
					}
				}
			}
		}

		public static void LoadUI()
		{
			bagWheelPrefab = bundle.LoadAsset<GameObject>("Assets/UI/BagWheel.prefab");
		}

		public static void LoadSprites()
		{
			flashlightSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/FlashlightIcon.png");
			shovelSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/ShovelIcon.png");
			sprayPaintSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/SpraycanIcon.png");
			walkieTalkieSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/WalkieTalkieIcon.png");
			stunGrenadeSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/StunGrenadeIcon.png");
			boomboxSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/BoomboxIcon.png");
			zapGunSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/ZapGunIcon.png");
			tzpSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/TZPIcon.png");
			lockpickerSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/LockpickerIcon.png");
			jetpackSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/JetpackIcon.png");
			extensionLadderSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/ExtensionLadderIcon.png");
			radarBoosterSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/RadarBoosterIcon.png");
		}

		public static void PatchOtherMods(Harmony harmony)
		{
			BetterSprayPaintPatch(harmony);
		}

		public static void BetterSprayPaintPatch(Harmony harmony)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			Type type = Type.GetType("BetterSprayPaint.Ngo.SprayPaintItemNetExt, BetterSprayPaint");
			if (!(type == null))
			{
				MethodInfo methodInfo = AccessTools.Property(type, "HeldByLocalPlayer")?.GetGetMethod();
				if (methodInfo != null)
				{
					harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(BetterSprayPaintPatch).GetMethod("HeldByLocalPlayer")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
				MethodInfo methodInfo2 = AccessTools.Property(type, "InActiveSlot")?.GetGetMethod();
				if (methodInfo2 != null)
				{
					harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(BetterSprayPaintPatch).GetMethod("InActiveSlot")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BagWheel";

		public const string PLUGIN_NAME = "BagWheel";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BagWheel.Patches
{
	internal class HUDManagerPatch
	{
		[HarmonyPatch(typeof(HUDManager), "Start")]
		[HarmonyPostfix]
		private static void StartHUD()
		{
			ConfigManager.ConfigureWheelButtons();
		}
	}
	internal class PlayerControllerBPatch
	{
		public static BeltBagItem beltBagItem;

		public static KeyValuePair<int, GrabbableObject>? bagItem;

		[HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")]
		[HarmonyAfter(new string[] { "Lega.CursedScraps" })]
		[HarmonyPrefix]
		private static bool PreDropObject(ref PlayerControllerB __instance)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			if (!bagItem.HasValue || (Object)(object)beltBagItem == (Object)null)
			{
				return true;
			}
			GrabbableObject value = bagItem.Value.Value;
			if ((Object)(object)value != (Object)(object)__instance.currentlyHeldObjectServer)
			{
				return true;
			}
			BagWheelNetworkManager.Instance.PocketItem(__instance, value);
			BagWheelNetworkManager.Instance.PocketItemServerRpc((int)__instance.playerClientId, NetworkObjectReference.op_Implicit(((Component)value).GetComponent<NetworkObject>()));
			beltBagItem.RemoveObjectFromBag(bagItem.Value.Key);
			bagItem = null;
			return false;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")]
		[HarmonyPrefix]
		private static void PreSwitchItem(ref PlayerControllerB __instance)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if (bagItem.HasValue && !((Object)(object)beltBagItem == (Object)null))
			{
				GrabbableObject value = bagItem.Value.Value;
				BagWheelNetworkManager.Instance.PocketItem(__instance, value);
				BagWheelNetworkManager.Instance.PocketItemServerRpc((int)__instance.playerClientId, NetworkObjectReference.op_Implicit(((Component)value).GetComponent<NetworkObject>()));
				bagItem = null;
			}
		}
	}
	internal class StartOfRoundPatch
	{
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyBefore(new string[] { "evaisa.lethallib" })]
		[HarmonyPostfix]
		private static void StartRound(ref StartOfRound __instance)
		{
			if (NetworkManager.Singleton.IsHost && !((Object)(object)BagWheelNetworkManager.Instance != (Object)null))
			{
				GameObject val = Object.Instantiate<GameObject>(BagWheel.managerPrefab, ((Component)__instance).transform.parent);
				val.GetComponent<NetworkObject>().Spawn(false);
				BagWheel.mls.LogInfo((object)"Spawning BagWheelNetworkManager");
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable()
		{
			BagWheelNetworkManager.Instance = null;
		}
	}
}
namespace BagWheel.Patches.ModsPatches
{
	[HarmonyPatch]
	internal class BetterSprayPaintPatch
	{
		public static bool HeldByLocalPlayer(ref object __instance, ref bool __result)
		{
			bool flag = CheckSprayPaintActivity(__instance);
			if (!flag)
			{
				__result = true;
			}
			return flag;
		}

		public static bool InActiveSlot(ref object __instance, ref bool __result)
		{
			bool flag = CheckSprayPaintActivity(__instance);
			if (!flag)
			{
				__result = true;
			}
			return flag;
		}

		public static bool CheckSprayPaintActivity(object instance)
		{
			if (!PlayerControllerBPatch.bagItem.HasValue)
			{
				return true;
			}
			if (!(PlayerControllerBPatch.bagItem.Value.Value is SprayPaintItem))
			{
				return true;
			}
			PropertyInfo property = instance.GetType().GetProperty("instance", BindingFlags.Instance | BindingFlags.NonPublic);
			if (property == null)
			{
				return true;
			}
			object? value = property.GetValue(instance);
			SprayPaintItem val = (SprayPaintItem)((value is SprayPaintItem) ? value : null);
			if (val != null && (Object)(object)val == (Object)(object)PlayerControllerBPatch.bagItem.Value.Value)
			{
				return false;
			}
			return true;
		}
	}
}
namespace BagWheel.Managers
{
	internal class BagWheelNetworkManager : NetworkBehaviour
	{
		public static BagWheelNetworkManager Instance;

		public void Awake()
		{
			Instance = this;
		}

		[ServerRpc(RequireOwnership = false)]
		public void SwitchToItemServerRpc(int playerId, NetworkObjectReference obj, int currentSlot)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3559127594u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, currentSlot);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3559127594u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SwitchToItemClientRpc(playerId, obj, currentSlot);
				}
			}
		}

		[ClientRpc]
		private void SwitchToItemClientRpc(int playerId, NetworkObjectReference obj, int currentSlot)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1305667388u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, currentSlot);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1305667388u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
				{
					GrabbableObject componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<GrabbableObject>();
					SwitchToItem(StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>(), componentInChildren, currentSlot);
				}
			}
		}

		public void SwitchToItem(PlayerControllerB player, GrabbableObject grabbableObject, int currentSlot)
		{
			player.currentItemSlot = currentSlot;
			if (((NetworkBehaviour)player).IsOwner)
			{
				for (int i = 0; i < HUDManager.Instance.itemSlotIconFrames.Length; i++)
				{
					((Component)HUDManager.Instance.itemSlotIconFrames[i]).GetComponent<Animator>().SetBool("selectedSlot", false);
				}
				((Component)HUDManager.Instance.itemSlotIconFrames[currentSlot]).GetComponent<Animator>().SetBool("selectedSlot", true);
			}
			if ((Object)(object)player.currentlyHeldObjectServer != (Object)null)
			{
				player.currentlyHeldObjectServer.playerHeldBy = player;
				if (((NetworkBehaviour)player).IsOwner)
				{
					player.SetSpecialGrabAnimationBool(false, player.currentlyHeldObjectServer);
				}
				player.currentlyHeldObjectServer.PocketItem();
				if (!string.IsNullOrEmpty(grabbableObject.itemProperties.pocketAnim))
				{
					player.playerBodyAnimator.SetTrigger(grabbableObject.itemProperties.pocketAnim);
				}
			}
			grabbableObject.playerHeldBy = player;
			grabbableObject.EquipItem();
			if (((NetworkBehaviour)player).IsOwner)
			{
				player.SetSpecialGrabAnimationBool(true, grabbableObject);
			}
			if ((Object)(object)player.currentlyHeldObjectServer != (Object)null)
			{
				if (grabbableObject.itemProperties.twoHandedAnimation || player.currentlyHeldObjectServer.itemProperties.twoHandedAnimation)
				{
					player.playerBodyAnimator.ResetTrigger("SwitchHoldAnimationTwoHanded");
					player.playerBodyAnimator.SetTrigger("SwitchHoldAnimationTwoHanded");
				}
				player.playerBodyAnimator.ResetTrigger("SwitchHoldAnimation");
				player.playerBodyAnimator.SetTrigger("SwitchHoldAnimation");
			}
			player.twoHandedAnimation = grabbableObject.itemProperties.twoHandedAnimation;
			player.twoHanded = grabbableObject.itemProperties.twoHanded;
			player.playerBodyAnimator.SetBool("GrabValidated", true);
			player.playerBodyAnimator.SetBool("cancelHolding", false);
			player.isHoldingObject = true;
			player.currentlyHeldObjectServer = grabbableObject;
			if (((NetworkBehaviour)player).IsOwner)
			{
				if (player.twoHanded)
				{
					HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, 0.1f, 0.13f, 0.13f);
					((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = true;
				}
				else
				{
					HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, 1.5f, 1f, 0.13f);
					((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false;
				}
				grabbableObject.parentObject = player.localItemHolder;
			}
			grabbableObject.EnablePhysics(false);
			grabbableObject.isHeld = true;
			grabbableObject.hasHitGround = false;
			grabbableObject.isInFactory = player.isInsideFactory;
			player.SetItemInElevator(player.isInHangarShipRoom, player.isInElevator, grabbableObject);
			player.twoHanded = grabbableObject.itemProperties.twoHanded;
			player.twoHandedAnimation = grabbableObject.itemProperties.twoHandedAnimation;
			if (!((NetworkBehaviour)player).IsOwner)
			{
				grabbableObject.parentObject = player.serverItemHolder;
				player.isHoldingObject = true;
				player.carryWeight = Mathf.Clamp(player.carryWeight + (grabbableObject.itemProperties.weight - 1f), 1f, 10f);
				if ((Object)(object)grabbableObject.itemProperties.grabSFX != (Object)null)
				{
					player.itemAudio.PlayOneShot(grabbableObject.itemProperties.grabSFX, 1f);
				}
			}
			if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsServer || ((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost)
			{
				((NetworkBehaviour)grabbableObject).NetworkObject.ChangeOwnership(player.playerClientId);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PocketItemServerRpc(int playerId, NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(172908582u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 172908582u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PocketItemClientRpc(playerId, obj);
				}
			}
		}

		[ClientRpc]
		private void PocketItemClientRpc(int playerId, NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00a4: 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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4124111130u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4124111130u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
			{
				PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
				if (!((NetworkBehaviour)component).IsOwner)
				{
					GrabbableObject componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<GrabbableObject>();
					PocketItem(component, componentInChildren);
				}
			}
		}

		public void PocketItem(PlayerControllerB player, GrabbableObject grabbableObject)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)player).IsOwner)
			{
				player.SetSpecialGrabAnimationBool(false, player.currentlyHeldObjectServer);
				((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false;
			}
			player.playerBodyAnimator.SetBool("cancelHolding", true);
			player.isHoldingObject = false;
			grabbableObject.EnablePhysics(false);
			grabbableObject.EnableItemMeshes(true);
			grabbableObject.isHeld = false;
			grabbableObject.parentObject = null;
			grabbableObject.DiscardItemOnClient();
			grabbableObject.targetFloorPosition = new Vector3(3000f, -400f, 3000f);
			grabbableObject.startFallingPosition = new Vector3(3000f, -400f, 3000f);
			player.currentlyHeldObjectServer = null;
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_BagWheelNetworkManager()
		{
			//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(3559127594u, new RpcReceiveHandler(__rpc_handler_3559127594));
			NetworkManager.__rpc_func_table.Add(1305667388u, new RpcReceiveHandler(__rpc_handler_1305667388));
			NetworkManager.__rpc_func_table.Add(172908582u, new RpcReceiveHandler(__rpc_handler_172908582));
			NetworkManager.__rpc_func_table.Add(4124111130u, new RpcReceiveHandler(__rpc_handler_4124111130));
		}

		private static void __rpc_handler_3559127594(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_004b: 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)
			//IL_006d: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				int currentSlot = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref currentSlot);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BagWheelNetworkManager)(object)target).SwitchToItemServerRpc(playerId, obj, currentSlot);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1305667388(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_004b: 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)
			//IL_006d: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				int currentSlot = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref currentSlot);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BagWheelNetworkManager)(object)target).SwitchToItemClientRpc(playerId, obj, currentSlot);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_172908582(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_0051: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BagWheelNetworkManager)(object)target).PocketItemServerRpc(playerId, obj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4124111130(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_0051: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BagWheelNetworkManager)(object)target).PocketItemClientRpc(playerId, obj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "BagWheelNetworkManager";
		}
	}
	public class ConfigManager
	{
		public static ConfigEntry<string> bagWheel;

		public static void Load()
		{
			bagWheel = BagWheel.configFile.Bind<string>("Global", "Bag wheel", "1:FLASHLIGHT,2:SHOVEL,3:SPRAY PAINT,4:WALKIE TALKIE,5:STUN GRENADE,6:BOOMBOX,7:ZAP GUN,8:TZP", "Bag wheel configuration.\nAccepted item names: FLASHLIGHT, SHOVEL, SPRAY PAINT, WALKIE TALKIE, STUN GRENADE, BOOMBOX, ZAP GUN, TZP, LOCKPICKER, JETPACK, EXTENSION LADDER, RADAR BOOSTER.\n To deactivate a slot put DISABLED in place of the name.");
		}

		public static void ConfigureWheelButtons()
		{
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			BagWheel.bagWheelInterface = Object.Instantiate<GameObject>(BagWheel.bagWheelPrefab, Vector3.zero, Quaternion.identity, HUDManager.Instance.HUDContainer.transform.parent);
			BagWheel.bagWheelInterface.transform.localPosition = Vector3.zero;
			if ((Object)(object)BagWheel.bagWheelInterface == (Object)null)
			{
				BagWheel.mls.LogError((object)"bagWheelInterface not initialized");
				return;
			}
			string[] array = bagWheel.Value.Split(',');
			string[] array2 = array;
			foreach (string text in array2)
			{
				string[] values = text.Split(':');
				if (values.Length == 2)
				{
					BagWheelButtonController bagButton = BagWheel.bagWheelInterface.GetComponentsInChildren<BagWheelButtonController>().FirstOrDefault((BagWheelButtonController b) => ((Object)((Component)b).gameObject).name.Equals("BagWheelButton" + values[0]));
					if ((Object)(object)bagButton == (Object)null)
					{
						BagWheel.mls.LogError((object)("Script not found for the " + text + " config"));
						break;
					}
					ConfigureWheelButton(ref bagButton, values[1]);
				}
			}
		}

		private static void ConfigureWheelButton(ref BagWheelButtonController bagButton, string name)
		{
			Image val = ((IEnumerable<Image>)((Component)bagButton).gameObject.GetComponentsInChildren<Image>()).FirstOrDefault((Func<Image, bool>)((Image b) => ((Object)((Component)b).gameObject).name.Equals("Icon")));
			if ((Object)(object)val == (Object)null)
			{
				BagWheel.mls.LogError((object)("Image not found for the " + name + " item"));
				return;
			}
			if ("DISABLED".Equals(name))
			{
				((Selectable)((Component)bagButton).gameObject.GetComponent<Button>()).interactable = false;
				return;
			}
			bagButton.itemName = name;
			string itemName = bagButton.itemName;
			if (itemName == null)
			{
				return;
			}
			switch (itemName.Length)
			{
			case 10:
				switch (itemName[0])
				{
				case 'F':
					if (itemName == "FLASHLIGHT")
					{
						bagButton.itemType = typeof(FlashlightItem);
						val.sprite = BagWheel.flashlightSprite;
					}
					break;
				case 'L':
					if (itemName == "LOCKPICKER")
					{
						bagButton.itemType = typeof(LockPicker);
						val.sprite = BagWheel.lockpickerSprite;
					}
					break;
				}
				break;
			case 13:
				switch (itemName[0])
				{
				case 'W':
					if (itemName == "WALKIE TALKIE")
					{
						bagButton.itemType = typeof(WalkieTalkie);
						val.sprite = BagWheel.walkieTalkieSprite;
					}
					break;
				case 'R':
					if (itemName == "RADAR BOOSTER")
					{
						bagButton.itemType = typeof(RadarBoosterItem);
						val.sprite = BagWheel.radarBoosterSprite;
					}
					break;
				}
				break;
			case 7:
				switch (itemName[0])
				{
				case 'B':
					if (itemName == "BOOMBOX")
					{
						bagButton.itemType = typeof(BoomboxItem);
						val.sprite = BagWheel.boomboxSprite;
					}
					break;
				case 'Z':
					if (itemName == "ZAP GUN")
					{
						bagButton.itemType = typeof(PatcherTool);
						val.sprite = BagWheel.zapGunSprite;
					}
					break;
				case 'J':
					if (itemName == "JETPACK")
					{
						bagButton.itemType = typeof(JetpackItem);
						val.sprite = BagWheel.jetpackSprite;
					}
					break;
				}
				break;
			case 6:
				if (itemName == "SHOVEL")
				{
					bagButton.itemType = typeof(Shovel);
					val.sprite = BagWheel.shovelSprite;
				}
				break;
			case 11:
				if (itemName == "SPRAY PAINT")
				{
					bagButton.itemType = typeof(SprayPaintItem);
					val.sprite = BagWheel.sprayPaintSprite;
				}
				break;
			case 12:
				if (itemName == "STUN GRENADE")
				{
					bagButton.itemType = typeof(StunGrenadeItem);
					val.sprite = BagWheel.stunGrenadeSprite;
				}
				break;
			case 3:
				if (itemName == "TZP")
				{
					bagButton.itemType = typeof(TetraChemicalItem);
					val.sprite = BagWheel.tzpSprite;
				}
				break;
			case 16:
				if (itemName == "EXTENSION LADDER")
				{
					bagButton.itemType = typeof(ExtensionLadderItem);
					val.sprite = BagWheel.extensionLadderSprite;
				}
				break;
			case 4:
			case 5:
			case 8:
			case 9:
			case 14:
			case 15:
				break;
			}
		}
	}
}
namespace BagWheel.CustomInputs
{
	internal class BagWheelInputs : LcInputActions
	{
		private static BagWheelInputs instance;

		public static BagWheelInputs Instance
		{
			get
			{
				if (instance == null)
				{
					instance = new BagWheelInputs();
				}
				return instance;
			}
			private set
			{
				instance = value;
			}
		}

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

		public void EnableInputs()
		{
			BagWheelKey.performed += OpenBagWheel;
		}

		public void OpenBagWheel(CallbackContext context)
		{
			if (((CallbackContext)(ref context)).performed && !((Object)(object)BagWheel.bagWheelInterface == (Object)null))
			{
				PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
				if (!((Object)(object)val == (Object)null) && !val.inSpecialInteractAnimation && HasBeltBagItem(val))
				{
					BagWheelController.OpenBagWheel(!BagWheelController.bagWheelSelected);
				}
			}
		}

		public bool HasBeltBagItem(PlayerControllerB player)
		{
			for (int i = 0; i < player.ItemSlots.Length; i++)
			{
				GrabbableObject val = player.ItemSlots[i];
				if (!((Object)(object)val == (Object)null) && val is BeltBagItem)
				{
					return true;
				}
			}
			return false;
		}
	}
}
namespace BagWheel.Behaviours
{
	public class BagWheelButtonController : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler
	{
		public Type itemType;

		public int Id;

		public string itemName;

		public Button button;

		private Animator animator;

		public TextMeshProUGUI itemText;

		private void Start()
		{
			button = ((Component)this).GetComponent<Button>();
			animator = ((Component)this).GetComponent<Animator>();
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			if (((Selectable)button).interactable)
			{
				animator.SetBool("Hover", true);
				((TMP_Text)itemText).text = itemName;
			}
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			if (((Selectable)button).interactable)
			{
				animator.SetBool("Hover", false);
				((TMP_Text)itemText).text = "";
			}
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			BagWheelController.OpenBagWheel(enable: false);
			if (SearchItem())
			{
				((TMP_Text)itemText).text = itemName;
			}
			else
			{
				((TMP_Text)itemText).text = "";
			}
		}

		public bool SearchItem()
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (itemType == null)
			{
				BagWheel.mls.LogError((object)"SearchItem: itemType is not initialized!");
				return false;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			for (int i = 0; i < localPlayerController.ItemSlots.Length; i++)
			{
				GrabbableObject val = localPlayerController.ItemSlots[i];
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				BeltBagItem val2 = (BeltBagItem)(object)((val is BeltBagItem) ? val : null);
				if (val2 == null)
				{
					continue;
				}
				for (int num = val2.objectsInBag.Count - 1; num >= 0; num--)
				{
					GrabbableObject val3 = val2.objectsInBag[num];
					if (!((Object)(object)val3 == (Object)null) && itemType.IsAssignableFrom(((object)val3).GetType()))
					{
						PlayerControllerBPatch.beltBagItem = val2;
						PlayerControllerBPatch.bagItem = new KeyValuePair<int, GrabbableObject>(num, val3);
						BagWheelNetworkManager.Instance.SwitchToItemServerRpc((int)localPlayerController.playerClientId, NetworkObjectReference.op_Implicit(((Component)val3).GetComponent<NetworkObject>()), i);
						return true;
					}
				}
			}
			return false;
		}
	}
	public class BagWheelController : MonoBehaviour
	{
		public Animator animator;

		public static bool bagWheelSelected;

		public static void OpenBagWheel(bool enable)
		{
			bagWheelSelected = enable;
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			localPlayerController.inSpecialMenu = enable;
			Cursor.lockState = (CursorLockMode)((!bagWheelSelected) ? 1 : 0);
			Cursor.visible = enable;
		}

		public void Update()
		{
			if (bagWheelSelected)
			{
				animator.SetBool("OpenBagWheel", true);
			}
			else
			{
				animator.SetBool("OpenBagWheel", false);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace BagWheel.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}