using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("RepoAutoBackpack")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RepoAutoBackpack")] [assembly: AssemblyTitle("RepoAutoBackpack")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RepoAutoBackpack { [BepInPlugin("com.gaming.repoautobackpack", "RepoAutoBackpack", "2.0.6")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.gaming.repoautobackpack"; public const string PluginName = "RepoAutoBackpack"; public const string PluginVersion = "2.0.6"; private InventoryPrisonController? _controller; private void Awake() { _controller = ((Component)this).gameObject.AddComponent(); _controller.Initialize(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"RepoAutoBackpack 2.0.6 loaded."); } } internal sealed class InventoryPrisonController : MonoBehaviour { private sealed class StoredSlot { public bool IsActive; public Component? PhysGrabObject; public Component? Avatar; public Component? DeathHead; public HiddenVisualState? HiddenVisualState; public Sprite? SlotIcon; public bool VisualHidden; public Coroutine? StoreRoutine; public Coroutine? ReleaseRoutine; public string DisplayName = string.Empty; } private sealed class HiddenVisualState { public readonly List Renderers = new List(); public readonly List Particles = new List(); } private readonly struct RendererState { public readonly Renderer Renderer; public readonly bool Enabled; public RendererState(Renderer renderer, bool enabled) { Renderer = renderer; Enabled = enabled; } } private readonly struct ParticleState { public readonly GameObject GameObject; public readonly bool Active; public ParticleState(GameObject gameObject, bool active) { GameObject = gameObject; Active = active; } } private const string CarryConsentPropertyKey = "RepoAutoBackpackCarryConsentUntil"; private const float CarryConsentSeconds = 4f; private const float StoredFollowDistance = 0.45f; private const float StoredFollowHeight = 0.95f; private const float StoredMaintainIntervalSeconds = 0.05f; private const float StoreAnimationSeconds = 0.18f; private const float ReleaseAnimationSeconds = 0.16f; private readonly StoredSlot[] _slots = new StoredSlot[3] { new StoredSlot(), new StoredSlot(), new StoredSlot() }; private ManualLogSource? _log; private ConfigEntry? _scanInterval; private ConfigEntry? _consentKey; private ConfigEntry? _releaseDistance; private ConfigEntry? _releaseOffset; private float _nextScanAt; private float _nextStoredMaintainAt; private Component? _localGrabber; private Component? _localAvatar; private Transform? _localTransform; private Sprite? _storedHeadSlotIcon; private Sprite? _storedPlayerSlotIcon; public void Initialize(ConfigFile config, ManualLogSource logger) { _log = logger; _scanInterval = config.Bind("General", "ScanIntervalSeconds", 1.2f, "How often to refresh local player/grabber references."); _consentKey = config.Bind("General", "ConsentKey", (KeyCode)113, "Small players press this to allow a short carry window."); _releaseDistance = config.Bind("General", "ReleaseDistance", 1.6f, "Distance in front of you when releasing a stored target."); _releaseOffset = config.Bind("General", "ReleaseOffset", "0,0.25,0", "Additional release offset. Format: x,y,z"); } private void OnDestroy() { for (int i = 0; i < _slots.Length; i++) { ReleaseSlot(i, restoreInput: true, forceNearPlayer: false); } } private void Update() { if (Time.unscaledTime >= _nextScanAt) { ResolveLocalReferences(); _nextScanAt = Time.unscaledTime + (_scanInterval?.Value ?? 1.2f); } if (!((Object)(object)_localGrabber == (Object)null) && !((Object)(object)_localTransform == (Object)null)) { HandleConsentInput(); HandleSlotInput((KeyCode)49, 0); HandleSlotInput((KeyCode)50, 1); HandleSlotInput((KeyCode)51, 2); MaintainStoredTargets(); } } private void ResolveLocalReferences() { MonoBehaviour[] array = Object.FindObjectsOfType(); foreach (MonoBehaviour val in array) { if (!((Object)(object)val == (Object)null) && string.Equals(((object)val).GetType().Name, "PhysGrabber", StringComparison.Ordinal) && TryReadBooleanMember(val, "isLocal")) { _localGrabber = (Component?)(object)val; _localAvatar = TryReadComponentMember(val, "playerAvatar"); Component? localAvatar = _localAvatar; Behaviour val2 = (Behaviour)(object)((localAvatar is Behaviour) ? localAvatar : null); if (val2 != null) { _localTransform = ((Component)val2).transform; } else { _localTransform = ((Component)val).transform; } return; } } _localGrabber = null; _localAvatar = null; _localTransform = null; } private void HandleSlotInput(KeyCode key, int slotIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyDown(key) || slotIndex < 0 || slotIndex >= _slots.Length) { return; } if (_slots[slotIndex].IsActive) { ReleaseSlot(slotIndex, restoreInput: true, forceNearPlayer: true); } else { if ((Object)(object)_localGrabber == (Object)null) { return; } Component val = TryReadComponentMember(_localGrabber, "grabbedPhysGrabObject"); if ((Object)(object)val == (Object)null) { return; } Component val2 = FindComponentByTypeName(val.transform, "PlayerAvatar"); Component val3 = FindComponentByTypeName(val.transform, "PlayerTumble"); if ((Object)(object)val2 == (Object)null && (Object)(object)val3 != (Object)null) { val2 = TryReadComponentMember(val3, "playerAvatar"); } Component val4 = FindComponentByTypeName(val.transform, "PlayerDeathHead"); if ((Object)(object)val2 == (Object)null && (Object)(object)val4 == (Object)null) { return; } if (!CanStoreTarget(val2, val4)) { ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)"Target is only carryable when dead/spectating, or while alive in crouch/crawl/tumble after Q consent."); } } else { TryInvokeMethod(_localGrabber, "ReleaseObject", -1, 0.1f); StoreInSlot(slotIndex, val, val2, val4); } } } private void HandleConsentInput() { //IL_000e: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown ConfigEntry? consentKey = _consentKey; if (Input.GetKeyDown((KeyCode)((consentKey == null) ? 113 : ((int)consentKey.Value))) && !((Object)(object)_localAvatar == (Object)null) && IsCarryConsentPose(_localAvatar) && PhotonNetwork.LocalPlayer != null) { double num = PhotonNetwork.Time + 4.0; Hashtable val = new Hashtable { [(object)"RepoAutoBackpackCarryConsentUntil"] = num }; PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)"Carry consent granted for a short time."); } } } private void MaintainStoredTargets() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_localTransform == (Object)null || Time.unscaledTime < _nextStoredMaintainAt) { return; } _nextStoredMaintainAt = Time.unscaledTime + 0.05f; Vector3 val = _localTransform.position + _localTransform.forward * 0.45f + Vector3.up * 0.95f; Quaternion val2 = Quaternion.LookRotation(_localTransform.forward, Vector3.up); for (int i = 0; i < _slots.Length; i++) { StoredSlot storedSlot = _slots[i]; Component val3 = storedSlot?.PhysGrabObject; if (storedSlot != null && storedSlot.IsActive && !((Object)(object)val3 == (Object)null)) { SetStoredPhysics(val3, kinematic: true); if (storedSlot.StoreRoutine == null && storedSlot.ReleaseRoutine == null) { TryInvokeMethod(val3, "Teleport", val, val2); } TryInvokeMethod(val3, "OverrideDeactivate", 1f); EnsureSlotIcon(i, enabled: true, storedSlot.SlotIcon); } } } private void StoreInSlot(int index, Component physGrabObject, Component? avatar, Component? deathHead) { if (_slots[index].IsActive) { ReleaseSlot(index, restoreInput: true, forceNearPlayer: false); } SetStoredPhysics(physGrabObject, kinematic: true); Sprite orCreateStoredIcon = GetOrCreateStoredIcon((Object)(object)deathHead != (Object)null); _slots[index] = new StoredSlot { IsActive = true, PhysGrabObject = physGrabObject, Avatar = avatar, DeathHead = deathHead, HiddenVisualState = null, SlotIcon = orCreateStoredIcon, DisplayName = (((Object)(object)avatar != (Object)null) ? "Player" : "DeathHead") }; EnsureSlotIcon(index, enabled: true, orCreateStoredIcon); StartStoreAnimation(index); ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)$"Stored {_slots[index].DisplayName} in slot {index + 1}."); } } private void ReleaseSlot(int index, bool restoreInput, bool forceNearPlayer) { //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) if (index < 0 || index >= _slots.Length) { return; } StoredSlot storedSlot = _slots[index]; if (!storedSlot.IsActive || (Object)(object)storedSlot.PhysGrabObject == (Object)null) { _slots[index] = new StoredSlot(); return; } if (storedSlot.StoreRoutine != null) { ((MonoBehaviour)this).StopCoroutine(storedSlot.StoreRoutine); storedSlot.StoreRoutine = null; if (!storedSlot.VisualHidden) { storedSlot.HiddenVisualState = CaptureAndHideVisualState(storedSlot.PhysGrabObject); storedSlot.VisualHidden = true; } } if (storedSlot.VisualHidden) { RestoreVisualState(storedSlot.HiddenVisualState); storedSlot.VisualHidden = false; storedSlot.HiddenVisualState = null; } Vector3 releasePos; Quaternion releaseRot; if (forceNearPlayer && (Object)(object)_localTransform != (Object)null) { releasePos = _localTransform.position + _localTransform.forward * (_releaseDistance?.Value ?? 1.6f) + ParseReleaseOffset(); releaseRot = Quaternion.LookRotation(_localTransform.forward, Vector3.up); } else { releasePos = storedSlot.PhysGrabObject.transform.position; releaseRot = storedSlot.PhysGrabObject.transform.rotation; } EnsureSlotIcon(index, enabled: false, null); if (storedSlot.ReleaseRoutine != null) { ((MonoBehaviour)this).StopCoroutine(storedSlot.ReleaseRoutine); } storedSlot.ReleaseRoutine = StartReleaseAnimation(storedSlot.PhysGrabObject, releasePos, releaseRot, forceNearPlayer); _slots[index] = new StoredSlot(); ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)$"Released slot {index + 1}."); } } private bool CanStoreTarget(Component? targetAvatar, Component? targetHead) { if ((Object)(object)targetHead != (Object)null) { return true; } if ((Object)(object)targetAvatar == (Object)null) { return false; } if (TryReadBooleanMember(targetAvatar, "deadSet") || TryReadBooleanMember(targetAvatar, "spectated")) { return true; } if (IsConsentActiveForAvatar(targetAvatar)) { return IsCarryConsentPose(targetAvatar); } return false; } private static void SetStoredPhysics(Component physGrabObject, bool kinematic) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) Component? obj = TryReadComponentMember(physGrabObject, "rb"); Rigidbody val = (Rigidbody)(object)((obj is Rigidbody) ? obj : null); if ((Object)(object)val != (Object)null) { val.velocity = Vector3.zero; val.angularVelocity = Vector3.zero; val.isKinematic = kinematic; } } private static HiddenVisualState CaptureAndHideVisualState(Component root) { HiddenVisualState hiddenVisualState = new HiddenVisualState(); Renderer[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { hiddenVisualState.Renderers.Add(new RendererState(val, val.enabled)); val.enabled = false; } } ParticleSystem[] componentsInChildren2 = root.GetComponentsInChildren(true); foreach (ParticleSystem val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { GameObject gameObject = ((Component)val2).gameObject; hiddenVisualState.Particles.Add(new ParticleState(gameObject, gameObject.activeSelf)); gameObject.SetActive(false); } } return hiddenVisualState; } private static void RestoreVisualState(HiddenVisualState? state) { if (state == null) { return; } foreach (RendererState renderer in state.Renderers) { if ((Object)(object)renderer.Renderer != (Object)null) { renderer.Renderer.enabled = renderer.Enabled; } } foreach (ParticleState particle in state.Particles) { if ((Object)(object)particle.GameObject != (Object)null) { particle.GameObject.SetActive(particle.Active); } } } private bool IsCarryConsentPose(Component avatar) { if (!TryReadBooleanMember(avatar, "isCrouching") && !TryReadBooleanMember(avatar, "isCrawling")) { return TryReadBooleanMember(avatar, "isTumbling"); } return true; } private void EnsureSlotIcon(int slotIndex, bool enabled, Sprite? slotIcon) { Component val = FindInventory(); if ((Object)(object)val == (Object)null) { return; } object? obj = TryInvokeMethod(val, "GetSpotByIndex", slotIndex); Component val2 = (Component)((obj is Component) ? obj : null); if (val2 != null) { if (!enabled) { TryInvokeMethod(val2, "SetEmoji", new object[1]); } else if ((Object)(object)slotIcon != (Object)null) { TryInvokeMethod(val2, "SetEmoji", slotIcon); } } } private static Component? FindInventory() { MonoBehaviour[] array = Object.FindObjectsOfType(); foreach (MonoBehaviour val in array) { if ((Object)(object)val != (Object)null && string.Equals(((object)val).GetType().Name, "Inventory", StringComparison.Ordinal)) { return (Component?)(object)val; } } return null; } private Sprite GetOrCreateStoredIcon(bool head) { if (head) { if (_storedHeadSlotIcon == null) { _storedHeadSlotIcon = CreateStoredHeadIcon(); } return _storedHeadSlotIcon; } if (_storedPlayerSlotIcon == null) { _storedPlayerSlotIcon = CreateStoredPlayerIcon(); } return _storedPlayerSlotIcon; } private static Sprite CreateStoredHeadIcon() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)1 }; Color32 val2 = default(Color32); ((Color32)(ref val2))..ctor((byte)0, (byte)0, (byte)0, (byte)0); Color32 val3 = default(Color32); ((Color32)(ref val3))..ctor((byte)233, (byte)228, (byte)160, byte.MaxValue); Color32 outer = default(Color32); ((Color32)(ref outer))..ctor((byte)35, (byte)20, (byte)22, byte.MaxValue); Color32 inner = default(Color32); ((Color32)(ref inner))..ctor((byte)215, (byte)35, (byte)40, byte.MaxValue); for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { val.SetPixel(j, i, Color32.op_Implicit(val2)); } } Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(15.5f, 17.050001f); float num = 11.52f; for (int k = 0; k < 32; k++) { for (int l = 0; l < 32; l++) { if (Vector2.Distance(new Vector2((float)l, (float)k), val4) <= num) { val.SetPixel(l, k, Color32.op_Implicit(val3)); } } } PaintEye(val, 32, val4 + new Vector2(-6f, -1f), outer, inner); PaintEye(val, 32, val4 + new Vector2(6f, -1f), outer, inner); val.Apply(false, true); return Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 32f); } private static Sprite CreateStoredPlayerIcon() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)1 }; Color32 val2 = default(Color32); ((Color32)(ref val2))..ctor((byte)0, (byte)0, (byte)0, (byte)0); Color32 val3 = default(Color32); ((Color32)(ref val3))..ctor((byte)170, (byte)197, (byte)220, byte.MaxValue); Color32 val4 = default(Color32); ((Color32)(ref val4))..ctor((byte)32, (byte)38, (byte)44, byte.MaxValue); for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { val.SetPixel(j, i, Color32.op_Implicit(val2)); } } for (int k = 9; k < 24; k++) { for (int l = 9; l < 24; l++) { bool flag = l == 9 || k == 9 || l == 23 || k == 23; val.SetPixel(l, k, Color32.op_Implicit(flag ? val4 : val3)); } } val.Apply(false, true); return Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 32f); } private static void PaintEye(Texture2D texture, int size, Vector2 center, Color32 outer, Color32 inner) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) float num = 3.6f; float num2 = 1.4f; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num3 = Vector2.Distance(new Vector2((float)j, (float)i), center); if (num3 <= num) { texture.SetPixel(j, i, Color32.op_Implicit(outer)); } if (num3 <= num2) { texture.SetPixel(j, i, Color32.op_Implicit(inner)); } } } } private void StartStoreAnimation(int slotIndex) { StoredSlot storedSlot = _slots[slotIndex]; if (storedSlot.IsActive && !((Object)(object)storedSlot.PhysGrabObject == (Object)null)) { if (storedSlot.StoreRoutine != null) { ((MonoBehaviour)this).StopCoroutine(storedSlot.StoreRoutine); } storedSlot.StoreRoutine = ((MonoBehaviour)this).StartCoroutine(StoreAnimationRoutine(slotIndex)); } } private IEnumerator StoreAnimationRoutine(int slotIndex) { StoredSlot slot = _slots[slotIndex]; if (!slot.IsActive || (Object)(object)slot.PhysGrabObject == (Object)null) { yield break; } Vector3 startPos = slot.PhysGrabObject.transform.position; Quaternion startRot = slot.PhysGrabObject.transform.rotation; float elapsed = 0f; while (elapsed < 0.18f && slot.IsActive && (Object)(object)slot.PhysGrabObject != (Object)null) { elapsed += Time.deltaTime; float num = Mathf.Clamp01(elapsed / 0.18f); if ((Object)(object)_localTransform != (Object)null) { Vector3 val = _localTransform.position + _localTransform.forward * 0.45f + Vector3.up * 0.95f; Quaternion val2 = Quaternion.LookRotation(_localTransform.forward, Vector3.up); Vector3 val3 = Vector3.Lerp(startPos, val, num); Quaternion val4 = Quaternion.Slerp(startRot, val2, num); TryInvokeMethod(slot.PhysGrabObject, "Teleport", val3, val4); } yield return null; } if (slot.IsActive && (Object)(object)slot.PhysGrabObject != (Object)null && !slot.VisualHidden) { slot.HiddenVisualState = CaptureAndHideVisualState(slot.PhysGrabObject); slot.VisualHidden = true; } slot.StoreRoutine = null; } private Coroutine StartReleaseAnimation(Component physGrabObject, Vector3 releasePos, Quaternion releaseRot, bool autoGrabAfterRelease) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) return ((MonoBehaviour)this).StartCoroutine(ReleaseAnimationRoutine(physGrabObject, releasePos, releaseRot, autoGrabAfterRelease)); } private IEnumerator ReleaseAnimationRoutine(Component physGrabObject, Vector3 releasePos, Quaternion releaseRot, bool autoGrabAfterRelease) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) SetStoredPhysics(physGrabObject, kinematic: true); Vector3 startPos = physGrabObject.transform.position; Quaternion startRot = physGrabObject.transform.rotation; float elapsed = 0f; while (elapsed < 0.16f) { elapsed += Time.deltaTime; float num = Mathf.Clamp01(elapsed / 0.16f); Vector3 val = Vector3.Lerp(startPos, releasePos, num); Quaternion val2 = Quaternion.Slerp(startRot, releaseRot, num); TryInvokeMethod(physGrabObject, "Teleport", val, val2); yield return null; } SetStoredPhysics(physGrabObject, kinematic: false); TryInvokeMethod(physGrabObject, "Teleport", releasePos, releaseRot); if (autoGrabAfterRelease && (Object)(object)_localGrabber != (Object)null) { TryInvokeMethod(_localGrabber, "OverrideGrab", physGrabObject, 0.25f, false); } for (int i = 0; i < _slots.Length; i++) { if (_slots[i].ReleaseRoutine != null) { _slots[i].ReleaseRoutine = null; } } } private bool IsConsentActiveForAvatar(Component avatar) { if (TryReadMemberObject(avatar, "photonView", out object value)) { PhotonView val = (PhotonView)((value is PhotonView) ? value : null); if (val != null) { if (val.Owner == null) { return false; } if (!((Dictionary)(object)val.Owner.CustomProperties).TryGetValue((object)"RepoAutoBackpackCarryConsentUntil", out object value2)) { return false; } if (!TryConvertToDouble(value2, out var result)) { return false; } return result > PhotonNetwork.Time; } } return false; } private static bool TryConvertToDouble(object value, out double result) { try { result = Convert.ToDouble(value, CultureInfo.InvariantCulture); return true; } catch { result = 0.0; return false; } } private Vector3 ParseReleaseOffset() { //IL_0033: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) string text = _releaseOffset?.Value ?? string.Empty; if (string.IsNullOrWhiteSpace(text)) { return new Vector3(0f, 0.25f, 0f); } string[] array = text.Split(new char[1] { ',' }); if (array.Length != 3) { return new Vector3(0f, 0.25f, 0f); } if (!float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result) || !float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) || !float.TryParse(array[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3)) { return new Vector3(0f, 0.25f, 0f); } return new Vector3(result, result2, result3); } private static Component? FindComponentByTypeName(Transform start, string typeName) { MonoBehaviour[] componentsInParent = ((Component)start).GetComponentsInParent(true); foreach (MonoBehaviour val in componentsInParent) { if ((Object)(object)val != (Object)null && string.Equals(((object)val).GetType().Name, typeName, StringComparison.Ordinal)) { return (Component?)(object)val; } } componentsInParent = ((Component)start).GetComponentsInChildren(true); foreach (MonoBehaviour val2 in componentsInParent) { if ((Object)(object)val2 != (Object)null && string.Equals(((object)val2).GetType().Name, typeName, StringComparison.Ordinal)) { return (Component?)(object)val2; } } return null; } private static Component? TryReadComponentMember(object instance, string memberName) { Type type = instance.GetType(); FieldInfo field = type.GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(instance); return (Component?)((value is Component) ? value : null); } PropertyInfo property = type.GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.GetMethod != null) { object? value2 = property.GetValue(instance, null); return (Component?)((value2 is Component) ? value2 : null); } return null; } private static bool TryReadMemberObject(object instance, string memberName, out object? value) { Type type = instance.GetType(); FieldInfo field = type.GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { value = field.GetValue(instance); return true; } PropertyInfo property = type.GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.GetMethod != null) { value = property.GetValue(instance, null); return true; } value = null; return false; } private static object? TryInvokeMethod(object instance, string methodName, params object?[] args) { MethodInfo[] methods = instance.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!string.Equals(methodInfo.Name, methodName, StringComparison.Ordinal)) { continue; } ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length < args.Length) { continue; } object[] array = new object[parameters.Length]; bool flag = true; for (int j = 0; j < parameters.Length; j++) { if (j < args.Length) { object obj = args[j]; if (obj == null) { array[j] = null; continue; } Type parameterType = parameters[j].ParameterType; if (parameterType.IsInstanceOfType(obj)) { array[j] = obj; continue; } try { array[j] = Convert.ChangeType(obj, parameterType, CultureInfo.InvariantCulture); } catch { flag = false; break; } } else { if (!parameters[j].IsOptional) { flag = false; break; } array[j] = parameters[j].DefaultValue; } } if (flag) { return methodInfo.Invoke(instance, array); } } return null; } private static bool TryReadBooleanMember(object instance, string memberName) { Type type = instance.GetType(); FieldInfo field = type.GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(bool)) { object value = field.GetValue(instance); if (value is bool) { return (bool)value; } } PropertyInfo property = type.GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.PropertyType == typeof(bool) && property.GetMethod != null) { object value = property.GetValue(instance, null); if (value is bool) { return (bool)value; } } return false; } } }