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 PRO_FLASHLIGHT = "Pro-flashlight";
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-Inhalant";
public const string LOCKPICKER = "Lockpicker";
public const string JETPACK = "Jetpack";
public const string EXTENSION_LADDER = "Extension Ladder";
public const string RADAR_BOOSTER = "Radar-Booster";
public const string WEED_KILLER = "Weed Killer";
public const string KNIFE = "Kitchen Knife";
}
[BepInPlugin("Lega.BagWheel", "Bag Wheel", "1.0.4")]
public class BagWheel : BaseUnityPlugin
{
private const string modGUID = "Lega.BagWheel";
private const string modName = "Bag Wheel";
private const string modVersion = "1.0.4";
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 Sprite weedKillerSprite;
public static Sprite knifeSprite;
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");
weedKillerSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/WeedKillerIcon.png");
knifeSprite = bundle.LoadAsset<Sprite>("Assets/Sprites/Icons/KitchenKnifeIcon.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_0078: 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_0092: 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)
if (((NetworkBehaviour)player).IsOwner)
{
player.SetSpecialGrabAnimationBool(false, grabbableObject);
((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false;
}
player.playerBodyAnimator.SetBool("cancelHolding", true);
player.isHoldingObject = false;
player.twoHanded = false;
player.twoHandedAnimation = 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;
player.currentlyHeldObject = null;
player.playerBodyAnimator.SetTrigger(grabbableObject.itemProperties.twoHandedAnimation ? "SwitchHoldAnimationTwoHanded" : "SwitchHoldAnimation");
}
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> slot1;
public static ConfigEntry<string> slot2;
public static ConfigEntry<string> slot3;
public static ConfigEntry<string> slot4;
public static ConfigEntry<string> slot5;
public static ConfigEntry<string> slot6;
public static ConfigEntry<string> slot7;
public static ConfigEntry<string> slot8;
public static void Load()
{
slot1 = BagWheel.configFile.Bind<string>("Global", "Slot 1", "Flashlight:Pro-flashlight,Flashlight", "Slot 1 configuration.\nThe format is ImageName:ItemNameList, accepted image names: Flashlight, Shovel, Spray Paint, Walkie-Talkie, Stun Grenade, Boombox, Zap Gun, TZP-Inhalant, Lockpicker, Jetpack, Extension Ladder, Radar-Booster, Weed Killer, Kitchen Knife.\nTo deactivate a slot put DISABLED in place of the image name.");
slot2 = BagWheel.configFile.Bind<string>("Global", "Slot 2", "Shovel:Shovel", "Slot 2 configuration.\nThe format is ImageName:ItemNameList, accepted image names: Flashlight, Shovel, Spray Paint, Walkie-Talkie, Stun Grenade, Boombox, Zap Gun, TZP-Inhalant, Lockpicker, Jetpack, Extension Ladder, Radar-Booster, Weed Killer, Kitchen Knife.\nTo deactivate a slot put DISABLED in place of the image name.");
slot3 = BagWheel.configFile.Bind<string>("Global", "Slot 3", "Spray Paint:Spray Paint", "Slot 3 configuration.\nThe format is ImageName:ItemNameList, accepted image names: Flashlight, Shovel, Spray Paint, Walkie-Talkie, Stun Grenade, Boombox, Zap Gun, TZP-Inhalant, Lockpicker, Jetpack, Extension Ladder, Radar-Booster, Weed Killer, Kitchen Knife.\nTo deactivate a slot put DISABLED in place of the image name.");
slot4 = BagWheel.configFile.Bind<string>("Global", "Slot 4", "Walkie-Talkie:Walkie-Talkie", "Slot 4 configuration.\nThe format is ImageName:ItemNameList, accepted image names: Flashlight, Shovel, Spray Paint, Walkie-Talkie, Stun Grenade, Boombox, Zap Gun, TZP-Inhalant, Lockpicker, Jetpack, Extension Ladder, Radar-Booster, Weed Killer, Kitchen Knife.\nTo deactivate a slot put DISABLED in place of the image name.");
slot5 = BagWheel.configFile.Bind<string>("Global", "Slot 5", "Stun Grenade:Stun Grenade", "Slot 5 configuration.\nThe format is ImageName:ItemNameList, accepted image names: Flashlight, Shovel, Spray Paint, Walkie-Talkie, Stun Grenade, Boombox, Zap Gun, TZP-Inhalant, Lockpicker, Jetpack, Extension Ladder, Radar-Booster, Weed Killer, Kitchen Knife.\nTo deactivate a slot put DISABLED in place of the image name.");
slot6 = BagWheel.configFile.Bind<string>("Global", "Slot 6", "Boombox:Boombox", "Slot 6 configuration.\nThe format is ImageName:ItemNameList, accepted image names: Flashlight, Shovel, Spray Paint, Walkie-Talkie, Stun Grenade, Boombox, Zap Gun, TZP-Inhalant, Lockpicker, Jetpack, Extension Ladder, Radar-Booster, Weed Killer, Kitchen Knife.\nTo deactivate a slot put DISABLED in place of the image name.");
slot7 = BagWheel.configFile.Bind<string>("Global", "Slot 7", "Zap Gun:Zap Gun", "Slot 7 configuration.\nThe format is ImageName:ItemNameList, accepted image names: Flashlight, Shovel, Spray Paint, Walkie-Talkie, Stun Grenade, Boombox, Zap Gun, TZP-Inhalant, Lockpicker, Jetpack, Extension Ladder, Radar-Booster, Weed Killer, Kitchen Knife.\nTo deactivate a slot put DISABLED in place of the image name.");
slot8 = BagWheel.configFile.Bind<string>("Global", "Slot 8", "TZP-Inhalant:TZP-Inhalant", "Slot 8 configuration.\nThe format is ImageName:ItemNameList, accepted image names: Flashlight, Shovel, Spray Paint, Walkie-Talkie, Stun Grenade, Boombox, Zap Gun, TZP-Inhalant, Lockpicker, Jetpack, Extension Ladder, Radar-Booster, Weed Killer, Kitchen Knife.\nTo deactivate a slot put DISABLED in place of the image 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;
}
ConfigEntry<string>[] array = new ConfigEntry<string>[8] { slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8 };
for (int i = 0; i < array.Length; i++)
{
ConfigureSlot(i + 1, array[i]);
}
}
private static void ConfigureSlot(int slotId, ConfigEntry<string> slot)
{
string[] array = slot.Value.Split(':');
if (array.Length == 2)
{
BagWheelButtonController bagButton = BagWheel.bagWheelInterface.GetComponentsInChildren<BagWheelButtonController>().FirstOrDefault((BagWheelButtonController b) => ((Object)((Component)b).gameObject).name.Equals($"BagWheelButton{slotId}"));
if ((Object)(object)bagButton == (Object)null)
{
BagWheel.mls.LogError((object)("Script not found for the " + slot.Value + " config"));
}
else
{
ConfigureWheelButton(ref bagButton, array[1].Split(','), array[0]);
}
}
}
private static void ConfigureWheelButton(ref BagWheelButtonController bagButton, string[] itemNames, string spriteName)
{
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 " + spriteName));
return;
}
if ("DISABLED".Equals(spriteName))
{
((Selectable)((Component)bagButton).gameObject.GetComponent<Button>()).interactable = false;
return;
}
bagButton.eligibleItems = itemNames.ToList();
bagButton.itemName = spriteName;
Image val2 = val;
val2.sprite = (Sprite)(spriteName switch
{
"Flashlight" => BagWheel.flashlightSprite,
"Shovel" => BagWheel.shovelSprite,
"Spray Paint" => BagWheel.sprayPaintSprite,
"Walkie-Talkie" => BagWheel.walkieTalkieSprite,
"Stun Grenade" => BagWheel.stunGrenadeSprite,
"Boombox" => BagWheel.boomboxSprite,
"Zap Gun" => BagWheel.zapGunSprite,
"TZP-Inhalant" => BagWheel.tzpSprite,
"Lockpicker" => BagWheel.lockpickerSprite,
"Jetpack" => BagWheel.jetpackSprite,
"Extension Ladder" => BagWheel.extensionLadderSprite,
"Radar-Booster" => BagWheel.radarBoosterSprite,
"Weed Killer" => BagWheel.weedKillerSprite,
"Kitchen Knife" => BagWheel.knifeSprite,
_ => BagWheel.shovelSprite,
});
}
}
}
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.twoHanded && !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 int Id;
public string itemName;
public List<string> eligibleItems = new List<string>();
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_00d3: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrEmpty(itemName))
{
BagWheel.mls.LogError((object)"SearchItem: itemName is not assigned!");
return false;
}
if (!eligibleItems.Any())
{
BagWheel.mls.LogError((object)"SearchItem: eligibleItems is not assigned!");
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 j = 0; j < val2.objectsInBag.Count; j++)
{
GrabbableObject val3 = val2.objectsInBag[j];
if (!((Object)(object)val3 == (Object)null) && eligibleItems.Contains(val3.itemProperties.itemName))
{
PlayerControllerBPatch.beltBagItem = val2;
PlayerControllerBPatch.bagItem = new KeyValuePair<int, GrabbableObject>(j, 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
{
}
}