using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Kistras-Scanner")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+16d5a1b419113d1b102b6a5221f99296744892dd")] [assembly: AssemblyProduct("REPO Scanner")] [assembly: AssemblyTitle("Kistras-Scanner")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPO_Scanner { public static class ConfigManager { private const float MaxRadius = 100f; public static InputKey scanKey = (InputKey)327; public static ConfigEntry keyBind; public static ConfigEntry scanRadius; public static ConfigEntry cooldown; public static ConfigEntry multiplayerReveal; public static ConfigEntry toCreateGUI; public static ConfigEntry versionGUI; public static ConfigEntry shouldScanValuables; public static ConfigEntry onlyScanDiscoveredValuables; public static ConfigEntry shouldScanEnemies; public static ConfigEntry shouldScanHeads; public static ConfigEntry shouldScanItems; public static ConfigEntry shouldScanCosmetics; public static ConfigEntry shouldScanCustom; public static ConfigEntry scanRadiusValuablesOverride; public static ConfigEntry scanRadiusEnemiesOverride; public static ConfigEntry scanRadiusHeadsOverride; public static ConfigEntry scanRadiusItemsOverride; public static ConfigEntry scanRadiusCosmeticsOverride; public static ConfigEntry scanRadiusCustomOverride; private static KeyCode _storedKeybind; private static bool _initialized = false; public static bool IsLegacyVersionGUI { get; private set; } public static float MaxScanRadius { get { float num = 0f; if (shouldScanValuables.Value) { num = Mathf.Max(num, (scanRadiusValuablesOverride.Value > 0f) ? scanRadiusValuablesOverride.Value : scanRadius.Value); } if (shouldScanEnemies.Value) { num = Mathf.Max(num, (scanRadiusEnemiesOverride.Value > 0f) ? scanRadiusEnemiesOverride.Value : scanRadius.Value); } if (shouldScanHeads.Value) { num = Mathf.Max(num, (scanRadiusHeadsOverride.Value > 0f) ? scanRadiusHeadsOverride.Value : scanRadius.Value); } if (shouldScanItems.Value) { num = Mathf.Max(num, (scanRadiusItemsOverride.Value > 0f) ? scanRadiusItemsOverride.Value : scanRadius.Value); } if (shouldScanCosmetics.Value) { num = Mathf.Max(num, (scanRadiusCosmeticsOverride.Value > 0f) ? scanRadiusCosmeticsOverride.Value : scanRadius.Value); } if (shouldScanCustom.Value) { num = Mathf.Max(num, (scanRadiusCustomOverride.Value > 0f) ? scanRadiusCustomOverride.Value : scanRadius.Value); } return Mathf.Min(num, 100f); } } internal static void Initialize(Plugin plugin) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Expected O, but got Unknown //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Expected O, but got Unknown //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0339: 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_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Expected O, but got Unknown //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Expected O, but got Unknown if (_initialized) { return; } _initialized = true; keyBind = ((BaseUnityPlugin)plugin).Config.Bind("Keybinds", "Scanner Key", (KeyCode)102, new ConfigDescription("What you press to scan things", (AcceptableValueBase)null, Array.Empty())); scanRadius = ((BaseUnityPlugin)plugin).Config.Bind("Options", "Scan Radius", 10f, new ConfigDescription("Radius of the scanner", (AcceptableValueBase)(object)new AcceptableValueRange(2f, 100f), Array.Empty())); cooldown = ((BaseUnityPlugin)plugin).Config.Bind("Options", "Cooldown", 10f, new ConfigDescription("Interval between scans", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 120f), Array.Empty())); multiplayerReveal = ((BaseUnityPlugin)plugin).Config.Bind("Options", "Multiplayer RPC", true, new ConfigDescription("Whether to reveal scan results on other players' minimaps in multiplayer", (AcceptableValueBase)null, Array.Empty())); toCreateGUI = ((BaseUnityPlugin)plugin).Config.Bind("Options", "Create GUI", true, new ConfigDescription("Whether to create cooldown GUI", (AcceptableValueBase)null, Array.Empty())); versionGUI = ((BaseUnityPlugin)plugin).Config.Bind("Options", "GUI Version", "New", new ConfigDescription("New version uses REPO's screen effects", (AcceptableValueBase)(object)new AcceptableValueList(new string[2] { "New", "Legacy" }), Array.Empty())); shouldScanValuables = ((BaseUnityPlugin)plugin).Config.Bind("Features", "Valuables", true, new ConfigDescription("Whether to scan valuables", (AcceptableValueBase)null, Array.Empty())); onlyScanDiscoveredValuables = ((BaseUnityPlugin)plugin).Config.Bind("Features", "Only Scan Discovered", false, new ConfigDescription("Only scan already discovered valuables (does not reveal new ones)", (AcceptableValueBase)null, Array.Empty())); shouldScanEnemies = ((BaseUnityPlugin)plugin).Config.Bind("Features", "Enemies", true, new ConfigDescription("Whether to scan enemies", (AcceptableValueBase)null, Array.Empty())); shouldScanHeads = ((BaseUnityPlugin)plugin).Config.Bind("Features", "Heads", true, new ConfigDescription("Whether to scan dead player's heads", (AcceptableValueBase)null, Array.Empty())); shouldScanItems = ((BaseUnityPlugin)plugin).Config.Bind("Features", "Items", true, new ConfigDescription("Whether to scan equippable items", (AcceptableValueBase)null, Array.Empty())); shouldScanCosmetics = ((BaseUnityPlugin)plugin).Config.Bind("Features", "Cosmetics", true, new ConfigDescription("Whether to scan cosmetic boxes", (AcceptableValueBase)null, Array.Empty())); shouldScanCustom = ((BaseUnityPlugin)plugin).Config.Bind("Features", "Custom", true, new ConfigDescription("Whether to scan anything with custom discover feature", (AcceptableValueBase)null, Array.Empty())); scanRadiusValuablesOverride = ((BaseUnityPlugin)plugin).Config.Bind("Radius Overrides", "Valuables", 0f, new ConfigDescription("Override scan radius for valuables (0 to use main radius)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); scanRadiusEnemiesOverride = ((BaseUnityPlugin)plugin).Config.Bind("Radius Overrides", "Enemies", 0f, new ConfigDescription("Override scan radius for enemies (0 to use main radius)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); scanRadiusHeadsOverride = ((BaseUnityPlugin)plugin).Config.Bind("Radius Overrides", "Heads", 0f, new ConfigDescription("Override scan radius for heads (0 to use main radius)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); scanRadiusItemsOverride = ((BaseUnityPlugin)plugin).Config.Bind("Radius Overrides", "Items", 0f, new ConfigDescription("Override scan radius for items (0 to use main radius)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); scanRadiusCosmeticsOverride = ((BaseUnityPlugin)plugin).Config.Bind("Radius Overrides", "Cosmetics", 0f, new ConfigDescription("Override scan radius for cosmetic boxes (0 to use main radius)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); scanRadiusCustomOverride = ((BaseUnityPlugin)plugin).Config.Bind("Radius Overrides", "Custom", 0f, new ConfigDescription("Override scan radius for anything with custom discover feature (0 to use main radius)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); IsLegacyVersionGUI = versionGUI.Value == "Legacy"; keyBind.SettingChanged += delegate { RebindScan(); }; versionGUI.SettingChanged += delegate { IsLegacyVersionGUI = versionGUI.Value == "Legacy"; if (Object.op_Implicit((Object)(object)ScannerGUI.Instance)) { Object.Destroy((Object)(object)ScannerGUI.Instance); Patches.lastGuiCheckTime = 0f; } }; } internal static void RebindScan() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) ConfigEntry obj = keyBind; if (obj != null) { _ = obj.Value; if (0 == 0 && !((Object)(object)InputManager.instance == (Object)null) && _storedKeybind != keyBind.Value) { _storedKeybind = keyBind.Value; string text = KeyCodeToBindingPath(keyBind.Value); Plugin.Logger.LogInfo((object)("Keybind changed to: " + text)); InputManager.instance.Rebind(scanKey, text); } } } internal static string KeyCodeToBindingPath(KeyCode keyCode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Invalid comparison between Unknown and I4 //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_00c0: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00cb: Invalid comparison between Unknown and I4 //IL_00a9: 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_00b5: Expected I4, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Invalid comparison between Unknown and I4 //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 if ((int)keyCode >= 48 && (int)keyCode <= 57) { return "/" + ((object)(KeyCode)(ref keyCode)).ToString().Replace("Alpha", ""); } if ((int)keyCode == 323) { return "/leftButton"; } if ((int)keyCode == 324) { return "/rightButton"; } if ((int)keyCode == 325) { return "/middleButton"; } if ((int)keyCode >= 326 && (int)keyCode <= 329) { return $"/button{keyCode - 323}"; } KeyCode val = keyCode; KeyCode val2 = val; if ((int)val2 != 13) { if ((int)val2 != 305) { if ((int)val2 == 306) { return "/leftCtrl"; } string text = ((object)(KeyCode)(ref keyCode)).ToString(); if (text.Length > 0) { string text2 = char.ToLower(text[0]).ToString(); string text3 = text; text = text2 + text3.Substring(1, text3.Length - 1); } return "/" + text; } return "/rightCtrl"; } return "/enter"; } } [HarmonyPatch] public class Patches { internal static float lastGuiCheckTime; [HarmonyPatch(typeof(InputManager), "InitializeInputs")] [HarmonyPostfix] private static void InputManagerInitializeInputsPostfix(InputManager __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) try { Plugin.Logger.LogInfo((object)"Setting up scan input action..."); if (!InputManager.instance.inputActions.ContainsKey(ConfigManager.scanKey)) { InputAction val = new InputAction("Scan", (InputActionType)0, ConfigManager.KeyCodeToBindingPath(ConfigManager.keyBind.Value), (string)null, (string)null, (string)null); InputManager.instance.inputActions.Add(ConfigManager.scanKey, val); val.Enable(); Plugin.Logger.LogInfo((object)"Added scan input action"); } } catch (Exception ex) { Plugin.Logger.LogError((object)("Error in InputManagerInitializeInputsPostfix: " + ex.Message)); } } [HarmonyPatch(typeof(PlayerController), "Update")] [HarmonyPostfix] private static void PlayerControllerUpdatePostfix() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Scanner.Update(); if (SemiFunc.InputDown(ConfigManager.scanKey)) { Scanner.Scan(); } EnsureScannerGUIExists(); } [HarmonyPatch(typeof(PlayerController), "Start")] [HarmonyPostfix] private static void PlayerControllerStartPostfix() { ConfigManager.RebindScan(); } private static void EnsureScannerGUIExists() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if (!(Time.time - lastGuiCheckTime < 10f)) { lastGuiCheckTime = Time.time; if (!((Object)(object)ScannerGUI.Instance != (Object)null) && !((Object)(object)PlayerController.instance == (Object)null)) { GameObject val = new GameObject("ScannerGUI"); val.AddComponent(); val.transform.SetParent(((Component)HUDCanvas.instance).transform, false); } } } } [BepInPlugin("Kistras-Scanner", "REPO Scanner", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private readonly Harmony harmony = new Harmony("Kistras-Scanner"); internal static bool isCustomDiscoverStateLibLoaded; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; ConfigManager.Initialize(this); harmony.PatchAll(typeof(Patches)); Logger.LogInfo((object)$"Patched {harmony.GetPatchedMethods().Count()} methods!"); isCustomDiscoverStateLibLoaded = Chainloader.PluginInfos.ContainsKey("Kistras-CustomDiscoverStateLib"); if (!isCustomDiscoverStateLibLoaded) { Logger.LogInfo((object)"CustomDiscoverStateLib is not loaded. Will fallback to \"Reminder\" graphic (or custom one *if* it's present). Consider installing all dependencies."); } Logger.LogInfo((object)"Plugin Kistras-Scanner (1.2.0) is loaded!"); } } internal interface IDiscoverable { void Discover(State state); } public class Scanner { private const State DiscoverValuableState = 0; private const State DiscoverEnemyState = 2; private static State discoverHeadState = NewCustomState(new Color(1f, 0f, 0.067f, 0.17f), new Color(1f, 0.1f, 0.067f, 0.75f)); private static State discoverItemState = NewCustomState(new Color(0f, 0.5f, 0.8f, 0.17f), new Color(0.1f, 0.6f, 0.9f, 0.75f)); private static State discoverCosmeticState = NewCustomState(new Color(0.1f, 0.8f, 0.5f, 0.17f), new Color(0.2f, 0.9f, 0.6f, 0.75f)); private static float lastScanTime; private static bool isInitialized = false; private static State NewCustomState(Color middle, Color corner) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (Plugin.isCustomDiscoverStateLibLoaded) { try { Type type = AccessTools.TypeByName("CustomDiscoverStateLib.CustomDiscoverState"); if (type != null) { MethodInfo methodInfo = AccessTools.Method(type, "AddNewDiscoverGraphic", (Type[])null, (Type[])null); if (methodInfo != null) { return (State)methodInfo.Invoke(null, new object[2] { middle, corner }); } } } catch (Exception ex) { Plugin.Logger.LogError((object)("Error accessing CustomDiscoverState: " + ex.Message)); } } return (State)1; } private static void Initialize() { if (!isInitialized) { lastScanTime = ConfigManager.cooldown.Value; isInitialized = true; Plugin.Logger.LogInfo((object)"Scanner initialized successfully"); } } [CanBeNull] private static T GetComponentOfType(Collider gameObject) where T : Component { return ((Component)gameObject).GetComponentInParent() ?? ((Component)gameObject).GetComponentInChildren(); } public static void Scan() { //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_00be: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) if (Time.time - lastScanTime < ConfigManager.cooldown.Value) { return; } if ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated || SemiFunc.MenuLevel()) { Plugin.Logger.LogInfo((object)"Cannot scan: No level loaded."); return; } if (!isInitialized) { Initialize(); } PlayerController instance = PlayerController.instance; if ((Object)(object)instance == (Object)null || (Object)(object)Camera.main == (Object)null) { Plugin.Logger.LogError((object)"Cannot scan: Player camera not found."); return; } Vector3 position = ((Component)Camera.main).transform.position; Collider[] array = Physics.OverlapSphere(position, ConfigManager.MaxScanRadius); List scannedPositions = new List(); Collider[] array2 = array; foreach (Collider val in array2) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).transform == (Object)null || ScanItems(val, ConfigManager.shouldScanValuables, position, ConfigManager.scanRadiusValuablesOverride, scannedPositions, (State)0) || ScanItems(val, ConfigManager.shouldScanEnemies, position, ConfigManager.scanRadiusEnemiesOverride, scannedPositions, (State)2) || ScanItems(val, ConfigManager.shouldScanHeads, position, ConfigManager.scanRadiusHeadsOverride, scannedPositions, discoverHeadState) || ScanItems(val, ConfigManager.shouldScanItems, position, ConfigManager.scanRadiusItemsOverride, scannedPositions, discoverItemState) || ScanItems(val, ConfigManager.shouldScanCosmetics, position, ConfigManager.scanRadiusCosmeticsOverride, scannedPositions, discoverCosmeticState) || !((Object)(object)GetComponentOfType(val) == (Object)null) || ScanItems(val, ConfigManager.shouldScanCustom, position, ConfigManager.scanRadiusCustomOverride, scannedPositions, (State)3)) { } } lastScanTime = Time.time; if ((Object)(object)ScannerGUI.Instance != (Object)null) { ScannerGUI.Instance.NotifyScan(); } } private static bool ScanItems(Collider collider, ConfigEntry shouldScan, Vector3 scanPosition, ConfigEntry scanRadiusOverride, List scannedPositions, State state) where TComponent : MonoBehaviour { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) if (!shouldScan.Value) { return false; } TComponent componentOfType = GetComponentOfType(collider); if ((Object)(object)componentOfType == (Object)null) { return false; } float num = ((scanRadiusOverride.Value > 0f) ? scanRadiusOverride.Value : ConfigManager.scanRadius.Value); if (Vector3.Distance(((Component)(object)componentOfType).transform.position, scanPosition) > num) { return false; } if (HasScannedItemsNearby(((Component)(object)componentOfType).transform.position, scannedPositions)) { return false; } if (ConfigManager.onlyScanDiscoveredValuables.Value) { object obj = componentOfType; ValuableObject val = (ValuableObject)((obj is ValuableObject) ? obj : null); if (val != null && !val.discovered) { return false; } } if (ConfigManager.multiplayerReveal.Value) { object obj2 = componentOfType; ValuableObject val2 = (ValuableObject)((obj2 is ValuableObject) ? obj2 : null); if (val2 != null && !val2.discovered) { val2.Discover(state); goto IL_014a; } } PhysGrabObject componentOfType2 = GetComponentOfType(collider); if ((Object)(object)componentOfType2 == (Object)null) { return true; } ValuableDiscover.instance.New(componentOfType2, state, GetComponentOfType(collider)); goto IL_014a; IL_014a: return true; } private static bool HasScannedItemsNearby(Vector3 itemPos, List scannedPositions) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) foreach (Vector3 scannedPosition in scannedPositions) { if (Vector3.Distance(scannedPosition, itemPos) < 0.1f) { return true; } } scannedPositions.Add(itemPos); return false; } public static void Update() { } public static bool IsOnCooldown() { return Time.time - lastScanTime < ConfigManager.cooldown.Value; } public static float GetRemainingCooldown() { return Mathf.Max(0f, ConfigManager.cooldown.Value - (Time.time - lastScanTime)); } } public class ScannerGUI : MonoBehaviour { private GameObject uiContainer; private Image backgroundBar; private Image progressBar; private RectTransform barRect; private TextMeshProUGUI statusText; private Texture2D barTexture; private Texture2D backgroundTexture; private readonly float barWidth = 150f; private readonly float barHeight = 6f; private readonly float legacyBarWidth = 400f; private readonly float legacyBarHeight = 15f; private float lastDisplayTime; private readonly float displayDuration = 3f; private readonly Color barColor = new Color(1f, 0.6f, 0.1f, 0.8f); private readonly Color readyColor = new Color(1f, 0.8f, 0.2f, 0.8f); private CanvasGroup canvasGroup; public static ScannerGUI Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; ((Component)this).gameObject.transform.SetParent(((Component)HUDCanvas.instance).transform, false); Initialize(); } private void Initialize() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0118: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Expected O, but got Unknown //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Expected O, but got Unknown //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) lastDisplayTime = ConfigManager.cooldown.Value; if (ConfigManager.IsLegacyVersionGUI) { barTexture = new Texture2D(1, 1); barTexture.SetPixel(0, 0, Color.white); barTexture.Apply(); backgroundTexture = new Texture2D(1, 1); backgroundTexture.SetPixel(0, 0, Color.white); backgroundTexture.Apply(); return; } RectTransform rect = HUDCanvas.instance.rect; if (!((Object)(object)rect == (Object)null)) { uiContainer = new GameObject("ScannerUI"); RectTransform val = uiContainer.AddComponent(); ((Transform)val).SetParent((Transform)(object)rect, false); float num = barWidth; float num2 = barHeight; val.anchorMin = new Vector2(0.5f, 1f); val.anchorMax = new Vector2(0.5f, 1f); val.pivot = new Vector2(0.5f, 1f); val.anchoredPosition = new Vector2(0f, -5f); val.sizeDelta = new Vector2(num, num2 + 6.25f); canvasGroup = uiContainer.AddComponent(); canvasGroup.alpha = 0f; GameObject val2 = new GameObject("Background"); RectTransform val3 = val2.AddComponent(); ((Transform)val3).SetParent((Transform)(object)val, false); val3.anchorMin = new Vector2(0f, 0f); val3.anchorMax = new Vector2(1f, 0f); val3.pivot = new Vector2(0.5f, 0f); val3.sizeDelta = new Vector2(0f, num2); backgroundBar = val2.AddComponent(); ((Graphic)backgroundBar).color = new Color(0.2f, 0.2f, 0.2f, 0.6f); GameObject val4 = new GameObject("ProgressBarContainer"); RectTransform val5 = val4.AddComponent(); ((Transform)val5).SetParent((Transform)(object)val3, false); val5.anchorMin = new Vector2(0f, 0f); val5.anchorMax = new Vector2(1f, 1f); val5.offsetMin = Vector2.zero; val5.offsetMax = Vector2.zero; Mask val6 = val4.AddComponent(); val6.showMaskGraphic = false; Image val7 = val4.AddComponent(); ((Graphic)val7).color = Color.white; GameObject val8 = new GameObject("ProgressBar"); barRect = val8.AddComponent(); ((Transform)barRect).SetParent((Transform)(object)val5, false); barRect.anchorMin = new Vector2(0f, 0f); barRect.anchorMax = new Vector2(1f, 1f); barRect.offsetMin = Vector2.zero; barRect.offsetMax = Vector2.zero; progressBar = val8.AddComponent(); ((Graphic)progressBar).color = barColor; GameObject val9 = new GameObject("StatusText"); RectTransform val10 = val9.AddComponent(); ((Transform)val10).SetParent((Transform)(object)val, false); val10.anchorMin = new Vector2(0f, 0f); val10.anchorMax = new Vector2(1f, 0f); val10.pivot = new Vector2(0.5f, 0f); val10.anchoredPosition = new Vector2(0f, -12f); val10.sizeDelta = new Vector2(0f, 10f); statusText = val9.AddComponent(); ((TMP_Text)statusText).alignment = (TextAlignmentOptions)514; ((TMP_Text)statusText).fontSize = 6f; ((TMP_Text)statusText).fontStyle = (FontStyles)1; ((Graphic)statusText).color = Color.white; } } private void OnGUI() { //IL_00d0: 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_019a: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) if (!ConfigManager.IsLegacyVersionGUI || !ShouldShowGUI()) { return; } float remainingCooldown = Scanner.GetRemainingCooldown(); float num = remainingCooldown / ConfigManager.cooldown.Value; bool flag = Scanner.IsOnCooldown(); float num2; if (flag) { num2 = 1f; lastDisplayTime = Time.time; } else { float num3 = Time.time - lastDisplayTime; num2 = Mathf.Clamp01(1f - num3 / displayDuration); } if (!(num2 <= 0.01f)) { float num4 = ((float)Screen.width - legacyBarWidth) / 2f; float num5 = 30f; GUI.color = new Color(0.2f, 0.2f, 0.2f, 0.6f * num2); GUI.DrawTexture(new Rect(num4, num5, legacyBarWidth, legacyBarHeight), (Texture)(object)backgroundTexture); if (flag) { GUI.color = new Color(barColor.r, barColor.g, barColor.b, barColor.a * num2); GUI.DrawTexture(new Rect(num4, num5, legacyBarWidth * (1f - num), legacyBarHeight), (Texture)(object)barTexture); } else { GUI.color = new Color(readyColor.r, readyColor.g, readyColor.b, readyColor.a * num2); GUI.DrawTexture(new Rect(num4, num5, legacyBarWidth, legacyBarHeight), (Texture)(object)barTexture); } GUI.color = Color.white; GUIStyle val = new GUIStyle(GUI.skin.label); val.font = GUI.skin.font; val.fontSize = 14; val.alignment = (TextAnchor)4; val.fontStyle = (FontStyle)1; val.normal.textColor = new Color(1f, 1f, 1f, num2); string text = (flag ? $"Scanner: {remainingCooldown:F1}s" : "Scanner Ready"); GUI.Label(new Rect(num4, num5 + legacyBarHeight + 5f, legacyBarWidth, 20f), text, val); } } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } if ((Object)(object)uiContainer != (Object)null) { Object.Destroy((Object)(object)uiContainer); } if ((Object)(object)barTexture != (Object)null) { Object.Destroy((Object)(object)barTexture); } if ((Object)(object)backgroundTexture != (Object)null) { Object.Destroy((Object)(object)backgroundTexture); } } private void Update() { //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if (!ShouldShowGUI() || (Object)(object)uiContainer == (Object)null || ConfigManager.IsLegacyVersionGUI) { if ((Object)(object)uiContainer != (Object)null) { uiContainer.SetActive(false); } return; } uiContainer.SetActive(true); float remainingCooldown = Scanner.GetRemainingCooldown(); float num = remainingCooldown / ConfigManager.cooldown.Value; bool flag = Scanner.IsOnCooldown(); float alpha; if (flag) { alpha = 1f; lastDisplayTime = Time.time; } else { float num2 = Time.time - lastDisplayTime; alpha = Mathf.Clamp01(1f - num2 / displayDuration); } canvasGroup.alpha = alpha; if (flag) { float num3 = 1f - num; barRect.anchorMax = new Vector2(num3, 1f); ((Graphic)progressBar).color = barColor; ((TMP_Text)statusText).text = $"Scanner: {remainingCooldown:F1}s"; } else { barRect.anchorMax = new Vector2(1f, 1f); ((Graphic)progressBar).color = readyColor; ((TMP_Text)statusText).text = "Scanner Ready"; } } private bool ShouldShowGUI() { return ConfigManager.toCreateGUI.Value && (Object)(object)PlayerController.instance != (Object)null && (Object)(object)LevelGenerator.Instance != (Object)null && LevelGenerator.Instance.Generated && !SemiFunc.MenuLevel(); } public void NotifyScan() { lastDisplayTime = Time.time; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Kistras-Scanner"; public const string PLUGIN_NAME = "REPO Scanner"; public const string PLUGIN_VERSION = "1.2.0"; } }