Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of L I D A R v1.0.0
BepInEx/plugins/LIDAR/L.I.D.A.R.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("L.I.D.A.R")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("L.I.D.A.R")] [assembly: AssemblyTitle("L.I.D.A.R")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 LIDAR { public static class LidarConfig { public static ConfigEntry<KeyCode> StreamKey; public static ConfigEntry<KeyCode> BurstKey; public static ConfigEntry<KeyCode> ToggleBlackoutKey; public static ConfigEntry<KeyCode> PreviewUpgradesKey; public static ConfigEntry<KeyCode> ClearPointsKey; public static ConfigEntry<float> GrabbedPointRadius; public static ConfigEntry<bool> HideColliderlessCarpets; public static ConfigEntry<float> BaseRange; public static ConfigEntry<float> PointLifetime; public static ConfigEntry<float> PointSize; public static ConfigEntry<float> BaseSpreadAngle; public static ConfigEntry<float> StreamRaysPerSecond; public static ConfigEntry<int> BurstRayCount; public static ConfigEntry<float> MaxEnergy; public static ConfigEntry<float> StreamEnergyCost; public static ConfigEntry<float> BurstEnergyCost; public static ConfigEntry<float> RechargeRate; public static ConfigEntry<float> BurstCooldown; public static ConfigEntry<bool> GrabbedObjectPoints; public static ConfigEntry<int> GrabbedPointCount; public static ConfigEntry<float> HudOffsetY; public static ConfigEntry<bool> EnableAudio; public static ConfigEntry<float> AudioVolume; public static ConfigEntry<Color> BaseMonoColor; public static ConfigEntry<Color> WallNearColor; public static ConfigEntry<Color> WallFarColor; public static ConfigEntry<Color> EnemyColor; public static ConfigEntry<Color> TeammateColor; public static ConfigEntry<Color> ValuableColor; public static ConfigEntry<Color> InteractiveColor; public static ConfigEntry<Color> StaminaBarColor; public static ConfigEntry<bool> EnableShopUpgrades; public static ConfigEntry<float> RangePriceMult; public static ConfigEntry<float> StaminaPriceMult; public static ConfigEntry<float> ColorPriceMult; public static ConfigEntry<float> LifetimePriceMult; public static ConfigEntry<float> BeamWidthPriceMult; public static ConfigEntry<bool> HighlightExtractionButton; public static ConfigEntry<bool> ShowCartHaulDisplay; public static void Bind(ConfigFile cfg) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Expected O, but got Unknown //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Expected O, but got Unknown //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Expected O, but got Unknown //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Expected O, but got Unknown //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Expected O, but got Unknown //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Expected O, but got Unknown //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Expected O, but got Unknown //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Expected O, but got Unknown //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Expected O, but got Unknown //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Unknown result type (might be due to invalid IL or missing references) StreamKey = cfg.Bind<KeyCode>("Keybinds", "StreamScanKey", (KeyCode)118, "Hold to emit LIDAR beam."); BurstKey = cfg.Bind<KeyCode>("Keybinds", "BurstScanKey", (KeyCode)102, "Press for 360-degree LIDAR pulse."); ClearPointsKey = cfg.Bind<KeyCode>("Keybinds", "ClearPointsKey", (KeyCode)8, "Clear all active points."); EnableShopUpgrades = cfg.Bind<bool>("ShopUpgrades", "EnableShopUpgrades", true, "Add the 5 L.I.D.A.R. upgrade boxes to the in-game shop."); RangePriceMult = cfg.Bind<float>("ShopUpgrades", "RangePriceMultiplier", 0.85f, new ConfigDescription("Price multiplier for L.I.D.A.R. Range relative to vanilla Grab Strength.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 5f), Array.Empty<object>())); StaminaPriceMult = cfg.Bind<float>("ShopUpgrades", "BatteryPriceMultiplier", 0.9f, new ConfigDescription("Price multiplier for L.I.D.A.R. Battery.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 5f), Array.Empty<object>())); ColorPriceMult = cfg.Bind<float>("ShopUpgrades", "ChromaPriceMultiplier", 1.5f, new ConfigDescription("Price multiplier for L.I.D.A.R. Chroma (color mode).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 5f), Array.Empty<object>())); LifetimePriceMult = cfg.Bind<float>("ShopUpgrades", "PersistencePriceMultiplier", 0.85f, new ConfigDescription("Price multiplier for L.I.D.A.R. Persistence.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 5f), Array.Empty<object>())); BeamWidthPriceMult = cfg.Bind<float>("ShopUpgrades", "WideBeamPriceMultiplier", 0.95f, new ConfigDescription("Price multiplier for L.I.D.A.R. Wide Beam.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 5f), Array.Empty<object>())); BaseRange = cfg.Bind<float>("Scanner", "BaseRange", 13f, new ConfigDescription("Base LIDAR scan range in meters.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(4f, 40f), Array.Empty<object>())); PointLifetime = cfg.Bind<float>("Scanner", "BasePointLifetime", 12f, new ConfigDescription("Base point lifetime in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 60f), Array.Empty<object>())); PointSize = cfg.Bind<float>("Scanner", "PointSize", 0.024f, new ConfigDescription("Visual size of each LIDAR dot.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.008f, 0.06f), Array.Empty<object>())); BaseSpreadAngle = cfg.Bind<float>("Scanner", "BaseSpreadAngle", 12f, new ConfigDescription("Base beam cone spread angle.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 45f), Array.Empty<object>())); StreamRaysPerSecond = cfg.Bind<float>("Scanner", "StreamRaysPerSecond", 300f, new ConfigDescription("Dots per second during stream scan.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 1500f), Array.Empty<object>())); BurstRayCount = cfg.Bind<int>("Scanner", "BurstRayCount", 260, new ConfigDescription("Dots emitted per 360-degree burst.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(40, 600), Array.Empty<object>())); MaxEnergy = cfg.Bind<float>("Stamina", "BaseMaxEnergy", 100f, new ConfigDescription("Base LIDAR energy capacity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(30f, 300f), Array.Empty<object>())); StreamEnergyCost = cfg.Bind<float>("Stamina", "StreamEnergyCostPerSec", 35f, new ConfigDescription("Energy drained per second while scanning.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 100f), Array.Empty<object>())); BurstEnergyCost = cfg.Bind<float>("Stamina", "BurstEnergyCost", 45f, new ConfigDescription("Energy cost per burst pulse.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 100f), Array.Empty<object>())); RechargeRate = cfg.Bind<float>("Stamina", "BaseRechargeRate", 16f, new ConfigDescription("Base energy recharge per second.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(4f, 80f), Array.Empty<object>())); BurstCooldown = cfg.Bind<float>("Stamina", "BaseBurstCooldown", 2.2f, new ConfigDescription("Base cooldown between bursts in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 10f), Array.Empty<object>())); GrabbedObjectPoints = cfg.Bind<bool>("GrabbedObject", "EnableGrabbedHighlight", true, "Keep moving LIDAR dots attached to the object you are currently holding."); GrabbedPointCount = cfg.Bind<int>("GrabbedObject", "GrabbedPointCount", 28, new ConfigDescription("Number of moving dots around the grab point.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(8, 64), Array.Empty<object>())); GrabbedPointRadius = cfg.Bind<float>("GrabbedObject", "GrabbedPointRadius", 0.22f, new ConfigDescription("Radius of the dot cluster around the grab point (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.06f, 0.8f), Array.Empty<object>())); HideColliderlessCarpets = cfg.Bind<bool>("VisualFixes", "HideColliderlessCarpets", true, "Hide flat collider-less carpets during blackout so floor dots are not occluded."); HudOffsetY = cfg.Bind<float>("HUD", "StaminaBarOffsetY", 125f, new ConfigDescription("Height of the stamina bar from the bottom of the screen in pixels.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(40f, 400f), Array.Empty<object>())); EnableAudio = cfg.Bind<bool>("Audio", "EnableSounds", true, "Enable procedural LIDAR scan and pulse sounds."); AudioVolume = cfg.Bind<float>("Audio", "Volume", 0.45f, new ConfigDescription("LIDAR sound volume.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); HighlightExtractionButton = cfg.Bind<bool>("HUD", "HighlightExtractionButton", true, "Glow and mark the Extraction Point activation button and screen when in line of sight."); ShowCartHaulDisplay = cfg.Bind<bool>("HUD", "ShowCartHaulDisplay", true, "Keep the C.A.R.T. haul money screen readable in darkness when looking at it."); BaseMonoColor = cfg.Bind<Color>("Colors", "BaseMonoColor", new Color(0.92f, 0.96f, 1f, 1f), "Base dot color before unlocking color module."); WallNearColor = cfg.Bind<Color>("Colors", "WallNearColor", new Color(0.18f, 0.38f, 0.88f, 1f), "Geometry color up close (color module)."); WallFarColor = cfg.Bind<Color>("Colors", "WallFarColor", new Color(0.06f, 0.14f, 0.45f, 1f), "Geometry color at max range (color module)."); EnemyColor = cfg.Bind<Color>("Colors", "EnemyColor", new Color(1f, 0.14f, 0.14f, 1f), "Enemy dot color."); TeammateColor = cfg.Bind<Color>("Colors", "TeammateColor", new Color(1f, 0.92f, 0.15f, 1f), "Teammate dot color (yellow)."); ValuableColor = cfg.Bind<Color>("Colors", "ValuableColor", new Color(1f, 0.52f, 0.08f, 1f), "Valuable loot dot color (orange)."); InteractiveColor = cfg.Bind<Color>("Colors", "InteractiveColor", new Color(0.18f, 0.92f, 0.38f, 1f), "Interactive objects dot color (doors, crates, cart)."); StaminaBarColor = cfg.Bind<Color>("Colors", "StaminaBarColor", new Color(1f, 0.52f, 0.08f, 0.95f), "HUD stamina bar fill color (orange)."); } } public struct LidarPoint { public Vector3 Position; public float SpawnTime; public Color Color; } public class LidarUpgrades { public int RangeLevel; public int StaminaLevel; public bool ColorModule; public int LifetimeLevel; public int BeamWidthLevel; public float MaxDistance => LidarConfig.BaseRange.Value + (float)RangeLevel * 3.5f; public float PointLifetime => LidarConfig.PointLifetime.Value + (float)LifetimeLevel * 5f; public float FadeDuration => Mathf.Min(3.5f, PointLifetime * 0.35f); public float MaxEnergy => LidarConfig.MaxEnergy.Value + (float)StaminaLevel * 25f; public float RechargeRate => LidarConfig.RechargeRate.Value + (float)StaminaLevel * 6f; public float RechargeDelay => Mathf.Max(0.25f, 0.85f - (float)StaminaLevel * 0.15f); public float BurstCooldown => Mathf.Max(0.5f, LidarConfig.BurstCooldown.Value - (float)StaminaLevel * 0.35f); public float SpreadAngle => LidarConfig.BaseSpreadAngle.Value + (float)BeamWidthLevel * 4.5f; public float StreamRaysPerSecond => LidarConfig.StreamRaysPerSecond.Value + (float)BeamWidthLevel * 70f; public int BurstRayCount => LidarConfig.BurstRayCount.Value + BeamWidthLevel * 35; } public class LidarController : MonoBehaviour, IOnEventCallback { private sealed class ExtractionVisualCache { public ExtractionPoint Point; public Transform? ButtonAnchor; public readonly List<MeshRenderer> ButtonRenderers = new List<MeshRenderer>(); } private const int MaxPoints = 150000; private const int MaxGrabbedSlots = 64; private const int WorldPointLimit = 149936; private const CameraEvent RenderEvent = (CameraEvent)12; private const CameraEvent OverlayEvent = (CameraEvent)17; private const byte LidarScanEventCode = 173; private const float NetSyncInterval = 0.12f; private const float WallSurfaceOffset = 0.008f; private const float InteractiveSurfaceOffset = 0.028f; private const float DoorSurfaceOffset = 0.075f; public readonly LidarUpgrades Upgrades = new LidarUpgrades(); private int _scanLayerMask = -5; private int _hingeLayer = -1; private ComputeBuffer _pointsBuffer; private Material _pointsMaterial; private Material? _buttonHighlightMat; private CommandBuffer _cmd; private CommandBuffer _overlayCmd; private Texture2D _uiPixel; private GUIStyle? _cartPriceStyle; private AudioSource _audioSource; private AudioClip _tickClip; private AudioClip _burstClip; private AudioClip _overheatClip; private float _tickSoundTimer; private Camera? _attachedCam; private CameraClearFlags _origClearFlags; private Color _origBgColor; private RenderingPath _origRenderingPath; private bool _origFogEnabled; private bool _blackoutEnabled; private bool _wasInLevel; private int _writeIndex; private readonly List<LidarPoint> _frameBatch = new List<LidarPoint>(512); private readonly Random _seedGen = new Random(); private float _energy; private bool _overheated; private bool _isActivelyScanning; private float _hudAlpha; private float _rechargeDelayTimer; private float _burstCooldownTimer; private float _scanAccumulator; private float _netSyncTimer; private int _netPendingConeRays; private FieldInfo? _grabbedBoolField; private FieldInfo? _grabbedObjField; private FieldInfo? _grabPointTransformField; private FieldInfo? _localGrabPosField; private PhysGrabObject? _currentGrabbedObj; private PhysGrabCart? _heldCart; private readonly List<Vector3> _grabbedLocalPoints = new List<Vector3>(64); private readonly LidarPoint[] _grabbedWorldUpload = new LidarPoint[64]; private readonly LidarPoint[] _emptyGrabbedUpload = new LidarPoint[64]; private float _reapplyTimer; private int _reapplyStepsLeft; private readonly List<MeshRenderer> _hiddenCarpetRenderers = new List<MeshRenderer>(); private static readonly FieldInfo? ExtractionStateField = AccessTools.Field(typeof(ExtractionPoint), "currentState"); private static readonly FieldInfo? CartHaulField = FindCartHaulField(); private static readonly FieldInfo? CartInCartField = FindCartInCartField(); private readonly List<ExtractionVisualCache> _extractionCaches = new List<ExtractionVisualCache>(); private float _worldCacheTimer; public static LidarController? Instance { get; private set; } private static FieldInfo? FindCartHaulField() { string[] array = new string[4] { "haulCurrent", "haul", "currentHaul", "haulPrevious" }; foreach (string text in array) { FieldInfo fieldInfo = AccessTools.Field(typeof(PhysGrabCart), text); if (fieldInfo != null && (fieldInfo.FieldType == typeof(int) || fieldInfo.FieldType == typeof(float))) { return fieldInfo; } } FieldInfo[] fields = typeof(PhysGrabCart).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo2 in fields) { if ((fieldInfo2.FieldType == typeof(int) || fieldInfo2.FieldType == typeof(float)) && fieldInfo2.Name.IndexOf("haul", StringComparison.OrdinalIgnoreCase) >= 0) { return fieldInfo2; } } return null; } private static FieldInfo? FindCartInCartField() { FieldInfo[] fields = typeof(PhysGrabCart).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.Name.IndexOf("inCart", StringComparison.OrdinalIgnoreCase) >= 0 || fieldInfo.FieldType.Name.IndexOf("InCart", StringComparison.OrdinalIgnoreCase) >= 0) { return fieldInfo; } } return null; } private void Awake() { Instance = this; } private void OnEnable() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDisable() { PhotonNetwork.RemoveCallbackTarget((object)this); } private void Start() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0097: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) _energy = Upgrades.MaxEnergy; _pointsBuffer = new ComputeBuffer(150000, Marshal.SizeOf<LidarPoint>()); _pointsBuffer.SetData((Array)new LidarPoint[150000]); _pointsMaterial = new Material(Plugin.PointsShader); _pointsMaterial.SetBuffer("_PointsBuffer", _pointsBuffer); _pointsMaterial.SetFloat("_PointSize", LidarConfig.PointSize.Value); _cmd = new CommandBuffer { name = "LIDARRender" }; _cmd.DrawProcedural(Matrix4x4.identity, _pointsMaterial, 0, (MeshTopology)0, 6, 150000); _overlayCmd = new CommandBuffer { name = "LIDAROverlay" }; InitHighlightMaterial(); _uiPixel = new Texture2D(1, 1); _uiPixel.SetPixel(0, 0, Color.white); _uiPixel.Apply(); InitAudio(); InitGrabberReflection(); InitScanLayerMask(); } private void InitHighlightMaterial() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown Shader val = Shader.Find("Hidden/Internal-Colored") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color"); if (!((Object)(object)val == (Object)null)) { _buttonHighlightMat = new Material(val) { hideFlags = (HideFlags)61 }; if (_buttonHighlightMat.HasProperty("_SrcBlend")) { _buttonHighlightMat.SetInt("_SrcBlend", 5); } if (_buttonHighlightMat.HasProperty("_DstBlend")) { _buttonHighlightMat.SetInt("_DstBlend", 10); } if (_buttonHighlightMat.HasProperty("_Cull")) { _buttonHighlightMat.SetInt("_Cull", 0); } if (_buttonHighlightMat.HasProperty("_ZWrite")) { _buttonHighlightMat.SetInt("_ZWrite", 0); } if (_buttonHighlightMat.HasProperty("_ZTest")) { _buttonHighlightMat.SetInt("_ZTest", 4); } } } public void ApplyUpgradeLevel(string upgradeId, int level) { int num = Mathf.Max(0, level); switch (upgradeId) { case "LIDAR Range": Upgrades.RangeLevel = num; break; case "LIDAR Stamina": Upgrades.StaminaLevel = num; if (num > 0) { _energy = Mathf.Min(_energy + 25f, Upgrades.MaxEnergy); } break; case "LIDAR Color": Upgrades.ColorModule = num > 0; break; case "LIDAR Duration": Upgrades.LifetimeLevel = num; break; case "LIDAR Wide Beam": Upgrades.BeamWidthLevel = num; break; } _energy = Mathf.Clamp(_energy, 0f, Upgrades.MaxEnergy); } private void InitScanLayerMask() { int num = -1; _hingeLayer = LayerMask.NameToLayer("PhysGrabObjectHinge"); for (int i = 0; i < 32; i++) { string text = LayerMask.LayerToName(i); if (string.IsNullOrEmpty(text)) { continue; } string text2 = text.ToLowerInvariant(); switch (text2) { default: if (!text2.Contains("only") && !text2.Contains("trigger") && !text2.Contains("volume") && !text2.Contains("minimap") && !text2.Contains("navmesh") && !text2.Contains("camera") && !text2.Contains("postprocess") && !text2.Contains("vision") && !text2.Contains("occlud") && !text2.Contains("audio") && !text2.Contains("blocker") && !text2.Contains("barrier") && !text2.Contains("invisible") && !text2.Contains("nocoll") && !text2.Contains("localplayer")) { continue; } break; case "ignore raycast": case "ui": case "water": case "transparentfx": case "map": case "nav": case "pit": case "light": case "lights": case "dirtfindermap": case "collisioncheck": case "physgrabavoider": case "lightseparate": case "playervisualslocal": case "mirrorreflection": break; } num &= ~(1 << i); } _scanLayerMask = num; } private void InitAudio() { _audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); _audioSource.spatialBlend = 0f; _audioSource.playOnAwake = false; _tickClip = CreateTickClip(); _burstClip = CreateBurstClip(); _overheatClip = CreateOverheatClip(); } private void InitGrabberReflection() { Type typeFromHandle = typeof(PhysGrabber); _grabbedBoolField = AccessTools.Field(typeFromHandle, "grabbed"); _grabbedObjField = AccessTools.Field(typeFromHandle, "grabbedPhysGrabObject") ?? AccessTools.Field(typeFromHandle, "grabbedObject"); _grabPointTransformField = AccessTools.Field(typeFromHandle, "physGrabPoint"); _localGrabPosField = AccessTools.Field(typeFromHandle, "localGrabPosition"); if (!(_grabbedObjField == null)) { return; } FieldInfo[] fields = typeFromHandle.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(PhysGrabObject)) { _grabbedObjField = fieldInfo; break; } } } private void Update() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) LidarShopUpgrades.TryRegisterFromStatsManager(); EnsureCameraAttached(); if ((Object)(object)_attachedCam == (Object)null) { return; } UpdateLevelState(); _pointsMaterial.SetFloat("_CurrentTime", Time.time); _pointsMaterial.SetFloat("_PointLifetime", Upgrades.PointLifetime); _pointsMaterial.SetFloat("_FadeDuration", Upgrades.FadeDuration); _pointsMaterial.SetFloat("_PointSize", LidarConfig.PointSize.Value); if (UnityInput.Current.GetKeyDown(LidarConfig.ClearPointsKey.Value)) { ClearPoints(); } if (_blackoutEnabled) { UpdateTimersAndScanning(); UpdateGrabbedObjectAndCart(); UpdateHudVisibility(); _worldCacheTimer -= Time.deltaTime; if (_worldCacheTimer <= 0f) { RefreshExtractionButtonCache(); _worldCacheTimer = 1.5f; } } else { _isActivelyScanning = false; _hudAlpha = 0f; _heldCart = null; ClearGrabbedPoints(); _overlayCmd.Clear(); } } private void LateUpdate() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) EnsureCameraAttached(); if (!_blackoutEnabled || (Object)(object)_attachedCam == (Object)null) { return; } if ((int)_attachedCam.renderingPath != 1 || (int)_attachedCam.clearFlags != 2 || _attachedCam.backgroundColor != Color.black || RenderSettings.fog) { ReapplyBlackoutClean(); } if (_reapplyStepsLeft > 0) { _reapplyTimer -= Time.deltaTime; if (_reapplyTimer <= 0f) { ReapplyBlackoutClean(); HideColliderlessCarpets(); RefreshExtractionButtonCache(); _reapplyStepsLeft--; _reapplyTimer = 1f; } } RebuildOverlayCommandBuffer(); } private void RefreshExtractionButtonCache() { //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) _extractionCaches.Clear(); ExtractionPoint[] array = Object.FindObjectsByType<ExtractionPoint>((FindObjectsSortMode)0); foreach (ExtractionPoint val in array) { if ((Object)(object)val == (Object)null) { continue; } ExtractionVisualCache extractionVisualCache = new ExtractionVisualCache { Point = val }; FieldInfo[] fields = typeof(ExtractionPoint).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MeshRenderer[] componentsInChildren; foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.Name.IndexOf("button", StringComparison.OrdinalIgnoreCase) < 0) { continue; } object value = fieldInfo.GetValue(val); object obj = ((value is Transform) ? value : null); if (obj == null) { object obj2 = ((value is GameObject) ? value : null); obj = ((obj2 != null) ? ((GameObject)obj2).transform : null); if (obj == null) { object obj3 = ((value is Component) ? value : null); obj = ((obj3 != null) ? ((Component)obj3).transform : null); } } Transform val2 = (Transform)obj; if ((Object)(object)val2 == (Object)null) { continue; } ExtractionVisualCache extractionVisualCache2 = extractionVisualCache; if (extractionVisualCache2.ButtonAnchor == null) { extractionVisualCache2.ButtonAnchor = val2; } componentsInChildren = ((Component)val2).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val3 in componentsInChildren) { if ((Object)(object)val3 != (Object)null && !IsScreenMesh(val3, ((Component)val).transform) && !extractionVisualCache.ButtonRenderers.Contains(val3)) { extractionVisualCache.ButtonRenderers.Add(val3); } } } componentsInChildren = ((Component)val).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val4 in componentsInChildren) { if ((Object)(object)val4 == (Object)null || IsScreenMesh(val4, ((Component)val).transform) || !HasAnyKeywordUp(((Component)val4).transform, ((Component)val).transform, "button", "press", "switch", "activate")) { continue; } Bounds bounds = ((Renderer)val4).bounds; Vector3 size = ((Bounds)(ref bounds)).size; if (((Vector3)(ref size)).magnitude < 1.5f) { if (!extractionVisualCache.ButtonRenderers.Contains(val4)) { extractionVisualCache.ButtonRenderers.Add(val4); } ExtractionVisualCache extractionVisualCache2 = extractionVisualCache; if (extractionVisualCache2.ButtonAnchor == null) { extractionVisualCache2.ButtonAnchor = ((Component)val4).transform; } } } _extractionCaches.Add(extractionVisualCache); } } private static bool IsScreenMesh(MeshRenderer mr, Transform stopAt) { return HasAnyKeywordUp(((Component)mr).transform, stopAt, "screen", "display", "text", "led", "monitor", "canvas"); } private static bool HasAnyKeywordUp(Transform t, Transform stopAt, params string[] keywords) { Transform val = t; for (int i = 0; i < 3; i++) { if (!((Object)(object)val != (Object)null)) { break; } if (!((Object)(object)val != (Object)(object)stopAt)) { break; } string name = ((Object)val).name; for (int j = 0; j < keywords.Length; j++) { if (name.IndexOf(keywords[j], StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } val = val.parent; } return false; } private static string GetExtractionStateName(ExtractionPoint ep) { if (ExtractionStateField == null) { return ""; } return ExtractionStateField.GetValue(ep)?.ToString() ?? ""; } private void RebuildOverlayCommandBuffer() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) _overlayCmd.Clear(); if (!LidarConfig.HighlightExtractionButton.Value || (Object)(object)_buttonHighlightMat == (Object)null) { return; } float num = 0.62f + 0.33f * Mathf.Abs(Mathf.Sin(Time.time * 3.6f)); _buttonHighlightMat.color = new Color(1f, 0.56f, 0.1f, num); for (int i = 0; i < _extractionCaches.Count; i++) { ExtractionVisualCache extractionVisualCache = _extractionCaches[i]; if ((Object)(object)extractionVisualCache.Point == (Object)null || !((Component)extractionVisualCache.Point).gameObject.activeInHierarchy || GetExtractionStateName(extractionVisualCache.Point).IndexOf("Idle", StringComparison.OrdinalIgnoreCase) < 0) { continue; } for (int j = 0; j < extractionVisualCache.ButtonRenderers.Count; j++) { MeshRenderer val = extractionVisualCache.ButtonRenderers[j]; if (!((Object)(object)val == (Object)null) && ((Renderer)val).enabled && ((Component)val).gameObject.activeInHierarchy) { _overlayCmd.DrawRenderer((Renderer)(object)val, _buttonHighlightMat); } } } } private bool HasLineOfSight(Vector3 camPos, Vector3 targetPos, Transform allowedRoot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = targetPos - camPos; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.25f) { return true; } RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(camPos, val / magnitude, ref val2, magnitude - 0.14f, _scanLayerMask, (QueryTriggerInteraction)1)) { return true; } Transform transform = ((Component)((RaycastHit)(ref val2)).collider).transform; if (!((Object)(object)transform == (Object)(object)allowedRoot)) { return transform.IsChildOf(allowedRoot); } return true; } private static string? GetCartHaulText(PhysGrabCart cart) { if (CartHaulField != null) { object value = CartHaulField.GetValue(cart); if (value != null) { int num = Mathf.Max(0, Convert.ToInt32(value)); return $"${num:N0}"; } } if (CartInCartField != null) { object value2 = CartInCartField.GetValue(cart); if (value2 != null) { FieldInfo fieldInfo = AccessTools.Field(value2.GetType(), "haulCurrent") ?? AccessTools.Field(value2.GetType(), "haul"); if (fieldInfo != null) { object value3 = fieldInfo.GetValue(value2); if (value3 != null) { int num2 = Mathf.Max(0, Convert.ToInt32(value3)); return $"${num2:N0}"; } } } } Component[] componentsInChildren = ((Component)cart).GetComponentsInChildren<Component>(true); foreach (Component val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && ((object)val).GetType().Name.IndexOf("TextMeshPro", StringComparison.OrdinalIgnoreCase) >= 0 && ((object)val).GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Public)?.GetValue(val) is string text && !string.IsNullOrWhiteSpace(text)) { return text.Trim(); } } return null; } private void UpdateHudVisibility() { int num; float num2; if (!_isActivelyScanning && !_overheated && !(_burstCooldownTimer > 0.01f)) { num = ((_energy < Upgrades.MaxEnergy - 0.5f) ? 1 : 0); if (num == 0) { num2 = 0f; goto IL_0048; } } else { num = 1; } num2 = 1f; goto IL_0048; IL_0048: float num3 = num2; float num4 = ((num != 0) ? 12f : 3.5f); _hudAlpha = Mathf.MoveTowards(_hudAlpha, num3, Time.deltaTime * num4); } private void UpdateLevelState() { bool flag = (Object)(object)RunManager.instance != (Object)null && SemiFunc.RunIsLevel(); if (flag != _wasInLevel) { _wasInLevel = flag; ClearPoints(); _energy = Upgrades.MaxEnergy; _overheated = false; _burstCooldownTimer = 0f; _netPendingConeRays = 0; _hudAlpha = 0f; _heldCart = null; if (flag) { _reapplyStepsLeft = 3; _reapplyTimer = 0.35f; _worldCacheTimer = 0.25f; } else { _reapplyStepsLeft = 0; _extractionCaches.Clear(); _overlayCmd.Clear(); RestoreHiddenCarpets(); } } if (flag != _blackoutEnabled) { ToggleBlackout(flag); } } private void ReapplyBlackoutClean() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_attachedCam == (Object)null)) { _attachedCam.ResetReplacementShader(); _attachedCam.renderingPath = (RenderingPath)1; _attachedCam.clearFlags = (CameraClearFlags)2; _attachedCam.backgroundColor = Color.black; _attachedCam.SetReplacementShader(Plugin.BlackoutShader, "RenderType"); RenderSettings.fog = false; } } private void UpdateTimersAndScanning() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) float deltaTime = Time.deltaTime; if (_burstCooldownTimer > 0f) { _burstCooldownTimer = Mathf.Max(0f, _burstCooldownTimer - deltaTime); } if (_tickSoundTimer > 0f) { _tickSoundTimer -= deltaTime; } bool flag = false; _isActivelyScanning = false; Transform transform = ((Component)_attachedCam).transform; KeyCode value = LidarConfig.StreamKey.Value; KeyCode value2 = LidarConfig.BurstKey.Value; if (!_overheated && UnityInput.Current.GetKey(value) && _energy > 0.5f) { flag = true; _isActivelyScanning = true; ConsumeEnergy(LidarConfig.StreamEnergyCost.Value * deltaTime); if (UnityInput.Current.GetKeyDown(value)) { _scanAccumulator = 6f; } if (_tickSoundTimer <= 0f) { PlaySound(_tickClip, 0.32f, Random.Range(0.92f, 1.12f)); _tickSoundTimer = 0.055f; } _scanAccumulator += Upgrades.StreamRaysPerSecond * deltaTime; int num = Mathf.FloorToInt(_scanAccumulator); if (num > 0) { _scanAccumulator -= num; int num2 = Mathf.Min(num, 64); int seed = _seedGen.Next(1, 1000000); ExecuteConeScan(transform.position, transform.rotation, Upgrades.SpreadAngle, num2, Upgrades.MaxDistance, seed); _netPendingConeRays += num2; } _netSyncTimer += deltaTime; if (_netSyncTimer >= 0.12f && _netPendingConeRays > 0) { SendNetworkScan(transform.position, transform.rotation, Upgrades.SpreadAngle, _netPendingConeRays, Upgrades.MaxDistance, isBurst: false); _netPendingConeRays = 0; _netSyncTimer = 0f; } } else { if (_netPendingConeRays > 0) { SendNetworkScan(transform.position, transform.rotation, Upgrades.SpreadAngle, _netPendingConeRays, Upgrades.MaxDistance, isBurst: false); _netPendingConeRays = 0; } _netSyncTimer = 0f; _scanAccumulator = 0f; } float value3 = LidarConfig.BurstEnergyCost.Value; if (!_overheated && _burstCooldownTimer <= 0f && UnityInput.Current.GetKeyDown(value2) && _energy >= value3) { flag = true; _isActivelyScanning = true; ConsumeEnergy(value3); _burstCooldownTimer = Upgrades.BurstCooldown; PlaySound(_burstClip, 0.85f, 1f); int num3 = _seedGen.Next(1, 1000000); ExecuteBurstScan(transform.position, Upgrades.BurstRayCount, Upgrades.MaxDistance, num3); SendNetworkScan(transform.position, Quaternion.identity, 0f, Upgrades.BurstRayCount, Upgrades.MaxDistance, isBurst: true, num3); } if (flag) { return; } if (_rechargeDelayTimer > 0f) { _rechargeDelayTimer -= deltaTime; return; } _energy = Mathf.Min(Upgrades.MaxEnergy, _energy + Upgrades.RechargeRate * deltaTime); if (_overheated && _energy >= Upgrades.MaxEnergy * 0.25f) { _overheated = false; } } private void UpdateGrabbedObjectAndCart() { //IL_0084: 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_00b6: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) PhysGrabObject currentlyGrabbedObject = GetCurrentlyGrabbedObject(); _heldCart = (((Object)(object)currentlyGrabbedObject != (Object)null) ? (((Component)currentlyGrabbedObject).GetComponent<PhysGrabCart>() ?? ((Component)currentlyGrabbedObject).GetComponentInParent<PhysGrabCart>() ?? ((Component)currentlyGrabbedObject).GetComponentInChildren<PhysGrabCart>()) : null); if (!LidarConfig.GrabbedObjectPoints.Value || (Object)(object)currentlyGrabbedObject == (Object)null) { ClearGrabbedPoints(); return; } if ((Object)(object)currentlyGrabbedObject != (Object)(object)_currentGrabbedObj) { _currentGrabbedObj = currentlyGrabbedObject; SampleLocalPointsOnObject(currentlyGrabbedObject); } int count = _grabbedLocalPoints.Count; if (count == 0) { return; } Transform transform = ((Component)currentlyGrabbedObject).transform; Color heldObjectColor = GetHeldObjectColor(currentlyGrabbedObject); float time = Time.time; for (int i = 0; i < 64; i++) { if (i < count) { _grabbedWorldUpload[i] = new LidarPoint { Position = transform.TransformPoint(_grabbedLocalPoints[i]), SpawnTime = time, Color = heldObjectColor }; } else { _grabbedWorldUpload[i] = default(LidarPoint); } } _pointsBuffer.SetData((Array)_grabbedWorldUpload, 0, 149936, 64); } private PhysGrabObject? GetCurrentlyGrabbedObject() { PhysGrabber instance = PhysGrabber.instance; if ((Object)(object)instance == (Object)null || _grabbedObjField == null) { return null; } if (_grabbedBoolField != null) { object value = _grabbedBoolField.GetValue(instance); if (value is bool && !(bool)value) { return null; } } object? value2 = _grabbedObjField.GetValue(instance); return (PhysGrabObject?)((value2 is PhysGrabObject) ? value2 : null); } private Vector3 GetGrabWorldPoint(PhysGrabObject obj, Collider[] colliders) { //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0073: Unknown result type (might be due to invalid IL or missing references) PhysGrabber instance = PhysGrabber.instance; if ((Object)(object)instance != (Object)null) { object? obj2 = _grabPointTransformField?.GetValue(instance); Transform val = (Transform)((obj2 is Transform) ? obj2 : null); if (val != null && (Object)(object)val != (Object)null) { return val.position; } if (_localGrabPosField?.GetValue(instance) is Vector3 val2 && ((Vector3)(ref val2)).sqrMagnitude > 0.0001f) { return ((Component)obj).transform.TransformPoint(val2); } } if ((Object)(object)_attachedCam != (Object)null) { Ray val3 = default(Ray); ((Ray)(ref val3))..ctor(((Component)_attachedCam).transform.position, ((Component)_attachedCam).transform.forward); float num = float.MaxValue; Vector3 result = ((Component)obj).transform.position; bool flag = false; RaycastHit val5 = default(RaycastHit); foreach (Collider val4 in colliders) { if (val4.enabled && !val4.isTrigger && val4.Raycast(val3, ref val5, 8f) && ((RaycastHit)(ref val5)).distance < num) { num = ((RaycastHit)(ref val5)).distance; result = ((RaycastHit)(ref val5)).point; flag = true; } } if (flag) { return result; } } return ((Component)obj).transform.position; } private void SampleLocalPointsOnObject(PhysGrabObject obj) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) _grabbedLocalPoints.Clear(); int num = Mathf.Clamp(LidarConfig.GrabbedPointCount.Value, 8, 64); float value = LidarConfig.GrabbedPointRadius.Value; Collider[] componentsInChildren = ((Component)obj).GetComponentsInChildren<Collider>(); if (componentsInChildren.Length == 0) { return; } Vector3 grabWorldPoint = GetGrabWorldPoint(obj, componentsInChildren); Transform transform = ((Component)obj).transform; float num2 = (IsMovableDoor(transform, obj, ((Component)obj).GetComponent<Rigidbody>()) ? 0.075f : 0.028f); Vector3 val; Vector3 val2; if (!((Object)(object)_attachedCam != (Object)null)) { val = Vector3.up; } else { val2 = ((Component)_attachedCam).transform.position - grabWorldPoint; val = ((Vector3)(ref val2)).normalized; } Vector3 val3 = val; int num3 = num * 5; Ray val7 = default(Ray); RaycastHit val11 = default(RaycastHit); for (int i = 0; i < num3; i++) { if (_grabbedLocalPoints.Count >= num) { break; } val2 = val3 * 0.65f + Random.onUnitSphere; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val4 = Random.insideUnitSphere * value; Vector3 val5 = grabWorldPoint + val4; Vector3 val6 = val5 + normalized * (value * 1.6f); val2 = val5 - val6; ((Ray)(ref val7))..ctor(val6, ((Vector3)(ref val2)).normalized); float num4 = float.MaxValue; Vector3 val8 = Vector3.zero; Vector3 val9 = val3; bool flag = false; Collider[] array = componentsInChildren; foreach (Collider val10 in array) { if (val10.enabled && !val10.isTrigger && val10.Raycast(val7, ref val11, value * 3.5f) && ((RaycastHit)(ref val11)).distance < num4) { num4 = ((RaycastHit)(ref val11)).distance; val8 = ((RaycastHit)(ref val11)).point; val9 = ((RaycastHit)(ref val11)).normal; flag = true; } } if (flag && Vector3.Distance(val8, grabWorldPoint) <= value * 1.15f) { _grabbedLocalPoints.Add(transform.InverseTransformPoint(val8 + val9 * num2)); } } int num5 = 0; while (_grabbedLocalPoints.Count < num && num5++ < num * 3) { Vector3 val12 = grabWorldPoint + Random.insideUnitSphere * value; float num6 = float.MaxValue; Vector3 val13 = Vector3.zero; bool flag2 = false; Collider[] array = componentsInChildren; foreach (Collider val14 in array) { if (!val14.enabled || val14.isTrigger) { continue; } MeshCollider val15 = (MeshCollider)(object)((val14 is MeshCollider) ? val14 : null); if (val15 == null || val15.convex) { Vector3 val16 = val14.ClosestPoint(val12); float num7 = Vector3.Distance(val16, grabWorldPoint); if (num7 <= value * 1.15f && num7 < num6) { num6 = num7; val13 = val16; flag2 = true; } } } if (flag2) { _grabbedLocalPoints.Add(transform.InverseTransformPoint(val13 + val3 * num2)); } } } private Color GetHeldObjectColor(PhysGrabObject obj) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!Upgrades.ColorModule) { return LidarConfig.BaseMonoColor.Value; } if ((Object)(object)((Component)obj).GetComponentInParent<ValuableObject>() != (Object)null) { return LidarConfig.ValuableColor.Value; } return LidarConfig.InteractiveColor.Value; } private void ClearGrabbedPoints() { if (!((Object)(object)_currentGrabbedObj == (Object)null)) { _currentGrabbedObj = null; _grabbedLocalPoints.Clear(); if (_pointsBuffer != null) { _pointsBuffer.SetData((Array)_emptyGrabbedUpload, 0, 149936, 64); } } } private void HideColliderlessCarpets() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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) if (!LidarConfig.HideColliderlessCarpets.Value) { return; } MeshRenderer[] array = Object.FindObjectsByType<MeshRenderer>((FindObjectsSortMode)0); foreach (MeshRenderer val in array) { if ((Object)(object)val == (Object)null || !((Renderer)val).enabled || (Object)(object)((Component)val).GetComponent<Collider>() != (Object)null) { continue; } Transform transform = ((Component)val).transform; if (!((Object)(object)((Component)transform).GetComponentInParent<ValuableObject>() != (Object)null) && !((Object)(object)((Component)transform).GetComponentInParent<PhysGrabObject>() != (Object)null) && !((Object)(object)((Component)transform).GetComponentInParent<EnemyParent>() != (Object)null) && !((Object)(object)((Component)transform).GetComponentInParent<PlayerAvatar>() != (Object)null) && !((Object)(object)((Component)transform).GetComponentInParent<ExtractionPoint>() != (Object)null)) { Bounds bounds = ((Renderer)val).bounds; Vector3 size = ((Bounds)(ref bounds)).size; string text = ((Object)((Component)val).gameObject).name.ToLowerInvariant(); bool num = (text.Contains("rug") || text.Contains("carpet") || text.Contains("mat")) && size.y < 0.15f; bool flag = size.y < 0.045f && size.x > 0.35f && size.z > 0.35f && ((Object)(object)transform.parent == (Object)null || (Object)(object)((Component)transform.parent).GetComponent<Collider>() == (Object)null); if (num || flag) { ((Renderer)val).enabled = false; _hiddenCarpetRenderers.Add(val); } } } } private void RestoreHiddenCarpets() { for (int i = 0; i < _hiddenCarpetRenderers.Count; i++) { if ((Object)(object)_hiddenCarpetRenderers[i] != (Object)null) { ((Renderer)_hiddenCarpetRenderers[i]).enabled = true; } } _hiddenCarpetRenderers.Clear(); } private void SendNetworkScan(Vector3 origin, Quaternion rotation, float spreadAngle, int rayCount, float maxDist, bool isBurst, int explicitSeed = -1) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0094: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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) if (PhotonNetwork.InRoom) { int num = ((explicitSeed > 0) ? explicitSeed : _seedGen.Next(1, 1000000)); float[] array = new float[12] { origin.x, origin.y, origin.z, rotation.x, rotation.y, rotation.z, rotation.w, spreadAngle, rayCount, maxDist, num, isBurst ? 1f : 0f }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; SendOptions val2 = (isBurst ? SendOptions.SendReliable : SendOptions.SendUnreliable); PhotonNetwork.RaiseEvent((byte)173, (object)array, val, val2); } } public void OnEvent(EventData photonEvent) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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 (photonEvent.Code == 173 && _blackoutEnabled && photonEvent.CustomData is float[] array && array.Length >= 12) { Vector3 origin = default(Vector3); ((Vector3)(ref origin))..ctor(array[0], array[1], array[2]); Quaternion rotation = default(Quaternion); ((Quaternion)(ref rotation))..ctor(array[3], array[4], array[5], array[6]); float spreadAngle = array[7]; int rayCount = Mathf.Clamp(Mathf.RoundToInt(array[8]), 1, 650); float maxDist = Mathf.Clamp(array[9], 2f, 45f); int seed = Mathf.RoundToInt(array[10]); if (array[11] > 0.5f) { ExecuteBurstScan(origin, rayCount, maxDist, seed); } else { ExecuteConeScan(origin, rotation, spreadAngle, rayCount, maxDist, seed); } } } private void ExecuteConeScan(Vector3 origin, Quaternion rotation, float spreadAngle, int rayCount, float maxDist, int seed) { //IL_0056: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(seed); _frameBatch.Clear(); for (int i = 0; i < rayCount; i++) { float num = (float)(random.NextDouble() * Math.PI * 2.0); float num2 = Mathf.Sqrt((float)random.NextDouble()) * spreadAngle; float num3 = Mathf.Cos(num) * num2; float num4 = Mathf.Sin(num) * num2; Vector3 direction = rotation * Quaternion.Euler(num4, num3, 0f) * Vector3.forward; CastAndCollect(origin, direction, maxDist); } UploadBatch(); } private void ExecuteBurstScan(Vector3 origin, int rayCount, float maxDist, int seed) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(seed); _frameBatch.Clear(); Vector3 direction = default(Vector3); for (int i = 0; i < rayCount; i++) { float num = (float)random.NextDouble(); float num2 = (float)random.NextDouble(); float num3 = num * 2f * MathF.PI; float num4 = Mathf.Acos(2f * num2 - 1f); ((Vector3)(ref direction))..ctor(Mathf.Sin(num4) * Mathf.Cos(num3), Mathf.Sin(num4) * Mathf.Sin(num3), Mathf.Cos(num4)); CastAndCollect(origin, direction, maxDist); } UploadBatch(); } private void CastAndCollect(Vector3 origin, Vector3 direction, float maxDist) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) RaycastHit hit = default(RaycastHit); if (!Physics.Raycast(origin + direction * 0.35f, direction, ref hit, maxDist, _scanLayerMask, (QueryTriggerInteraction)1)) { return; } Transform transform = ((Component)((RaycastHit)(ref hit)).collider).transform; PhysGrabObject val = ((Component)transform).GetComponentInParent<PhysGrabObject>() ?? (((Object)(object)((RaycastHit)(ref hit)).rigidbody != (Object)null) ? ((Component)((RaycastHit)(ref hit)).rigidbody).GetComponent<PhysGrabObject>() : null); int num; if (_hingeLayer >= 0) { num = ((((Component)((RaycastHit)(ref hit)).collider).gameObject.layer == _hingeLayer) ? 1 : 0); if (num != 0) { goto IL_00cd; } } else { num = 0; } if (((Object)(object)((RaycastHit)(ref hit)).rigidbody != (Object)null && (Object)(object)((Component)((RaycastHit)(ref hit)).rigidbody).GetComponent<Joint>() != (Object)null) || (Object)(object)((Component)transform).GetComponentInParent<Joint>() != (Object)null) { goto IL_00cd; } int num2 = (((Object)(object)val != (Object)null && (Object)(object)((Component)val).GetComponentInChildren<Joint>() != (Object)null) ? 1 : 0); goto IL_00ce; IL_00ce: bool flag = (byte)num2 != 0; bool flag2 = (Object)(object)val != (Object)null || flag; float num3 = ((num != 0 || (flag2 && IsMovableDoor(transform, val, ((RaycastHit)(ref hit)).rigidbody))) ? 0.075f : (flag2 ? 0.028f : 0.008f)); Color pointColor = GetPointColor(hit, transform, flag2, maxDist); _frameBatch.Add(new LidarPoint { Position = ((RaycastHit)(ref hit)).point + ((RaycastHit)(ref hit)).normal * num3, SpawnTime = Time.time, Color = pointColor }); return; IL_00cd: num2 = 1; goto IL_00ce; } private static bool IsMovableDoor(Transform t, PhysGrabObject? grabObj, Rigidbody? rb) { if (((Object)(object)rb != (Object)null && (Object)(object)((Component)rb).GetComponent<Joint>() != (Object)null) || (Object)(object)((Component)t).GetComponentInParent<Joint>() != (Object)null || ((Object)(object)grabObj != (Object)null && (Object)(object)((Component)grabObj).GetComponentInChildren<Joint>() != (Object)null)) { return true; } if ((Object)(object)grabObj != (Object)null) { if (!HasDoorKeyword(((Object)((Component)grabObj).gameObject).name)) { return HasDoorKeyword(((Object)t).name); } return true; } return false; } private static bool HasDoorKeyword(string name) { if (name.IndexOf("door", StringComparison.OrdinalIgnoreCase) < 0 && name.IndexOf("hatch", StringComparison.OrdinalIgnoreCase) < 0 && name.IndexOf("gate", StringComparison.OrdinalIgnoreCase) < 0) { return name.IndexOf("hinge", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private Color GetPointColor(RaycastHit hit, Transform t, bool isInteractive, float maxDist) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(((RaycastHit)(ref hit)).distance / maxDist); if (!Upgrades.ColorModule) { Color value = LidarConfig.BaseMonoColor.Value; float num2 = Mathf.Lerp(1f, 0.42f, num); return new Color(value.r * num2, value.g * num2, value.b * num2, value.a); } if ((Object)(object)((Component)t).GetComponentInParent<EnemyParent>() != (Object)null || (Object)(object)((Component)t).GetComponentInParent<Enemy>() != (Object)null) { return LidarConfig.EnemyColor.Value; } if ((Object)(object)((Component)t).GetComponentInParent<PlayerAvatar>() != (Object)null) { return LidarConfig.TeammateColor.Value; } if ((Object)(object)((Component)t).GetComponentInParent<ValuableObject>() != (Object)null) { return LidarConfig.ValuableColor.Value; } if (isInteractive) { return LidarConfig.InteractiveColor.Value; } return Color.Lerp(LidarConfig.WallNearColor.Value, LidarConfig.WallFarColor.Value, num); } private void ConsumeEnergy(float amount) { _energy = Mathf.Max(0f, _energy - amount); _rechargeDelayTimer = Upgrades.RechargeDelay; if (_energy <= 0.01f && !_overheated) { _overheated = true; _rechargeDelayTimer = Upgrades.RechargeDelay * 1.8f; PlaySound(_overheatClip, 0.65f, 1f); } } private void EnsureCameraAttached() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)(object)_attachedCam) { return; } bool blackoutEnabled = _blackoutEnabled; if ((Object)(object)_attachedCam != (Object)null) { ToggleBlackout(enable: false); _attachedCam.RemoveCommandBuffer((CameraEvent)12, _cmd); _attachedCam.RemoveCommandBuffer((CameraEvent)17, _overlayCmd); } _attachedCam = main; if ((Object)(object)_attachedCam != (Object)null) { _origClearFlags = _attachedCam.clearFlags; _origBgColor = _attachedCam.backgroundColor; _origRenderingPath = _attachedCam.renderingPath; _attachedCam.AddCommandBuffer((CameraEvent)12, _cmd); _attachedCam.AddCommandBuffer((CameraEvent)17, _overlayCmd); if (blackoutEnabled) { ToggleBlackout(enable: true); } } } private void ToggleBlackout(bool enable) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_attachedCam == (Object)null) { return; } if (enable) { if (!_blackoutEnabled) { _origFogEnabled = RenderSettings.fog; } _blackoutEnabled = true; ReapplyBlackoutClean(); HideColliderlessCarpets(); RefreshExtractionButtonCache(); } else { _blackoutEnabled = false; _attachedCam.ResetReplacementShader(); _attachedCam.renderingPath = _origRenderingPath; _attachedCam.clearFlags = _origClearFlags; _attachedCam.backgroundColor = _origBgColor; RenderSettings.fog = _origFogEnabled; _overlayCmd.Clear(); RestoreHiddenCarpets(); } } private void UploadBatch() { int count = _frameBatch.Count; if (count != 0) { int num = Mathf.Min(count, 149936 - _writeIndex); _pointsBuffer.SetData<LidarPoint>(_frameBatch, 0, _writeIndex, num); int num2 = count - num; if (num2 > 0) { _pointsBuffer.SetData<LidarPoint>(_frameBatch, num, 0, num2); _writeIndex = num2; } else { _writeIndex = (_writeIndex + num) % 149936; } } } private void ClearPoints() { if (_pointsBuffer != null) { _pointsBuffer.SetData((Array)new LidarPoint[150000]); _writeIndex = 0; _currentGrabbedObj = null; _grabbedLocalPoints.Clear(); } } private void OnGUI() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_attachedCam == (Object)null || !_blackoutEnabled) { return; } DrawExtractionButtonMarkers(); float num = 190f; float num2 = 10f; float num3 = 2f; float num4 = ((float)Screen.width - num) * 0.5f; float num5 = (float)Screen.height - LidarConfig.HudOffsetY.Value; if (LidarConfig.ShowCartHaulDisplay.Value && (Object)(object)_heldCart != (Object)null) { string cartHaulText = GetCartHaulText(_heldCart); if (!string.IsNullOrEmpty(cartHaulText)) { DrawCartPriceAboveBar(num4, num5, num, cartHaulText); } } if (!(_hudAlpha <= 0.01f)) { float num6 = Mathf.Clamp01(_energy / Upgrades.MaxEnergy); GUI.color = new Color(0.04f, 0.04f, 0.04f, 0.65f * _hudAlpha); GUI.DrawTexture(new Rect(num4, num5, num, num2), (Texture)(object)_uiPixel); Color value = LidarConfig.StaminaBarColor.Value; float num7 = (_overheated ? (0.45f + 0.55f * Mathf.Abs(Mathf.Sin(Time.time * 10f))) : 1f); GUI.color = new Color(value.r, value.g * (_overheated ? 0.45f : 1f), value.b * (_overheated ? 0.3f : 1f), value.a * _hudAlpha * num7); GUI.DrawTexture(new Rect(num4 + 1f, num5 + 1f, Mathf.Max(0f, (num - 2f) * num6), num2 - 2f), (Texture)(object)_uiPixel); GUI.color = new Color(value.r, value.g, value.b, 0.85f * _hudAlpha); GUI.DrawTexture(new Rect(num4 - num3, num5 - num3, num + num3 * 2f, num3), (Texture)(object)_uiPixel); GUI.DrawTexture(new Rect(num4 - num3, num5 + num2, num + num3 * 2f, num3), (Texture)(object)_uiPixel); GUI.DrawTexture(new Rect(num4 - num3, num5, num3, num2), (Texture)(object)_uiPixel); GUI.DrawTexture(new Rect(num4 + num, num5, num3, num2), (Texture)(object)_uiPixel); } } private void DrawCartPriceAboveBar(float barX, float barY, float barWidth, string haulText) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (_cartPriceStyle == null) { _cartPriceStyle = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; } Rect val = default(Rect); ((Rect)(ref val))..ctor(barX - 20f, barY - 30f, barWidth + 40f, 24f); GUI.color = new Color(0f, 0f, 0f, 0.85f); GUI.Label(new Rect(((Rect)(ref val)).x + 1f, ((Rect)(ref val)).y + 1f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), haulText, _cartPriceStyle); GUI.color = new Color(0.22f, 0.96f, 0.38f, 0.98f); GUI.Label(val, haulText, _cartPriceStyle); } private void DrawExtractionButtonMarkers() { //IL_0026: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_attachedCam == (Object)null || !LidarConfig.HighlightExtractionButton.Value) { return; } Vector3 position = ((Component)_attachedCam).transform.position; for (int i = 0; i < _extractionCaches.Count; i++) { ExtractionVisualCache extractionVisualCache = _extractionCaches[i]; if ((Object)(object)extractionVisualCache.Point == (Object)null || !((Component)extractionVisualCache.Point).gameObject.activeInHierarchy || GetExtractionStateName(extractionVisualCache.Point).IndexOf("Idle", StringComparison.OrdinalIgnoreCase) < 0) { continue; } Vector3 val = (((Object)(object)extractionVisualCache.ButtonAnchor != (Object)null) ? extractionVisualCache.ButtonAnchor.position : (((Component)extractionVisualCache.Point).transform.position + Vector3.up * 1.35f)); float num = Vector3.Distance(position, val); if (num <= 11f && HasLineOfSight(position, val, ((Component)extractionVisualCache.Point).transform)) { Vector3 val2 = _attachedCam.WorldToScreenPoint(val); if (val2.z > 0.1f) { float x = val2.x; float num2 = (float)Screen.height - val2.y; float num3 = 0.55f + 0.45f * Mathf.Abs(Mathf.Sin(Time.time * 4f)); float num4 = Mathf.Clamp(26f - num * 1.1f, 12f, 24f); DrawSquareFrame(x - num4 * 0.5f, num2 - num4 * 0.5f, num4, num4, 2f, new Color(1f, 0.56f, 0.1f, num3)); } } } } private void DrawSquareFrame(float x, float y, float w, float h, float t, Color col) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) GUI.color = col; GUI.DrawTexture(new Rect(x, y, w, t), (Texture)(object)_uiPixel); GUI.DrawTexture(new Rect(x, y + h - t, w, t), (Texture)(object)_uiPixel); GUI.DrawTexture(new Rect(x, y, t, h), (Texture)(object)_uiPixel); GUI.DrawTexture(new Rect(x + w - t, y, t, h), (Texture)(object)_uiPixel); } private void PlaySound(AudioClip clip, float volumeScale, float pitch) { if (LidarConfig.EnableAudio.Value && !((Object)(object)_audioSource == (Object)null) && !((Object)(object)clip == (Object)null)) { _audioSource.pitch = pitch; _audioSource.PlayOneShot(clip, LidarConfig.AudioVolume.Value * volumeScale); } } private static AudioClip CreateTickClip() { int num = 1234; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Exp((0f - num2) * 140f); float num4 = Mathf.Lerp(2600f, 1400f, (float)i / (float)num); array[i] = Mathf.Sin(MathF.PI * 2f * num4 * num2) * num3 * 0.55f; } AudioClip obj = AudioClip.Create("LIDAR_Tick", num, 1, 44100, false); obj.SetData(array, 0); return obj; } private static AudioClip CreateBurstClip() { int num = 18522; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Min(1f, num2 * 90f) * Mathf.Exp((0f - num2) * 7.5f); float num4 = Mathf.Sin(MathF.PI * 2f * (880f - num2 * 420f) * num2); float num5 = Mathf.Sin(MathF.PI * 380f * num2) * 0.55f; array[i] = (num4 * 0.6f + num5 * 0.4f) * num3 * 0.7f; } AudioClip obj = AudioClip.Create("LIDAR_Burst", num, 1, 44100, false); obj.SetData(array, 0); return obj; } private static AudioClip CreateOverheatClip() { int num = 10584; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Exp((0f - num2) * 10f); float num4 = Mathf.Lerp(320f, 120f, (float)i / (float)num); array[i] = Mathf.Sign(Mathf.Sin(MathF.PI * 2f * num4 * num2)) * num3 * 0.22f; } AudioClip obj = AudioClip.Create("LIDAR_Overheat", num, 1, 44100, false); obj.SetData(array, 0); return obj; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } PhotonNetwork.RemoveCallbackTarget((object)this); ToggleBlackout(enable: false); RestoreHiddenCarpets(); if ((Object)(object)_attachedCam != (Object)null) { if (_cmd != null) { _attachedCam.RemoveCommandBuffer((CameraEvent)12, _cmd); } if (_overlayCmd != null) { _attachedCam.RemoveCommandBuffer((CameraEvent)17, _overlayCmd); } } CommandBuffer cmd = _cmd; if (cmd != null) { cmd.Release(); } CommandBuffer overlayCmd = _overlayCmd; if (overlayCmd != null) { overlayCmd.Release(); } ComputeBuffer pointsBuffer = _pointsBuffer; if (pointsBuffer != null) { pointsBuffer.Release(); } if ((Object)(object)_pointsMaterial != (Object)null) { Object.Destroy((Object)(object)_pointsMaterial); } if ((Object)(object)_buttonHighlightMat != (Object)null) { Object.Destroy((Object)(object)_buttonHighlightMat); } if ((Object)(object)_uiPixel != (Object)null) { Object.Destroy((Object)(object)_uiPixel); } if ((Object)(object)_tickClip != (Object)null) { Object.Destroy((Object)(object)_tickClip); } if ((Object)(object)_burstClip != (Object)null) { Object.Destroy((Object)(object)_burstClip); } if ((Object)(object)_overheatClip != (Object)null) { Object.Destroy((Object)(object)_overheatClip); } } } public static class LidarShopUpgrades { private readonly struct UpgradeDef { public readonly string Id; public readonly string AssetName; public readonly string DisplayName; public readonly float PriceMultiplier; public readonly int MaxAmount; public readonly int MaxInShop; public readonly bool LimitTotalPurchases; public readonly int MaxPurchases; public readonly Color BoxTint; public UpgradeDef(string id, string assetName, string displayName, float priceMultiplier, int maxAmount, int maxInShop, bool limitTotalPurchases, int maxPurchases, Color boxTint) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) Id = id; AssetName = assetName; DisplayName = displayName; PriceMultiplier = priceMultiplier; MaxAmount = maxAmount; MaxInShop = maxInShop; LimitTotalPurchases = limitTotalPurchases; MaxPurchases = maxPurchases; BoxTint = boxTint; } } public const string RangeId = "LIDAR Range"; public const string StaminaId = "LIDAR Stamina"; public const string ColorId = "LIDAR Color"; public const string LifetimeId = "LIDAR Duration"; public const string BeamWidthId = "LIDAR Wide Beam"; private static ManualLogSource? _log; private static GameObject? _prefabHolder; private static readonly List<Item> RegisteredItems = new List<Item>(); private static readonly Dictionary<string, string> AssetNameToDisplayName = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); private static bool _syncedToStatsManager; private static bool _inspectedFirstBox; private static readonly FieldInfo? GrabberObjField = FindGrabberObjField(); private static readonly FieldInfo? GrabberBoolField = AccessTools.Field(typeof(PhysGrabber), "grabbed"); public static bool IsRegistered { get; private set; } private static FieldInfo? FindGrabberObjField() { Type typeFromHandle = typeof(PhysGrabber); FieldInfo fieldInfo = AccessTools.Field(typeFromHandle, "grabbedPhysGrabObject") ?? AccessTools.Field(typeFromHandle, "grabbedObject"); if (fieldInfo != null) { return fieldInfo; } FieldInfo[] fields = typeFromHandle.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo2 in fields) { if (fieldInfo2.FieldType == typeof(PhysGrabObject)) { return fieldInfo2; } } return null; } public static void Init(ManualLogSource logger, Harmony harmony) { _log = logger; if (LidarConfig.EnableShopUpgrades.Value) { PatchShopManager(harmony); PatchItemAttributes(harmony); PatchItemInfoUIs(harmony); var (val, val2) = FindTemplateFromResources(); if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { RegisterAllWithTemplate(val, val2, "Resources/Awake"); } else { _log.LogWarning((object)"L.I.D.A.R.: Template upgrade not found in Resources during Awake, will register once StatsManager loads."); } } } private static void PatchShopManager(Harmony harmony) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0054: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(ShopManager), "ShopInitialize", (Type[])null, (Type[])null); if (methodInfo != null) { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(LidarShopUpgrades), "OnShopInitializePrefix", (Type[])null), new HarmonyMethod(typeof(LidarShopUpgrades), "OnShopInitializePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void PatchItemAttributes(Harmony harmony) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(ItemAttributes), "Awake", (Type[])null, (Type[])null); if (methodInfo != null) { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(LidarShopUpgrades), "OnItemAttributesInitPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo2 = AccessTools.Method(typeof(ItemAttributes), "Start", (Type[])null, (Type[])null); if (methodInfo2 != null) { harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(LidarShopUpgrades), "OnItemAttributesInitPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo3 = AccessTools.Method(typeof(ItemAttributes), "ShowingInfo", (Type[])null, (Type[])null); if (methodInfo3 != null) { harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(typeof(LidarShopUpgrades), "OnItemAttributesInitPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void PatchItemInfoUIs(Harmony harmony) { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown string[] obj = new string[2] { "ItemInfoUI", "ItemInfoExtraUI" }; int num = 0; string[] array = obj; for (int i = 0; i < array.Length; i++) { Type type = AccessTools.TypeByName(array[i]); if (type == null) { continue; } MethodInfo[] methods = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.IsSpecialName) { continue; } ParameterInfo[] parameters = methodInfo.GetParameters(); bool flag = false; bool flag2 = false; ParameterInfo[] array2 = parameters; foreach (ParameterInfo obj2 in array2) { if (obj2.ParameterType == typeof(string)) { flag = true; } if (obj2.ParameterType == typeof(ItemAttributes)) { flag2 = true; } } if (flag2 || (flag && (methodInfo.Name.IndexOf("Text", StringComparison.OrdinalIgnoreCase) >= 0 || methodInfo.Name.IndexOf("Info", StringComparison.OrdinalIgnoreCase) >= 0 || methodInfo.Name.IndexOf("Name", StringComparison.OrdinalIgnoreCase) >= 0))) { try { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(LidarShopUpgrades), "OnItemInfoUIPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); num++; } catch { } } } } ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)$"L.I.D.A.R.: Patched {num} ItemInfo UI method(s) for custom upgrade names."); } } private static void OnItemInfoUIPrefix(MethodBase __originalMethod, object[] __args) { if (__args == null || __args.Length == 0) { return; } string text = null; foreach (object obj in __args) { ItemAttributes val = (ItemAttributes)((obj is ItemAttributes) ? obj : null); if (val != null && TryGetDisplayName(val, out string displayName)) { Item item = val.item; ApplyDisplayNameToAttributes(val, ((item != null) ? ((Object)item).name : null) ?? "", displayName); text = displayName; break; } } if (text == null) { text = GetCurrentlyHeldLidarDisplayName(); } if (text == null) { return; } ParameterInfo[] parameters = __originalMethod.GetParameters(); for (int j = 0; j < __args.Length && j < parameters.Length; j++) { if (!(parameters[j].ParameterType != typeof(string))) { string text2 = __args[j] as string; string text3 = parameters[j].Name ?? ""; bool flag = text3.IndexOf("name", StringComparison.OrdinalIgnoreCase) >= 0 || text3.IndexOf("message", StringComparison.OrdinalIgnoreCase) >= 0 || text3.IndexOf("text", StringComparison.OrdinalIgnoreCase) >= 0 || text3.IndexOf("info", StringComparison.OrdinalIgnoreCase) >= 0; if ((!string.IsNullOrEmpty(text2) && (text2.IndexOf("strength", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("grab", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("сил", StringComparison.OrdinalIgnoreCase) >= 0)) || (flag && !string.IsNullOrEmpty(text2))) { __args[j] = text; } } } } private static string? GetCurrentlyHeldLidarDisplayName() { PhysGrabber instance = PhysGrabber.instance; if ((Object)(object)instance == (Object)null || GrabberObjField == null) { return null; } if (GrabberBoolField != null) { object value = GrabberBoolField.GetValue(instance); if (value is bool && !(bool)value) { return null; } } object? value2 = GrabberObjField.GetValue(instance); PhysGrabObject val = (PhysGrabObject)((value2 is PhysGrabObject) ? value2 : null); if (val == null || (Object)(object)val == (Object)null) { return null; } LidarUpgradeItemHandler lidarUpgradeItemHandler = default(LidarUpgradeItemHandler); if (((Component)val).TryGetComponent<LidarUpgradeItemHandler>(ref lidarUpgradeItemHandler) && !string.IsNullOrEmpty(lidarUpgradeItemHandler.displayName)) { return lidarUpgradeItemHandler.displayName; } ItemAttributes attrs = default(ItemAttributes); if (((Component)val).TryGetComponent<ItemAttributes>(ref attrs) && TryGetDisplayName(attrs, out string displayName)) { return displayName; } return null; } public static bool TryGetDisplayName(ItemAttributes attrs, out string displayName) { LidarUpgradeItemHandler lidarUpgradeItemHandler = default(LidarUpgradeItemHandler); if (((Component)attrs).TryGetComponent<LidarUpgradeItemHandler>(ref lidarUpgradeItemHandler) && !string.IsNullOrEmpty(lidarUpgradeItemHandler.displayName)) { displayName = lidarUpgradeItemHandler.displayName; return true; } if ((Object)(object)attrs.item != (Object)null && AssetNameToDisplayName.TryGetValue(((Object)attrs.item).name, out string value)) { displayName = value; return true; } displayName = string.Empty; return false; } private static void OnItemAttributesInitPostfix(ItemAttributes __instance) { if (!((Object)(object)__instance == (Object)null) && TryGetDisplayName(__instance, out string displayName)) { string assetName = (((Object)(object)__instance.item != (Object)null) ? ((Object)__instance.item).name : ""); LidarUpgradeItemHandler lidarUpgradeItemHandler = default(LidarUpgradeItemHandler); if (((Component)__instance).TryGetComponent<LidarUpgradeItemHandler>(ref lidarUpgradeItemHandler) && !string.IsNullOrEmpty(lidarUpgradeItemHandler.assetName)) { assetName = lidarUpgradeItemHandler.assetName; } ApplyDisplayNameToAttributes(__instance, assetName, displayName); } } private static void OnShopInitializePrefix() { TryRegisterFromStatsManager(); EnsureRegisteredItemsInStatsManager(); } private static void OnShopInitializePostfix(ShopManager __instance) { if (_log == null || StatsManager.instance?.itemDictionary == null) { return; } int num = 0; foreach (Item registeredItem in RegisteredItems) { if (StatsManager.instance.itemDictionary.ContainsKey(((Object)registeredItem).name)) { num++; } } int num2 = 0; FieldInfo[] fields = typeof(ShopManager).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (!(fieldInfo.GetValue(__instance) is IList list) || fieldInfo.Name.IndexOf("potential", StringComparison.OrdinalIgnoreCase) < 0) { continue; } foreach (object item in list) { Item val = (Item)((item is Item) ? item : null); if (val != null && RegisteredItems.Contains(val)) { num2++; } } } _log.LogInfo((object)$"L.I.D.A.R. [Shop]: {num}/{RegisteredItems.Count} in itemDictionary, {num2} queued in ShopManager potential lists."); } public static void TryRegisterFromStatsManager() { if (!LidarConfig.EnableShopUpgrades.Value || (Object)(object)StatsManager.instance == (Object)null || StatsManager.instance.itemDictionary == null || StatsManager.instance.itemDictionary.Count == 0) { return; } if (!IsRegistered) { var (val, val2) = FindTemplateFromDictionary(StatsManager.instance.itemDictionary); if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { RegisterAllWithTemplate(val, val2, "StatsManager"); } } if (IsRegistered && !_syncedToStatsManager) { EnsureRegisteredItemsInStatsManager(); _syncedToStatsManager = true; } } private static void EnsureRegisteredItemsInStatsManager() { StatsManager instance = StatsManager.instance; if ((Object)(object)instance == (Object)null || instance.itemDictionary == null || RegisteredItems.Count == 0) { return; } int num = 0; foreach (Item registeredItem in RegisteredItems) { if (!instance.itemDictionary.ContainsKey(((Object)registeredItem).name)) { instance.itemDictionary[((Object)registeredItem).name] = registeredItem; num++; } EnsureKeyInIntDictionary(instance, "itemsPurchased", ((Object)registeredItem).name); EnsureKeyInIntDictionary(instance, "itemsPurchasedTotal", ((Object)registeredItem).name); EnsureKeyInIntDictionary(instance, "itemsUpgradesPurchased", ((Object)registeredItem).name); } if (num > 0) { ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)$"L.I.D.A.R.: Synced {num} upgrade(s) directly into StatsManager.itemDictionary."); } } } private static void EnsureKeyInIntDictionary(StatsManager sm, string fieldName, string key) { if (AccessTools.Field(typeof(StatsManager), fieldName)?.GetValue(sm) is IDictionary dictionary && !dictionary.Contains(key)) { dictionary[key] = 0; } } private static (Item?, GameObject?) FindTemplateFromResources() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Invalid comparison between Unknown and I4 //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Invalid comparison between Unknown and I4 string[] array = new string[4] { "items/Item Upgrade Player Grab Strength", "items/Item Upgrade Player Energy", "items/Item Upgrade Player Health", "items/Item Upgrade Player Sprint Speed" }; ItemAttributes val2 = default(ItemAttributes); for (int i = 0; i < array.Length; i++) { GameObject val = Resourc