Decompiled source of Empress Spawn Browser v2.0.0
EmpressSpawnBrowser.dll
Decompiled 2 weeks 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; 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("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+31d33a1e262fb9cd936a8fd3f583fdd7bc996e5a")] [assembly: AssemblyProduct("EmpressSpawnBrowser")] [assembly: AssemblyTitle("EmpressSpawnBrowser")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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.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] [Microsoft.CodeAnalysis.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] [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 Empress.SpawnBrowser { [BepInPlugin("Empress.SpawnBrowser", "Spawn Browser", "2.5.4")] public class SpawnBrowser : BaseUnityPlugin { [HarmonyPatch] private static class Patch_CameraAim_Update { private static MethodBase TargetMethod() { return FindTypeBySimpleName("CameraAim")?.GetMethod("Update", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? null; } private static bool Prefix() { return !UIActive; } } [HarmonyPatch] private static class Patch_EnemyOnScreen_GetOnScreen { private static MethodBase TargetMethod() { Type type = FindTypeBySimpleName("EnemyOnScreen"); if (type == null) { return null; } MethodInfo methodInfo = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo mi) => mi.Name == "GetOnScreen" && mi.GetParameters().Length == 1); return methodInfo ?? null; } private static void Finalizer(Exception __exception, ref bool __result) { if (__exception is KeyNotFoundException) { __result = false; } else if (__exception != null) { throw __exception; } } } private static bool _uiVisible; private int _tabIndex = 0; private string _searchEnemies = ""; private string _searchValuables = ""; private string _searchItems = ""; private readonly List<string> _enemyNames = new List<string>(); private readonly List<string> _valuableNames = new List<string>(); private readonly List<string> _itemNames = new List<string>(); private readonly Dictionary<string, ScriptableObject> _enemyByKey = new Dictionary<string, ScriptableObject>(StringComparer.OrdinalIgnoreCase); private readonly Dictionary<string, object> _valuableByKey = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); private readonly Dictionary<string, object> _itemByKey = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); private bool _discovered; private bool _discovering; private CursorLockMode _prevLock; private bool _prevVisible; private static readonly Regex RxEnemyTrim = new Regex("^Enemy( -)?\\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex RxValuableTrim = new Regex("^Valuable\\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex RxItemTrim = new Regex("^Item\\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled); private GameObject _canvasRoot; private Canvas _canvas; private GameObject _panelRoot; private ScrollRect _scrollRect; private Transform _contentContainer; private TextMeshProUGUI _titleText; private TextMeshProUGUI _statusText; private TextMeshProUGUI _countText; private Button _refreshButton; private Button[] _tabButtons = (Button[])(object)new Button[4]; private GameObject _itemRowPrefab; private ConfigEntry<KeyCode> _toggleKey; private ConfigEntry<float> _scrollSpeed; private Color _bg = new Color(0.02f, 0.02f, 0.02f, 0.95f); private Color _bg2 = new Color(0.04f, 0.01f, 0.01f, 0.98f); private Color _fg = new Color(0.9f, 0.9f, 0.9f, 1f); private Color _mutedCol = new Color(0.6f, 0.6f, 0.65f, 0.8f); private Color _accentBase = new Color(0.8f, 0.1f, 0.1f, 1f); private Color _accentHover = new Color(0.95f, 0.2f, 0.2f, 1f); private Color _accentDisabled = new Color(0.4f, 0.1f, 0.1f, 0.7f); private TMP_InputField _searchInput; private ConfigEntry<float> _uiScale; private ConfigEntry<Vector2> _uiPosition; private ConfigEntry<bool> _showTooltips; internal static SpawnBrowser Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } internal static bool UIActive => _uiVisible; private void Awake() { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); _toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Input", "ToggleKey", (KeyCode)277, "Key to toggle the Spawn Browser UI."); _scrollSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "ScrollSpeed", 35f, "Mouse wheel scroll sensitivity for the Spawn Browser list."); _uiScale = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "UIScale", 1f, "Scale of the UI panel (0.5 to 2.0)."); _uiPosition = ((BaseUnityPlugin)this).Config.Bind<Vector2>("UI", "UIPosition", new Vector2(0f, 0f), "Custom offset position for the UI panel."); _showTooltips = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowTooltips", true, "Enable tooltips for spawn items."); Harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony.PatchAll(); Logger.LogInfo((object)"\r\n ________ __ __ _______ _______ ________ ______ ______ \r\n/ |/ \\ / |/ \\ / \\ / | / \\ / \\ \r\n$$$$$$$$/ $$ \\ /$$ |$$$$$$$ |$$$$$$$ |$$$$$$$$/ /$$$$$$ |/$$$$$$ |\r\n$$ |__ $$$ \\ /$$$ |$$ |__$$ |$$ |__$$ |$$ |__ $$ \\__$$/ $$ \\__$$/ \r\n$$ | $$$$ /$$$$ |$$ $$/ $$ $$< $$ | $$ \\ $$ \\ \r\n$$$$$/ $$ $$ $$/$$ |$$$$$$$/ $$$$$$$ |$$$$$/ $$$$$$ | $$$$$$ |\r\n$$ |_____ $$ |$$$/ $$ |$$ | $$ | $$ |$$ |_____ / \\__$$ |/ \\__$$ |\r\n$$ |$$ | $/ $$ |$$ | $$ | $$ |$$ |$$ $$/ $$ $$/ \r\n$$$$$$$$/ $$/ $$/ $$/ $$/ $$/ $$$$$$$$/ $$$$$$/ $$$$$$/ \r\n"); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded. Press {_toggleKey.Value} to open/close the spawn browser."); ((MonoBehaviour)this).StartCoroutine(InitializeCanvasDelayed()); } private IEnumerator InitializeCanvasDelayed() { yield return (object)new WaitForSeconds(0.5f); BuildCanvas(); } private void OnDestroy() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } if (_uiVisible) { RestoreCursor(); } if (Object.op_Implicit((Object)(object)_canvasRoot)) { Object.Destroy((Object)(object)_canvasRoot); } } private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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 (Input.GetKeyDown(_toggleKey.Value)) { _uiVisible = !_uiVisible; if (_uiVisible) { if (!_discovered && !_discovering) { ((MonoBehaviour)this).StartCoroutine(DiscoverRoutine()); } TakeCursor(); ShowCanvas(); } else { RestoreCursor(); HideCanvas(); } } if (_uiVisible) { KeepCursorFree(); } if ((Object)(object)_scrollRect != (Object)null && _scrollRect.scrollSensitivity != _scrollSpeed.Value) { _scrollRect.scrollSensitivity = _scrollSpeed.Value; } if ((Object)(object)_panelRoot != (Object)null) { RectTransform component = _panelRoot.GetComponent<RectTransform>(); ((Transform)component).localScale = new Vector3(_uiScale.Value, _uiScale.Value, 1f); component.anchoredPosition = _uiPosition.Value; } } private void BuildCanvas() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Expected O, but got Unknown //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Expected O, but got Unknown //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_049d: 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_00cf: Expected O, but got Unknown //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Expected O, but got Unknown //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Unknown result type (might be due to invalid IL or missing references) //IL_07c6: Unknown result type (might be due to invalid IL or missing references) //IL_07d8: Unknown result type (might be due to invalid IL or missing references) //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_0878: Unknown result type (might be due to invalid IL or missing references) //IL_088f: Unknown result type (might be due to invalid IL or missing references) //IL_08a6: Unknown result type (might be due to invalid IL or missing references) //IL_08bd: Unknown result type (might be due to invalid IL or missing references) //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_0917: Unknown result type (might be due to invalid IL or missing references) //IL_0960: Unknown result type (might be due to invalid IL or missing references) //IL_0977: Unknown result type (might be due to invalid IL or missing references) //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_09a5: Unknown result type (might be due to invalid IL or missing references) //IL_0a1a: Unknown result type (might be due to invalid IL or missing references) //IL_0a27: Unknown result type (might be due to invalid IL or missing references) //IL_0a34: Unknown result type (might be due to invalid IL or missing references) //IL_0a7e: Unknown result type (might be due to invalid IL or missing references) //IL_0a95: Unknown result type (might be due to invalid IL or missing references) //IL_0aac: Unknown result type (might be due to invalid IL or missing references) //IL_0ac3: Unknown result type (might be due to invalid IL or missing references) //IL_0b48: Unknown result type (might be due to invalid IL or missing references) //IL_0b5f: Unknown result type (might be due to invalid IL or missing references) //IL_0b76: Unknown result type (might be due to invalid IL or missing references) //IL_0b8d: Unknown result type (might be due to invalid IL or missing references) //IL_0ba4: Unknown result type (might be due to invalid IL or missing references) //IL_0bbb: Unknown result type (might be due to invalid IL or missing references) //IL_0bf7: Unknown result type (might be due to invalid IL or missing references) //IL_0c04: Unknown result type (might be due to invalid IL or missing references) //IL_0c1b: Unknown result type (might be due to invalid IL or missing references) //IL_0c45: Unknown result type (might be due to invalid IL or missing references) //IL_0c52: Unknown result type (might be due to invalid IL or missing references) //IL_0c5f: Unknown result type (might be due to invalid IL or missing references) //IL_0c76: Unknown result type (might be due to invalid IL or missing references) //IL_0cd0: Unknown result type (might be due to invalid IL or missing references) //IL_0ce7: Unknown result type (might be due to invalid IL or missing references) //IL_0cfe: Unknown result type (might be due to invalid IL or missing references) //IL_0d15: Unknown result type (might be due to invalid IL or missing references) //IL_0d2c: Unknown result type (might be due to invalid IL or missing references) //IL_0d5c: Unknown result type (might be due to invalid IL or missing references) _canvasRoot = new GameObject("SpawnBrowserCanvas_EMPRESS"); Object.DontDestroyOnLoad((Object)(object)_canvasRoot); _canvasRoot.layer = LayerMask.NameToLayer("UI"); _canvas = _canvasRoot.AddComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 32767; _canvas.overrideSorting = true; CanvasScaler val = _canvasRoot.AddComponent<CanvasScaler>(); val.uiScaleMode = (ScaleMode)1; val.referenceResolution = new Vector2(1920f, 1080f); val.matchWidthOrHeight = 1f; _canvasRoot.AddComponent<GraphicRaycaster>(); if ((Object)(object)EventSystem.current == (Object)null) { GameObject val2 = new GameObject("EventSystem_EMPRESS"); Object.DontDestroyOnLoad((Object)(object)val2); val2.AddComponent<EventSystem>(); val2.AddComponent<StandaloneInputModule>(); } _panelRoot = CreateUIElement("Panel", _canvasRoot.transform); RectTransform component = _panelRoot.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(600f, 700f); component.anchoredPosition = _uiPosition.Value; Image val3 = _panelRoot.AddComponent<Image>(); ((Graphic)val3).color = _bg; Outline val4 = _panelRoot.AddComponent<Outline>(); ((Shadow)val4).effectColor = new Color(0.5f, 0.1f, 0.1f, 0.5f); ((Shadow)val4).effectDistance = new Vector2(2f, -2f); GameObject val5 = CreateUIElement("Header", _panelRoot.transform); RectTransform component2 = val5.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 1f); component2.anchorMax = new Vector2(1f, 1f); component2.pivot = new Vector2(0.5f, 1f); component2.sizeDelta = new Vector2(-28f, 60f); component2.anchoredPosition = new Vector2(0f, -14f); HorizontalLayoutGroup val6 = val5.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val6).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val6).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val6).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val6).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val6).spacing = 10f; GameObject val7 = CreateUIElement("Title", val5.transform); LayoutElement val8 = val7.AddComponent<LayoutElement>(); val8.flexibleWidth = 1f; val8.minWidth = 200f; _titleText = val7.AddComponent<TextMeshProUGUI>(); ((TMP_Text)_titleText).text = "<b>☠ Empress Spawn Browser</b> <color=#FF4444>- Hello World</color>"; ((TMP_Text)_titleText).fontSize = 20f; ((TMP_Text)_titleText).fontStyle = (FontStyles)1; ((Graphic)_titleText).color = _fg; ((TMP_Text)_titleText).alignment = (TextAlignmentOptions)4097; GameObject val9 = CreateButton("CloseBtn", val5.transform, "X"); LayoutElement val10 = val9.AddComponent<LayoutElement>(); val10.preferredWidth = 40f; val10.preferredHeight = 26f; Button component3 = val9.GetComponent<Button>(); ((UnityEvent)component3.onClick).AddListener((UnityAction)delegate { _uiVisible = false; RestoreCursor(); HideCanvas(); }); GameObject val11 = CreateButton("RefreshBtn", val5.transform, "↻ Refresh"); LayoutElement val12 = val11.AddComponent<LayoutElement>(); val12.preferredWidth = 90f; val12.preferredHeight = 26f; _refreshButton = val11.GetComponent<Button>(); ((UnityEvent)_refreshButton.onClick).AddListener((UnityAction)delegate { ((MonoBehaviour)this).StartCoroutine(DiscoverRoutine()); }); DrawDivider(_panelRoot.transform, -80f); GameObject val13 = CreateUIElement("TabBar", _panelRoot.transform); RectTransform component4 = val13.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0f, 1f); component4.anchorMax = new Vector2(1f, 1f); component4.pivot = new Vector2(0.5f, 1f); component4.sizeDelta = new Vector2(-28f, 40f); component4.anchoredPosition = new Vector2(0f, -88f); HorizontalLayoutGroup val14 = val13.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val14).spacing = 10f; ((HorizontalOrVerticalLayoutGroup)val14).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val14).childForceExpandHeight = true; string[] array = new string[4] { "ENEMIES ☠", "VALUABLES \ud83d\udc80", "ITEMS \ud83e\ude78", "TELEPORT ✈" }; for (int i = 0; i < 4; i++) { int index = i; GameObject val15 = CreateButton($"Tab{i}", val13.transform, array[i]); Image component5 = val15.GetComponent<Image>(); ((Graphic)component5).color = _bg2; Button component6 = val15.GetComponent<Button>(); ((Selectable)component6).transition = (Transition)1; ColorBlock colors = default(ColorBlock); ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = _accentHover; ((ColorBlock)(ref colors)).pressedColor = _accentBase; ((ColorBlock)(ref colors)).selectedColor = _accentBase; ((ColorBlock)(ref colors)).disabledColor = _accentDisabled; ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.1f; ((Selectable)component6).colors = colors; _tabButtons[i] = component6; ((UnityEvent)_tabButtons[i].onClick).AddListener((UnityAction)delegate { SwitchTab(index); }); } DrawDivider(_panelRoot.transform, -136f); GameObject val16 = CreateUIElement("Search", _panelRoot.transform); RectTransform component7 = val16.GetComponent<RectTransform>(); component7.anchorMin = new Vector2(0f, 1f); component7.anchorMax = new Vector2(1f, 1f); component7.pivot = new Vector2(0.5f, 1f); component7.sizeDelta = new Vector2(-28f, 40f); component7.anchoredPosition = new Vector2(0f, -144f); Image val17 = val16.AddComponent<Image>(); ((Graphic)val17).color = _bg2; _searchInput = val16.AddComponent<TMP_InputField>(); _searchInput.textViewport = component7; TextMeshProUGUI val18 = CreateTextMeshPro("Text", val16.transform, "", 13f, _fg, (TextAlignmentOptions)513); ((TMP_Text)val18).rectTransform.anchorMin = Vector2.zero; ((TMP_Text)val18).rectTransform.anchorMax = Vector2.one; ((TMP_Text)val18).rectTransform.sizeDelta = Vector2.zero; ((TMP_Text)val18).margin = new Vector4(10f, 0f, 0f, 0f); _searchInput.textComponent = (TMP_Text)(object)val18; TextMeshProUGUI val19 = CreateTextMeshPro("Placeholder", val16.transform, "Search...", 13f, _mutedCol, (TextAlignmentOptions)513); ((TMP_Text)val19).rectTransform.anchorMin = Vector2.zero; ((TMP_Text)val19).rectTransform.anchorMax = Vector2.one; ((TMP_Text)val19).rectTransform.sizeDelta = Vector2.zero; ((TMP_Text)val19).margin = new Vector4(10f, 0f, 0f, 0f); _searchInput.placeholder = (Graphic)(object)((Component)val19).GetComponent<TextMeshProUGUI>(); ((UnityEvent<string>)(object)_searchInput.onValueChanged).AddListener((UnityAction<string>)OnSearchChanged); DrawDivider(_panelRoot.transform, -192f); GameObject val20 = CreateUIElement("Status", _panelRoot.transform); RectTransform component8 = val20.GetComponent<RectTransform>(); component8.anchorMin = new Vector2(0f, 1f); component8.anchorMax = new Vector2(1f, 1f); component8.pivot = new Vector2(0.5f, 1f); component8.sizeDelta = new Vector2(-28f, 30f); component8.anchoredPosition = new Vector2(0f, -200f); _statusText = val20.AddComponent<TextMeshProUGUI>(); ((TMP_Text)_statusText).fontSize = 11f; ((Graphic)_statusText).color = new Color(0.95f, 0.75f, 0.3f, 1f); ((TMP_Text)_statusText).alignment = (TextAlignmentOptions)514; GameObject val21 = CreateUIElement("ScrollView", _panelRoot.transform); RectTransform component9 = val21.GetComponent<RectTransform>(); component9.anchorMin = new Vector2(0f, 0f); component9.anchorMax = new Vector2(1f, 1f); component9.offsetMin = new Vector2(14f, 50f); component9.offsetMax = new Vector2(-34f, -276f); _scrollRect = val21.AddComponent<ScrollRect>(); _scrollRect.horizontal = false; _scrollRect.vertical = true; _scrollRect.scrollSensitivity = _scrollSpeed.Value; _scrollRect.verticalScrollbarVisibility = (ScrollbarVisibility)0; GameObject val22 = CreateUIElement("Viewport", val21.transform); RectTransform component10 = val22.GetComponent<RectTransform>(); component10.anchorMin = Vector2.zero; component10.anchorMax = Vector2.one; component10.sizeDelta = Vector2.zero; val22.AddComponent<RectMask2D>(); _scrollRect.viewport = component10; GameObject val23 = CreateUIElement("Content", val22.transform); RectTransform component11 = val23.GetComponent<RectTransform>(); component11.anchorMin = new Vector2(0f, 1f); component11.anchorMax = new Vector2(1f, 1f); component11.pivot = new Vector2(0.5f, 1f); component11.sizeDelta = new Vector2(0f, 500f); VerticalLayoutGroup val24 = val23.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val24).spacing = 4f; ((HorizontalOrVerticalLayoutGroup)val24).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val24).childForceExpandHeight = false; val23.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2; _scrollRect.content = component11; _contentContainer = val23.transform; GameObject val25 = CreateUIElement("Scrollbar", val21.transform); RectTransform component12 = val25.GetComponent<RectTransform>(); component12.anchorMin = new Vector2(1f, 0f); component12.anchorMax = new Vector2(1f, 1f); component12.pivot = new Vector2(1f, 1f); component12.sizeDelta = new Vector2(20f, 0f); component12.anchoredPosition = new Vector2(0f, 0f); Image val26 = val25.AddComponent<Image>(); ((Graphic)val26).color = _bg2; Scrollbar val27 = val25.AddComponent<Scrollbar>(); val27.direction = (Direction)2; GameObject val28 = CreateUIElement("Sliding Area", val25.transform); RectTransform component13 = val28.GetComponent<RectTransform>(); component13.anchorMin = Vector2.zero; component13.anchorMax = Vector2.one; component13.sizeDelta = new Vector2(-10f, -10f); GameObject val29 = CreateUIElement("Handle", val28.transform); RectTransform component14 = val29.GetComponent<RectTransform>(); component14.anchorMin = Vector2.zero; component14.anchorMax = Vector2.one; component14.sizeDelta = Vector2.zero; Image val30 = val29.AddComponent<Image>(); ((Graphic)val30).color = _accentBase; ((Selectable)val27).targetGraphic = (Graphic)(object)val30; val27.handleRect = component14; _scrollRect.verticalScrollbar = val27; GameObject val31 = CreateUIElement("Count", _panelRoot.transform); RectTransform component15 = val31.GetComponent<RectTransform>(); component15.anchorMin = new Vector2(0f, 0f); component15.anchorMax = new Vector2(1f, 0f); component15.pivot = new Vector2(0.5f, 0f); component15.sizeDelta = new Vector2(-28f, 30f); component15.anchoredPosition = new Vector2(0f, 12f); _countText = val31.AddComponent<TextMeshProUGUI>(); ((TMP_Text)_countText).fontSize = 12f; ((Graphic)_countText).color = _mutedCol; ((TMP_Text)_countText).alignment = (TextAlignmentOptions)514; CreateItemRowPrefab(); _canvasRoot.SetActive(false); UpdateTabVisuals(); } private void OnSearchChanged(string value) { switch (_tabIndex) { case 0: _searchEnemies = value; break; case 1: _searchValuables = value; break; case 2: _searchItems = value; break; } RefreshCurrentTab(); } private void DrawDivider(Transform parent, float yPos) { //IL_0020: 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_004c: 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_0074: 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) GameObject val = CreateUIElement("Divider", parent); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); component.sizeDelta = new Vector2(-28f, 1f); component.anchoredPosition = new Vector2(0f, yPos); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = new Color(0.8f, 0.1f, 0.1f, 0.2f); } private GameObject CreateUIElement(string name, Transform parent) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.AddComponent<RectTransform>(); return val; } private GameObject CreateButton(string name, Transform parent, string text) { //IL_0013: 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) //IL_005a: 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_0074: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIElement(name, parent); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = _bg2; Button val3 = val.AddComponent<Button>(); ((Selectable)val3).targetGraphic = (Graphic)(object)val2; TextMeshProUGUI val4 = CreateTextMeshPro("Text", val.transform, text, 13f, _fg, (TextAlignmentOptions)514); RectTransform component = ((Component)val4).GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; return val; } private TextMeshProUGUI CreateTextMeshPro(string name, Transform parent, string text, float fontSize, Color color, TextAlignmentOptions alignment) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIElement(name, parent); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val2).text = text; ((TMP_Text)val2).fontSize = fontSize; ((Graphic)val2).color = color; ((TMP_Text)val2).alignment = alignment; return val2; } private void CreateItemRowPrefab() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0246: 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_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_016b: Expected O, but got Unknown _itemRowPrefab = CreateUIElement("ItemRowPrefab", _panelRoot.transform); _itemRowPrefab.SetActive(false); RectTransform component = _itemRowPrefab.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(0f, 32f); HorizontalLayoutGroup val = _itemRowPrefab.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val).childForceExpandHeight = true; ((HorizontalOrVerticalLayoutGroup)val).spacing = 8f; TextMeshProUGUI val2 = CreateTextMeshPro("Label", _itemRowPrefab.transform, "", 13f, _fg, (TextAlignmentOptions)4097); LayoutElement val3 = ((Component)val2).gameObject.AddComponent<LayoutElement>(); val3.flexibleWidth = 1f; RectTransform component2 = ((Component)val2).GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0f); component2.anchorMax = new Vector2(1f, 1f); component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; if (_showTooltips.Value) { EventTrigger val4 = _itemRowPrefab.AddComponent<EventTrigger>(); Entry val5 = new Entry { eventID = (EventTriggerType)0 }; ((UnityEvent<BaseEventData>)(object)val5.callback).AddListener((UnityAction<BaseEventData>)delegate(BaseEventData data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown ShowTooltip((PointerEventData)data); }); val4.triggers.Add(val5); Entry val6 = new Entry { eventID = (EventTriggerType)1 }; ((UnityEvent<BaseEventData>)(object)val6.callback).AddListener((UnityAction<BaseEventData>)delegate { HideTooltip(); }); val4.triggers.Add(val6); } GameObject val7 = CreateButton("SpawnBtn", _itemRowPrefab.transform, "SPAWN"); LayoutElement val8 = val7.AddComponent<LayoutElement>(); val8.preferredWidth = 90f; val8.preferredHeight = 26f; Image component3 = val7.GetComponent<Image>(); ((Graphic)component3).color = _accentBase; Button component4 = val7.GetComponent<Button>(); ((Selectable)component4).transition = (Transition)1; ColorBlock colors = default(ColorBlock); ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = _accentHover; ((ColorBlock)(ref colors)).pressedColor = new Color(0.6f, 0.1f, 0.1f, 1f); ((ColorBlock)(ref colors)).selectedColor = _accentBase; ((ColorBlock)(ref colors)).disabledColor = _accentDisabled; ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.1f; ((Selectable)component4).colors = colors; } private void ShowTooltip(PointerEventData data) { Logger.LogInfo((object)"Tooltip: Hovering over item."); } private void HideTooltip() { } private void ShowCanvas() { if (Object.op_Implicit((Object)(object)_canvasRoot)) { _canvasRoot.SetActive(true); } RefreshCurrentTab(); _searchInput.text = GetCurrentSearch(); } private void HideCanvas() { if (Object.op_Implicit((Object)(object)_canvasRoot)) { _canvasRoot.SetActive(false); } } private void SwitchTab(int index) { _tabIndex = index; UpdateTabVisuals(); _searchInput.text = GetCurrentSearch(); RefreshCurrentTab(); } private string GetCurrentSearch() { return (_tabIndex == 0) ? _searchEnemies : ((_tabIndex == 1) ? _searchValuables : ((_tabIndex == 2) ? _searchItems : "")); } private void UpdateTabVisuals() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _tabButtons.Length; i++) { if (!((Object)(object)_tabButtons[i] == (Object)null)) { Image component = ((Component)_tabButtons[i]).GetComponent<Image>(); ((Graphic)component).color = (Color)((_tabIndex == i) ? new Color(0.1f, 0.02f, 0.02f, 1f) : _bg2); } } } private void RefreshCurrentTab() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Expected O, but got Unknown //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Expected O, but got Unknown //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Expected O, but got Unknown //IL_04c4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_contentContainer == (Object)null) { return; } if ((Object)(object)_itemRowPrefab == (Object)null) { CreateItemRowPrefab(); } foreach (Transform item in _contentContainer) { Transform val = item; Object.Destroy((Object)(object)((Component)val).gameObject); } if (_tabIndex == 3) { if (Object.op_Implicit((Object)(object)_statusText)) { ((TMP_Text)_statusText).text = "Click to teleport."; } if (Object.op_Implicit((Object)(object)_countText)) { ((TMP_Text)_countText).text = ""; } Type type = FindTypeBySimpleName("GameDirector"); Object val2 = Object.FindObjectOfType(type); if (!(val2 != (Object)null) || !(type.GetField("PlayerList", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val2) is IEnumerable enumerable)) { return; } { foreach (object item2 in enumerable) { Component p = (Component)((item2 is Component) ? item2 : null); if (!Object.op_Implicit((Object)(object)p)) { continue; } string text = "Unknown"; try { text = (((object)p).GetType().GetField("playerName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(p) as string) ?? "Unknown"; } catch { } GameObject val3 = Object.Instantiate<GameObject>(_itemRowPrefab, _contentContainer); val3.SetActive(true); Transform obj2 = val3.transform.Find("Label"); TextMeshProUGUI val4 = ((obj2 != null) ? ((Component)obj2).GetComponent<TextMeshProUGUI>() : null); if (Object.op_Implicit((Object)(object)val4)) { ((TMP_Text)val4).text = text; } Transform obj3 = val3.transform.Find("SpawnBtn"); Button val5 = ((obj3 != null) ? ((Component)obj3).GetComponent<Button>() : null); if (Object.op_Implicit((Object)(object)val5)) { TextMeshProUGUI componentInChildren = ((Component)val5).GetComponentInChildren<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { ((TMP_Text)componentInChildren).text = "GOTO"; } ((UnityEventBase)val5.onClick).RemoveAllListeners(); ((UnityEvent)val5.onClick).AddListener((UnityAction)delegate { //IL_0012: Unknown result type (might be due to invalid IL or missing references) TeleportToPlayer(p.transform.position); }); GameObject val6 = Object.Instantiate<GameObject>(((Component)val5).gameObject, val3.transform); TextMeshProUGUI componentInChildren2 = val6.GetComponentInChildren<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)componentInChildren2)) { ((TMP_Text)componentInChildren2).text = "BRING"; } Button component = val6.GetComponent<Button>(); ((UnityEventBase)component.onClick).RemoveAllListeners(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { TeleportPlayerToMe(p); }); } } return; } } bool flag = IsHostOrOffline(); string text2 = ""; if (!flag) { text2 = "⚠ Host only — ask the lobby owner to spawn."; } else if (InRoom()) { text2 = "⚠ Networked room: prefab must be PUN-registered (ResourcePath)."; } if (Object.op_Implicit((Object)(object)_statusText)) { ((TMP_Text)_statusText).text = text2; } if (!_discovered && _discovering) { if (Object.op_Implicit((Object)(object)_countText)) { ((TMP_Text)_countText).text = "Discovering..."; } return; } List<string> src = ((_tabIndex == 0) ? _enemyNames : ((_tabIndex == 1) ? _valuableNames : _itemNames)); string currentSearch = GetCurrentSearch(); List<string> list = FilterAndSort(src, currentSearch); foreach (string item3 in list) { GameObject val7 = Object.Instantiate<GameObject>(_itemRowPrefab, _contentContainer); val7.SetActive(true); Transform obj4 = val7.transform.Find("Label"); TextMeshProUGUI val8 = ((obj4 != null) ? ((Component)obj4).GetComponent<TextMeshProUGUI>() : null); if (Object.op_Implicit((Object)(object)val8)) { ((TMP_Text)val8).text = item3; } Transform obj5 = val7.transform.Find("SpawnBtn"); Button val9 = ((obj5 != null) ? ((Component)obj5).GetComponent<Button>() : null); if (!Object.op_Implicit((Object)(object)val9)) { continue; } ((Selectable)val9).interactable = flag; Image component2 = ((Component)val9).GetComponent<Image>(); if (!flag && Object.op_Implicit((Object)(object)component2)) { ((Graphic)component2).color = _accentDisabled; } string captured = item3; ((UnityEventBase)val9.onClick).RemoveAllListeners(); ((UnityEvent)val9.onClick).AddListener((UnityAction)delegate { if (_tabIndex == 0) { SpawnEnemy(captured); } else if (_tabIndex == 1) { SpawnValuable(captured); } else { SpawnItem(captured); } }); } if (Object.op_Implicit((Object)(object)_countText)) { string arg = ((_tabIndex == 0) ? "enemies" : ((_tabIndex == 1) ? "valuables" : "items")); ((TMP_Text)_countText).text = $"{list.Count} {arg} found"; } } private void TeleportToPlayer(Vector3 targetPos) { //IL_003e: 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_006b: Unknown result type (might be due to invalid IL or missing references) try { Type type = FindTypeBySimpleName("PlayerController"); object obj = type.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null); if (obj != null) { Transform transform = ((Component)((obj is Component) ? obj : null)).transform; transform.position = targetPos; Rigidbody component = ((Component)((obj is Component) ? obj : null)).GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component)) { component.position = targetPos; component.velocity = Vector3.zero; } } } catch (Exception arg) { Logger.LogWarning((object)$"Teleport failed: {arg}"); } } private void TeleportPlayerToMe(Component playerComp) { //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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) try { Vector3 playerPosition = GetPlayerPosition(); Type type = ((object)playerComp).GetType(); MethodInfo method = type.GetMethod("Spawn", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(playerComp, new object[2] { playerPosition, Quaternion.identity }); return; } playerComp.transform.position = playerPosition; Rigidbody component = playerComp.GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component)) { component.position = playerPosition; component.velocity = Vector3.zero; } } catch (Exception arg) { Logger.LogWarning((object)$"Bring failed: {arg}"); } } private static List<string> FilterAndSort(IEnumerable<string> src, string search) { string search2 = search; return (src ?? Enumerable.Empty<string>()).Where((string s) => !string.IsNullOrEmpty(s) && (string.IsNullOrWhiteSpace(search2) || s.IndexOf(search2.Trim(), StringComparison.OrdinalIgnoreCase) >= 0)).OrderBy<string, string>((string n) => n, StringComparer.OrdinalIgnoreCase).ToList(); } private IEnumerator DiscoverRoutine() { _discovering = true; _discovered = false; _enemyNames.Clear(); _valuableNames.Clear(); _itemNames.Clear(); _enemyByKey.Clear(); _valuableByKey.Clear(); _itemByKey.Clear(); int enemyCount = 0; try { Type dirType = FindTypeBySimpleName("EnemyDirector"); Object inst = Object.FindObjectOfType(dirType); if (inst != (Object)null) { HashSet<string> set = new HashSet<string>(StringComparer.OrdinalIgnoreCase); string[] array = new string[3] { "enemiesDifficulty1", "enemiesDifficulty2", "enemiesDifficulty3" }; foreach (string fName in array) { if (!(dirType.GetField(fName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(inst) is IEnumerable listObj)) { continue; } foreach (object soObj in listObj) { ScriptableObject so = (ScriptableObject)((soObj is ScriptableObject) ? soObj : null); if (!Object.op_Implicit((Object)(object)so)) { continue; } string trimmed = RxEnemyTrim.Replace(((Object)so).name ?? "", "").Trim(); if (!string.IsNullOrEmpty(trimmed)) { string key = trimmed.ToLowerInvariant(); if (!_enemyByKey.ContainsKey(key)) { _enemyByKey[key] = so; } set.Add(trimmed); } } } _enemyNames.AddRange(set.OrderBy<string, string>((string x) => x, StringComparer.OrdinalIgnoreCase)); enemyCount = _enemyNames.Count; } } catch (Exception ex4) { Exception ex2 = ex4; Logger.LogWarning((object)("Enemy discovery failed: " + ex2.Message)); } yield return null; int valCount = 0; try { Type rmType = FindTypeBySimpleName("RunManager"); object rm = rmType?.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null); IEnumerable levels = (rmType?.GetField("levels", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))?.GetValue(rm) as IEnumerable; HashSet<string> set2 = new HashSet<string>(StringComparer.OrdinalIgnoreCase); if (levels != null) { foreach (object lvl in levels) { Type lType = lvl.GetType(); if (!(lType.GetField("ValuablePresets", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(lvl) is IEnumerable presets)) { continue; } foreach (object preset in presets) { Type pType = preset.GetType(); string[] array2 = new string[7] { "tiny", "small", "medium", "big", "wide", "tall", "veryTall" }; foreach (string listName in array2) { if (!(pType.GetField(listName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(preset) is IEnumerable listObj2)) { continue; } foreach (object pref in listObj2) { if (pref == null) { continue; } Type prefType = pref.GetType(); if (!InvokeBool(prefType.GetMethod("IsValid", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic), pref)) { continue; } string name = GetString(prefType.GetProperty("PrefabName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic), pref); if (string.IsNullOrWhiteSpace(name)) { continue; } string trimmed2 = RxValuableTrim.Replace(name, "").Trim(); if (!string.IsNullOrEmpty(trimmed2)) { string key2 = trimmed2.ToLowerInvariant(); if (!_valuableByKey.ContainsKey(key2)) { _valuableByKey[key2] = pref; } set2.Add(trimmed2); } } } } } } _valuableNames.AddRange(set2.OrderBy<string, string>((string x) => x, StringComparer.OrdinalIgnoreCase)); valCount = _valuableNames.Count; } catch (Exception ex3) { Logger.LogWarning((object)("Valuable discovery failed: " + ex3.Message)); } yield return null; int itemCount = 0; try { HashSet<string> set3 = new HashSet<string>(StringComparer.OrdinalIgnoreCase); Type shopType = FindTypeBySimpleName("ShopManager"); object shop = shopType?.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null); if (shop != null) { string[] array3 = new string[3] { "potentialItems", "potentialItemConsumables", "potentialItemUpgrades" }; foreach (string listField in array3) { if (!(shopType.GetField(listField, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(shop) is IEnumerable en2)) { continue; } foreach (object entry2 in en2) { AddItemEntry(entry2, set3); } } } Type statsType = FindTypeBySimpleName("StatsManager"); object stats = statsType?.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null); object dictObj = (statsType?.GetField("itemDictionary", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))?.GetValue(stats); if (dictObj is IDictionary dict) { foreach (DictionaryEntry item in dict) { AddItemEntry(item.Value, set3); } } string[] array4 = new string[3] { "ItemManager", "ItemsManager", "InventoryManager" }; foreach (string alt in array4) { Type t = FindTypeBySimpleName(alt); if (t == null) { continue; } object inst2 = t.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null) ?? t.GetProperty("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null, null); if (inst2 == null) { continue; } string[] array5 = new string[3] { "allItems", "items", "itemList" }; foreach (string lf in array5) { if (!(t.GetField(lf, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(inst2) is IEnumerable en)) { continue; } foreach (object entry in en) { AddItemEntry(entry, set3); } } } _itemNames.AddRange(set3.OrderBy<string, string>((string x) => x, StringComparer.OrdinalIgnoreCase)); itemCount = _itemNames.Count; } catch (Exception ex) { Logger.LogWarning((object)("Item discovery failed: " + ex.Message)); } _discovered = enemyCount + valCount + itemCount > 0; _discovering = false; Logger.LogInfo((object)$"Discovered {enemyCount} enemies, {valCount} valuables, {itemCount} items."); if (_uiVisible) { RefreshCurrentTab(); } } private void AddItemEntry(object entry, HashSet<string> set) { if (entry == null) { return; } string text = null; Type type = entry.GetType(); try { text = type.GetField("itemName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(entry)?.ToString(); if (string.IsNullOrWhiteSpace(text)) { text = type.GetProperty("itemName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(entry, null)?.ToString(); } } catch { } if (string.IsNullOrWhiteSpace(text)) { Object val = (Object)((entry is Object) ? entry : null); if (val != null && val != (Object)null) { text = val.name; } if (string.IsNullOrWhiteSpace(text)) { text = type.Name; } } text = RxItemTrim.Replace(text, "").Trim(); if (!string.IsNullOrEmpty(text)) { string key = text.ToLowerInvariant(); if (!_itemByKey.ContainsKey(key)) { _itemByKey[key] = entry; } set.Add(text); } } private void SpawnEnemy(string displayName) { //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_022e: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) if (!IsHostOrOffline()) { Logger.LogWarning((object)"Spawn blocked: Only the master client (host) or offline can spawn."); } else { if (string.IsNullOrWhiteSpace(displayName)) { return; } string key = displayName.Trim().ToLowerInvariant(); if (_enemyByKey.TryGetValue(key, out ScriptableObject value) && !((Object)(object)value == (Object)null)) { try { Type type = ((object)value).GetType(); if (type.GetField("spawnObjects", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value) is IEnumerable enumerable) { LevelPoint closestLevelPoint = GetClosestLevelPoint(); Vector3 val = (((Object)(object)closestLevelPoint != (Object)null) ? ((Component)closestLevelPoint).transform.position : GetPlayerPosition()); Type type2 = FindTypeBySimpleName("EnemyDirector"); Object val2 = Object.FindObjectOfType(type2); FieldInfo fieldInfo = type2?.GetField("debugSpawnClose", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); bool flag = false; if (val2 != (Object)null && fieldInfo != null) { flag = (bool)(fieldInfo.GetValue(val2) ?? ((object)false)); fieldInfo.SetValue(val2, true); } foreach (object item in enumerable) { if (item != null) { GameObject val3 = InstantiatePrefabRef(item, val, Quaternion.identity); if (Object.op_Implicit((Object)(object)val3) && (!InRoom() || HasValidPhotonView(val3))) { EnemyParent component = val3.GetComponent<EnemyParent>(); if ((Object)(object)component != (Object)null) { try { component.SetupDone = true; } catch { } try { component.firstSpawnPointUsed = true; } catch { } } Enemy componentInChildren = val3.GetComponentInChildren<Enemy>(); if ((Object)(object)componentInChildren != (Object)null) { try { if (!InRoom() || HasValidPhotonView(val3)) { componentInChildren.EnemyTeleported(val); } } catch { } } } } } if (val2 != (Object)null && fieldInfo != null) { fieldInfo.SetValue(val2, flag); } } return; } catch (Exception ex) { Logger.LogWarning((object)("Enemy spawn failed: " + ex.Message)); return; } } Logger.LogWarning((object)("Enemy not found: " + displayName)); } } private void SpawnValuable(string displayName) { //IL_0098: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00ab: 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) if (!IsHostOrOffline()) { Logger.LogWarning((object)"Spawn blocked: Only the master client (host) or offline can spawn."); } else { if (string.IsNullOrWhiteSpace(displayName)) { return; } string key = displayName.Trim().ToLowerInvariant(); if (_valuableByKey.TryGetValue(key, out object value) && value != null) { try { LevelPoint closestLevelPoint = GetClosestLevelPoint(); Vector3 pos = (((Object)(object)closestLevelPoint != (Object)null) ? ((Component)closestLevelPoint).transform.position : GetPlayerPosition()) + Vector3.up; GameObject val = InstantiatePrefabRef(value, pos, Quaternion.identity); if (Object.op_Implicit((Object)(object)val) && (!InRoom() || HasValidPhotonView(val))) { try { ValuableObject component = val.GetComponent<ValuableObject>(); if (component != null) { component.DollarValueSetLogic(); } return; } catch { return; } } return; } catch (Exception ex) { Logger.LogWarning((object)("Valuable spawn failed: " + ex.Message)); return; } } Logger.LogWarning((object)("Valuable not found: " + displayName)); } } private void SpawnItem(string displayName) { //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: 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_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_0154: 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_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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) if (!IsHostOrOffline()) { Logger.LogWarning((object)"Spawn blocked: Only the master client (host) or offline can spawn."); } else { if (string.IsNullOrWhiteSpace(displayName)) { return; } string key = displayName.Trim().ToLowerInvariant(); if (_itemByKey.TryGetValue(key, out object value) && value != null) { try { Type type = value.GetType(); object obj = type.GetField("prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value) ?? type.GetProperty("prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value, null); if (obj != null) { Quaternion rot = Quaternion.identity; try { Type type2 = FindTypeBySimpleName("ShopManager"); object obj2 = type2?.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null); Component val = (Component)((obj2 != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val != (Object)null) { val.transform.parent = null; rot = val.transform.rotation; } else { object obj3 = type.GetField("spawnRotationOffset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value) ?? type.GetProperty("spawnRotationOffset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value, null); if (obj3 is Quaternion) { Quaternion val2 = (Quaternion)obj3; if (true) { rot = val2; } } } } catch { } LevelPoint closestLevelPoint = GetClosestLevelPoint(); Vector3 pos = (((Object)(object)closestLevelPoint != (Object)null) ? ((Component)closestLevelPoint).transform.position : GetPlayerPosition()) + Vector3.up; GameObject val3 = InstantiatePrefabRef(obj, pos, rot); if (Object.op_Implicit((Object)(object)val3) && InRoom() && !HasValidPhotonView(val3)) { try { Object.Destroy((Object)(object)val3); return; } catch { return; } } } return; } catch (Exception ex) { Logger.LogWarning((object)("Item spawn failed: " + ex.Message)); return; } } Logger.LogWarning((object)("Item not found: " + displayName)); } } private GameObject InstantiatePrefabRef(object prefabRef, Vector3 pos, Quaternion rot) { //IL_014d: 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_012e: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) if (InRoom() && !IsHost()) { Logger.LogWarning((object)"Instantiate blocked: not master client."); return null; } try { Type type = prefabRef.GetType(); bool flag = true; try { MethodInfo method = type.GetMethod("IsValid", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { flag = InvokeBool(method, prefabRef); } } catch { } if (!flag) { return null; } string text = GetString(type.GetProperty("ResourcePath", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic), prefabRef) ?? type.GetField("ResourcePath", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(prefabRef)?.ToString(); object? obj2 = type.GetProperty("Prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(prefabRef, null); GameObject val = (GameObject)(((obj2 is GameObject) ? obj2 : null) ?? ((object)/*isinst with value type is only supported in some contexts*/)); GameObject result = null; if (InRoom() && PhotonNetwork.IsConnectedAndReady) { if (string.IsNullOrEmpty(text)) { return null; } result = PhotonNetwork.Instantiate(text, pos, rot, (byte)0, (object[])null); } else if ((Object)(object)val != (Object)null) { result = Object.Instantiate<GameObject>(val, pos, rot); } else if (!string.IsNullOrEmpty(text)) { result = Object.Instantiate<GameObject>(Resources.Load<GameObject>(text), pos, rot); } return result; } catch (Exception ex) { Logger.LogWarning((object)("Instantiate PrefabRef failed: " + ex.Message)); return null; } } private static bool HasValidPhotonView(GameObject go) { try { PhotonView[] componentsInChildren = go.GetComponentsInChildren<PhotonView>(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return false; } return componentsInChildren.Any((PhotonView pv) => (Object)(object)pv != (Object)null && pv.ViewID != 0); } catch { return false; } } private void TakeCursor() { //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) _prevLock = Cursor.lockState; _prevVisible = Cursor.visible; Type type = FindTypeBySimpleName("CursorManager"); object obj = type?.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null); if (obj != null) { try { type.GetMethod("Unlock", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(obj, new object[1] { 9999f }); } catch { } } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } private void KeepCursorFree() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)Cursor.lockState > 0) { Cursor.lockState = (CursorLockMode)0; } if (!Cursor.visible) { Cursor.visible = true; } } private void RestoreCursor() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Cursor.lockState = _prevLock; Cursor.visible = _prevVisible; } private static LevelPoint? GetClosestLevelPoint() { //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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) try { Type type = FindTypeBySimpleName("LevelGenerator"); Object val = ((type != null) ? Object.FindObjectOfType(type) : null); if (val != (Object)null && type.GetField("LevelPathPoints", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val) is IEnumerable enumerable) { Vector3 playerPosition = GetPlayerPosition(); LevelPoint val2 = null; float num = float.MaxValue; foreach (object item in enumerable) { LevelPoint val3 = (LevelPoint)((item is LevelPoint) ? item : null); if (!((Object)(object)val3 == (Object)null) && !((Object)(object)((Component)val3).transform == (Object)null)) { float num2 = Vector3.SqrMagnitude(((Component)val3).transform.position - playerPosition); if (num2 < num) { num = num2; val2 = val3; } } } if ((Object)(object)val2 != (Object)null) { return val2; } } } catch { } try { LevelPoint[] array = Object.FindObjectsOfType<LevelPoint>(); if (array != null && array.Length != 0) { Vector3 playerPosition2 = GetPlayerPosition(); LevelPoint result = null; float num3 = float.MaxValue; LevelPoint[] array2 = array; foreach (LevelPoint val4 in array2) { if (!((Object)(object)val4 == (Object)null)) { float num4 = Vector3.SqrMagnitude(((Component)val4).transform.position - playerPosition2); if (num4 < num3) { num3 = num4; result = val4; } } } return result; } } catch { } return null; } private static Vector3 GetPlayerPosition() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_003b: Unknown result type (might be due to invalid IL or missing references) try { Type type = FindTypeBySimpleName("PlayerController"); Component val = (Component)((type != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val != (Object)null) { return val.transform.position; } } catch { } if ((Object)(object)Camera.main != (Object)null) { return ((Component)Camera.main).transform.position; } return Vector3.zero; } private static bool InRoom() { try { return PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null; } catch { return false; } } private static bool IsSoloRoom() { try { return InRoom() && PhotonNetwork.CurrentRoom.PlayerCount <= 1; } catch { return false; } } private static bool IsMultiplayer() { try { return InRoom() && PhotonNetwork.CurrentRoom.PlayerCount >= 2; } catch { return false; } } private static bool IsHost() { try { return InRoom() && PhotonNetwork.IsMasterClient; } catch { return false; } } private static bool IsHostOrOffline() { try { if (!InRoom()) { return true; } if (IsSoloRoom()) { return true; } return PhotonNetwork.IsMasterClient; } catch { return true; } } private static Type? FindTypeBySimpleName(string simpleName) { string simpleName2 = simpleName; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type type = null; try { type = assembly.GetTypes().FirstOrDefault((Type x) => x.Name == simpleName2 || (x.FullName?.EndsWith("." + simpleName2) ?? false)); } catch { } if (type != null) { return type; } } return null; } private static bool InvokeBool(MethodInfo mi, object target) { try { object obj = mi?.Invoke(target, null); if (obj is bool) { bool result = (bool)obj; if (true) { return result; } } } catch { } return false; } private static string GetString(PropertyInfo pi, object target) { try { return pi?.GetValue(target, null)?.ToString(); } catch { return null; } } } } namespace Empress.SpawnBrowser.Addons { [BepInPlugin("Empress.SpawnBrowser.Cheats", "Spawn Browser - Cheats", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class CheatsESP : BaseUnityPlugin { private Harmony _harmony = null; private const int MyTabIndex = 5; private static GameObject _panelRoot; private static Transform _contentContainer; private static TMP_InputField _searchInput; private static TextMeshProUGUI _statusText; private static TextMeshProUGUI _countText; private static Button _cheatsTabButton; private static object _spawnBrowser; private static Color _bg2; private static Color _fg; private static Color _accentBase; private static Color _accentHover; private static Color _accentDisabled; private static Button _espEnemiesBtn; private static Button _espPlayersBtn; private static Button _hpBtn; private static Button _stamBtn; private static Button _reviveBtn; internal static bool EspEnemies; internal static bool EspPlayers; internal static CheatsESP Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); _harmony = new Harmony("Empress.SpawnBrowser.Cheats"); TryPatch(); Logger.LogInfo((object)"CHEATS tab ready."); } private void OnDestroy() { try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } CheatsESPOverlay.DestroyIfExists(); EspEnemies = (EspPlayers = false); CheatsVitals.UnlimitedHealthEnabled = false; CheatsVitals.UnlimitedStaminaEnabled = false; } private static Type FindTypeBySimpleName(string simpleName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type[] types; try { types = assemblies[i].GetTypes(); } catch { continue; } foreach (Type type in types) { if (type.Name == simpleName) { return type; } if (type.FullName != null && type.FullName.EndsWith("." + simpleName)) { return type; } } } return null; } private static Type FindType(string fullName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { try { Type type = assemblies[i].GetType(fullName, throwOnError: false, ignoreCase: false); if (type != null) { return type; } } catch { } } return null; } private void TryPatch() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown Type type = FindType("Empress.SpawnBrowser.SpawnBrowser"); if (!(type == null)) { MethodInfo method = type.GetMethod("BuildCanvas", BindingFlags.Instance | BindingFlags.NonPublic); _harmony.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(typeof(CheatsESP), "BuildCanvas_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo method2 = type.GetMethod("SwitchTab", BindingFlags.Instance | BindingFlags.NonPublic); _harmony.Patch((MethodBase)method2, new HarmonyMethod(typeof(CheatsESP), "SwitchTab_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo method3 = type.GetMethod("RefreshCurrentTab", BindingFlags.Instance | BindingFlags.NonPublic); _harmony.Patch((MethodBase)method3, new HarmonyMethod(typeof(CheatsESP), "RefreshCurrentTab_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); CheatsESPOverlay.Ensure(); } } private static void BuildCanvas_Postfix(object __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0170: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown object __instance2 = __instance; try { _spawnBrowser = __instance2; Type type = __instance2.GetType(); _panelRoot = (GameObject)type.GetField("_panelRoot", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance2); _contentContainer = (Transform)type.GetField("_contentContainer", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance2); _searchInput = (TMP_InputField)type.GetField("_searchInput", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance2); _statusText = (TextMeshProUGUI)type.GetField("_statusText", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance2); _countText = (TextMeshProUGUI)type.GetField("_countText", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance2); _bg2 = (Color)type.GetField("_bg2", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance2); _fg = (Color)type.GetField("_fg", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance2); _accentBase = (Color)type.GetField("_accentBase", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance2); _accentHover = (Color)type.GetField("_accentHover", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance2); _accentDisabled = (Color)type.GetField("_accentDisabled", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance2); Transform val = FindChildRecursive(_panelRoot.transform, "TabBar"); if (!((Object)(object)val == (Object)null)) { _cheatsTabButton = CreateTabButton(val, "CHEATS"); ((UnityEventBase)_cheatsTabButton.onClick).RemoveAllListeners(); ((UnityEvent)_cheatsTabButton.onClick).AddListener((UnityAction)delegate { SetSpawnBrowserTabIndex(__instance2, 5); RenderCheatsTab(); }); } } catch { } } private static bool SwitchTab_Prefix(object __instance, int index) { if (index == 5) { SetSpawnBrowserTabIndex(__instance, 5); RenderCheatsTab(); return false; } return true; } private static bool RefreshCurrentTab_Prefix(object __instance) { Type type = __instance.GetType(); int num = (int)type.GetField("_tabIndex", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); if (num == 5) { RenderCheatsTab(); return false; } return true; } private static void RenderCheatsTab() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_contentContainer == (Object)null) { return; } for (int num = _contentContainer.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)_contentContainer.GetChild(num)).gameObject); } if ((Object)(object)_searchInput != (Object)null) { _searchInput.text = string.Empty; } if (Object.op_Implicit((Object)(object)_statusText)) { ((TMP_Text)_statusText).text = "Local-only; multiplayer-safe"; } TextMeshProUGUI val = CreateTMP(_contentContainer, "<b>CHEATS</b>", 16f, _fg, (TextAlignmentOptions)4097); LayoutElement val2 = ((Component)val).gameObject.AddComponent<LayoutElement>(); val2.minHeight = 32f; GameObject val3 = CreateRow(_contentContainer); _espEnemiesBtn = CreateActionButton(val3.transform, EspEnemies ? "ESP: Enemies ✔" : "ESP: Enemies ✖", delegate { EspEnemies = !EspEnemies; CheatsESPOverlay cheatsESPOverlay2 = CheatsESPOverlay.Ensure(); cheatsESPOverlay2.SetActive(EspEnemies || EspPlayers); UpdateButtonText(_espEnemiesBtn, EspEnemies, "ESP: Enemies"); cheatsESPOverlay2.RefreshModes(EspPlayers, EspEnemies); }); _espPlayersBtn = CreateActionButton(val3.transform, EspPlayers ? "ESP: Players ✔" : "ESP: Players ✖", delegate { EspPlayers = !EspPlayers; CheatsESPOverlay cheatsESPOverlay = CheatsESPOverlay.Ensure(); cheatsESPOverlay.SetActive(EspEnemies || EspPlayers); UpdateButtonText(_espPlayersBtn, EspPlayers, "ESP: Players"); cheatsESPOverlay.RefreshModes(EspPlayers, EspEnemies); }); GameObject val4 = CreateRow(_contentContainer); _hpBtn = CreateActionButton(val4.transform, CheatsVitals.UnlimitedHealthEnabled ? "Unlimited Health ✔" : "Unlimited Health ✖", delegate { CheatsVitals.UnlimitedHealthEnabled = !CheatsVitals.UnlimitedHealthEnabled; UpdateButtonText(_hpBtn, CheatsVitals.UnlimitedHealthEnabled, "Unlimited Health"); }); _stamBtn = CreateActionButton(val4.transform, CheatsVitals.UnlimitedStaminaEnabled ? "Unlimited Stamina ✔" : "Unlimited Stamina ✖", delegate { CheatsVitals.UnlimitedStaminaEnabled = !CheatsVitals.UnlimitedStaminaEnabled; UpdateButtonText(_stamBtn, CheatsVitals.UnlimitedStaminaEnabled, "Unlimited Stamina"); }); GameObject val5 = CreateRow(_contentContainer); _reviveBtn = CreateActionButton(val5.transform, "Revive Dead Players", delegate { if (Object.op_Implicit((Object)(object)_reviveBtn)) { ((MonoBehaviour)Instance).StartCoroutine(FlashButton(((Component)_reviveBtn).GetComponent<Image>())); } try { Type type = FindTypeBySimpleName("GameDirector"); Object val6 = Object.FindObjectOfType(type); if (val6 != (Object)null && type.GetField("PlayerList", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(val6) is IEnumerable enumerable) { { foreach (object item in enumerable) { Component val7 = (Component)((item is Component) ? item : null); if (Object.op_Implicit((Object)(object)val7)) { Type type2 = ((object)val7).GetType(); FieldInfo field = type2.GetField("deadSet", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if ((bool)field.GetValue(val7)) { type2.GetMethod("Revive", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(bool) }, null)?.Invoke(val7, new object[1] { true }); } } } return; } } } catch { } }); if (Object.op_Implicit((Object)(object)_countText)) { ((TMP_Text)_countText).text = "ESP + Health/Stamina + Revive"; } } private static IEnumerator FlashButton(Image img) { if (!((Object)(object)img == (Object)null)) { ((Graphic)img).color = _accentBase; yield return (object)new WaitForSeconds(0.15f); if ((Object)(object)img != (Object)null) { ((Graphic)img).color = _bg2; } } } private static void UpdateButtonText(Button btn, bool state, string label) { //IL_0050: 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) TextMeshProUGUI componentInChildren = ((Component)btn).GetComponentInChildren<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { ((TMP_Text)componentInChildren).text = (state ? (label + " ✔") : (label + " ✖")); } Image component = ((Component)btn).GetComponent<Image>(); if (Object.op_Implicit((Object)(object)component)) { ((Graphic)component).color = (state ? _accentBase : _bg2); } } private static Transform FindChildRecursive(Transform root, string name) { if (((Object)root).name == name) { return root; } for (int i = 0; i < root.childCount; i++) { Transform child = root.GetChild(i); Transform val = FindChildRecursive(child, name); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static Button CreateTabButton(Transform parent, string text) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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: 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_006e: 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) //IL_00a0: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("TabCheats"); val.transform.SetParent(parent, false); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = _bg2; Button val3 = val.AddComponent<Button>(); ((Selectable)val3).transition = (Transition)1; ColorBlock colors = default(ColorBlock); ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = _accentHover; ((ColorBlock)(ref colors)).pressedColor = _accentBase; ((ColorBlock)(ref colors)).selectedColor = _accentBase; ((ColorBlock)(ref colors)).disabledColor = _accentDisabled; ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.1f; ((Selectable)val3).colors = colors; TextMeshProUGUI val4 = CreateTMP(val.transform, text, 13f, _fg, (TextAlignmentOptions)514); RectTransform component = ((Component)val4).GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; LayoutElement val5 = val.AddComponent<LayoutElement>(); val5.preferredHeight = 26f; return val3; } private static GameObject CreateRow(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Row"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.sizeDelta = new Vector2(0f, 36f); HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = true; ((HorizontalOrVerticalLayoutGroup)val3).spacing = 8f; return val; } private static TextMeshProUGUI CreateTMP(Transform parent, string text, float size, Color color, TextAlignmentOptions align) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Text"); val.transform.SetParent(parent, false); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val2).text = text; ((TMP_Text)val2).fontSize = size; ((Graphic)val2).color = color; ((TMP_Text)val2).alignment = align; return val2; } private static Button CreateActionButton(Transform parent, string text, Action onClick) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_002f: 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_0054: 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_0082: 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_009c: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown Action onClick2 = onClick; GameObject val = new GameObject("Btn"); val.transform.SetParent(parent, false); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = _bg2; Button val3 = val.AddComponent<Button>(); ((Selectable)val3).transition = (Transition)1; ColorBlock colors = default(ColorBlock); ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = _accentHover; ((ColorBlock)(ref colors)).pressedColor = new Color(0.6f, 0.1f, 0.1f, 1f); ((ColorBlock)(ref colors)).selectedColor = _accentBase; ((ColorBlock)(ref colors)).disabledColor = _accentDisabled; ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.1f; ((Selectable)val3).colors = colors; LayoutElement val4 = val.AddComponent<LayoutElement>(); val4.preferredHeight = 28f; TextMeshProUGUI val5 = CreateTMP(val.transform, text, 13f, Color.white, (TextAlignmentOptions)514); RectTransform component = ((Component)val5).GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; ((UnityEvent)val3.onClick).AddListener((UnityAction)delegate { onClick2(); }); return val3; } private static void SetSpawnBrowserTabIndex(object sb, int idx) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) Type type = sb.GetType(); type.GetField("_tabIndex", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(sb, idx); if (Object.op_Implicit((Object)(object)_cheatsTabButton)) { Image component = ((Component)_cheatsTabButton).GetComponent<Image>(); if (Object.op_Implicit((Object)(object)component)) { ((Graphic)component).color = new Color(0.1f, 0.02f, 0.02f, 1f); } } } } internal sealed class CheatsESPOverlay : MonoBehaviour { private struct DrawItem { public Vector3 screen; public string label; } private static CheatsESPOverlay _instance; private Camera _cam; private GUIStyle _style; private bool _active = true; private bool _showPlayers; private bool _showEnemies; private Type _tPlayer; private Type _tEnemy; private readonly List<Transform> _players = new List<Transform>(64); private readonly List<Transform> _enemies = new List<Transform>(128); private readonly List<DrawItem> _items = new List<DrawItem>(128); private float _scanTimer; private const float ScanInterval = 0.25f; private const int MaxGroup = 200; internal static CheatsESPOverlay Ensure() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_instance)) { return _instance; } GameObject val = new GameObject("Empress_CHEATS_ESP_OVERLAY"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; _instance = val.AddComponent<CheatsESPOverlay>(); return _instance; } internal static void DestroyIfExists() { if (Object.op_Implicit((Object)(object)_instance)) { try { Object.Destroy((Object)(object)((Component)_instance).gameObject); } catch { } _instance = null; } } internal void SetActive(bool value) { _active = value; } internal void RefreshModes(bool players, bool enemies) { _showPlayers = players; _showEnemies = enemies; _active = players || enemies; } private void Awake() { _cam = Camera.main; _tPlayer = FindTypeBySimpleName("PlayerController"); _tEnemy = FindTypeBySimpleName("Enemy"); } private void Update() { if (_active) { if ((Object)(object)_cam == (Object)null || !((Behaviour)_cam).isActiveAndEnabled) { _cam = Camera.main; } _scanTimer -= Time.unscaledDeltaTime; if (_scanTimer <= 0f) { Rescan(); _scanTimer = 0.25f; } BuildDrawList(); } } private void OnGUI() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_009e: 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_00db: 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) if (_active && (int)Event.current.type == 7 && !((Object)(object)_cam == (Object)null)) { if (_style == null) { _style = new GUIStyle(GUI.skin.label); _style.alignment = (TextAnchor)4; _style.fontSize = 12; _style.normal.textColor = new Color(1f, 0.6f, 0.6f, 1f); } Rect val = default(Rect); for (int i = 0; i < _items.Count; i++) { DrawItem drawItem = _items[i]; ((Rect)(ref val))..ctor(drawItem.screen.x - 50f, (float)Screen.height - drawItem.screen.y - 10f, 100f, 20f); GUI.Label(val, drawItem.label, _style); } if (_items.Count == 0 && !CheatsESP.EspEnemies && !CheatsESP.EspPlayers) { _active = false; } } } private void Rescan() { _players.Clear(); _enemies.Clear(); if (_showPlayers && _tPlayer != null) { Object[] array = Object.FindObjectsOfType(_tPlayer); int num = ((array != null) ? array.Length : 0); for (int i = 0; i < num; i++) { if (_players.Count >= 200) { break; } Object obj = array[i]; Component val = (Component)(object)((obj is Component) ? obj : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.transform)) { _players.Add(val.transform); } } } if (!_showEnemies || !(_tEnemy != null)) { return; } Object[] array2 = Object.FindObjectsOfType(_tEnemy); int num2 = ((array2 != null) ? array2.Length : 0); for (int j = 0; j < num2; j++) { if (_enemies.Count >= 200) { break; } Object obj2 = array2[j]; Component val2 = (Component)(object)((obj2 is Component) ? obj2 : null); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.transform)) { _enemies.Add(val2.transform); } } } private void BuildDrawList() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0097: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) _items.Clear(); if ((Object)(object)_cam == (Object)null) { return; } if (_showPlayers && _players.Count > 0) { for (int i = 0; i < _players.Count; i++) { Transform val = _players[i]; if (!Object.op_Implicit((Object)(object)val)) { continue; } Vector3 val2 = val.position + Vector3.up * 0.75f; Vector3 val3 = _cam.WorldToScreenPoint(val2); if (!(val3.z <= 0f)) { float num = Vector3.Distance(((Component)_cam).transform.position, val2); float num2 = 220f / Mathf.Max(1f, num); if (num2 < 8f) { num2 = 8f; } else if (num2 > 16f) { num2 = 16f; } if (_style != null) { _style.fon