using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("PlanetTracker")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PlanetTracker")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a5bdcbc0-326d-4c93-9719-9e547f04a954")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace PlanetTracker; [BepInPlugin("jordy.dsp.planettracker", "PlanetTracker", "0.9.1")] public class Plugin : BaseUnityPlugin { private class PlanetEntry { public string Name; public PlanetData Planet; } public const string ModName = "PlanetTracker"; public const string ModVersion = "0.9.1"; private Rect windowRect = new Rect((float)(Screen.width - 560), 80f, 520f, 520f); private bool showWindow = true; private bool minimized = true; private bool mouseOverWindow = false; private const float MinimizedWindowWidth = 220f; private bool draggingWindow = false; private Vector2 dragOffset; private bool resizingWindow = false; private Vector2 resizeStartMouse; private Vector2 resizeStartSize; private const float MinWindowWidth = 520f; private const float MinWindowHeight = 320f; private const float MaxWindowWidth = 900f; private const float MaxWindowHeight = 900f; private int selectedScope = 1; private int lastLoadedScope = -1; private float nextAutoLoadTime = 0f; private int activeIndicatorPlanetId = -1; private readonly string[] scopes = new string[3] { "Favorites", "Local System", "Entire Galaxy" }; private readonly List favorites = new List(); private readonly List visiblePlanets = new List(); private readonly Dictionary aliases = new Dictionary(); private Vector2 scrollPos; private string aliasInput = ""; private PlanetEntry editingAlias; private GUIStyle titleStyle; private GUIStyle rowStyle; private GUIStyle smallTextStyle; private GUIStyle buttonStyle; private GUIStyle selectedScopeButtonStyle; private GUIStyle panelStyle; private GUIStyle miniButtonStyle; private GUIStyle activeIndicatorButtonStyle; private bool stylesReady = false; private readonly Color panelBg = new Color(0.015f, 0.045f, 0.06f, 0.86f); private readonly Color headerBg = new Color(0.03f, 0.11f, 0.14f, 0.95f); private readonly Color textColor = new Color(0.78f, 1f, 1f, 1f); private readonly Color subTextColor = new Color(0.52f, 0.78f, 0.82f, 0.95f); private readonly Color borderColor = new Color(0.38f, 0.95f, 1f, 0.65f); private Rect currentWindowScreenRect = new Rect(0f, 0f, 0f, 0f); private bool mouseOverTracker = false; private Harmony harmony; public static bool BlockDSPInput; private readonly string[] vfInputBlockMethods = new string[6] { "UseMouseLeft", "UseMouseRight", "UseMouseMiddle", "UseMouseScroll", "UseMouseWheel", "UseScroll" }; private void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown LoadAliasesFromDisk(); harmony = new Harmony("jordy.dsp.planettracker.inputblock"); harmony.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"PlanetTracker 0.9.1 loaded!"); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } private bool IsInGame() { return GameMain.isRunning && GameMain.mainPlayer != null && GameMain.galaxy != null && (Object)(object)UIRoot.instance != (Object)null && (Object)(object)UIRoot.instance.uiGame != (Object)null && ((Component)UIRoot.instance.uiGame).gameObject.activeInHierarchy && !VFInput.inFullscreenGUI; } private string GetAliasFilePath() { string text = Path.Combine(Paths.ConfigPath, "PlanetTracker"); Directory.CreateDirectory(text); return Path.Combine(text, "aliases.txt"); } private void LoadAliasesFromDisk() { try { aliases.Clear(); string aliasFilePath = GetAliasFilePath(); if (!File.Exists(aliasFilePath)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"No alias file found."); return; } string[] array = File.ReadAllLines(aliasFilePath); foreach (string text in array) { if (string.IsNullOrWhiteSpace(text)) { continue; } int num = text.IndexOf('='); if (num <= 0) { continue; } string s = text.Substring(0, num); string s2 = text.Substring(num + 1); if (int.TryParse(s, out var result)) { string @string = Encoding.UTF8.GetString(Convert.FromBase64String(s2)); if (!string.IsNullOrWhiteSpace(@string)) { aliases[result] = @string; } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded aliases: " + aliases.Count)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load aliases: " + ex.Message)); } } private void SaveAliasesToDisk() { try { string aliasFilePath = GetAliasFilePath(); List list = new List(); foreach (KeyValuePair alias in aliases) { string text = Convert.ToBase64String(Encoding.UTF8.GetBytes(alias.Value)); list.Add(alias.Key + "=" + text); } File.WriteAllLines(aliasFilePath, list.ToArray()); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Saved aliases: " + aliases.Count)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to save aliases: " + ex.Message)); } } private void Update() { if (!IsInGame()) { return; } if (Input.GetKeyDown((KeyCode)287)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"=== VFInput METHODS ==="); MethodInfo[] methods = typeof(VFInput).GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { ((BaseUnityPlugin)this).Logger.LogInfo((object)methodInfo.Name); } } UpdateMouseOverTracker(); if (mouseOverTracker) { BlockGameMouseInput(); } if (Input.GetKeyDown((KeyCode)289)) { showWindow = !showWindow; ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} window toggled. Visible: {1}", "PlanetTracker", showWindow)); } if (showWindow && !minimized && Time.time >= nextAutoLoadTime) { nextAutoLoadTime = Time.time + 1f; if (visiblePlanets.Count == 0 || lastLoadedScope != selectedScope) { LoadScopePlanets(); lastLoadedScope = selectedScope; } } } private void OnGUI() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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) if (IsInGame() && showWindow) { SetupStyles(); float num = (minimized ? 220f : ((Rect)(ref windowRect)).width); float num2 = (minimized ? (((Rect)(ref windowRect)).x + (((Rect)(ref windowRect)).width - num)) : ((Rect)(ref windowRect)).x); float num3 = (minimized ? 34f : ((Rect)(ref windowRect)).height); Rect val = default(Rect); ((Rect)(ref val))..ctor(num2, ((Rect)(ref windowRect)).y, num, num3); currentWindowScreenRect = val; UpdateMouseOverTracker(); GUI.color = panelBg; GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; DrawBorder(val, borderColor, 1); GUILayout.BeginArea(val); DrawTitleBar(num); if (!minimized) { DrawContent(); DrawResizeHandle(); } GUILayout.EndArea(); HandleDrag(num); HandleResize(); ConsumeInputWhenMouseOver(val); } } private void DrawTitleBar(float currentWidth) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) GUI.color = headerBg; GUI.DrawTexture(new Rect(0f, 0f, currentWidth, 34f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }); GUILayout.Space(10f); GUILayout.Label("PlanetTracker v0.9.1", titleStyle, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button(minimized ? "+" : "-", miniButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(28f), GUILayout.Height(24f) })) { minimized = !minimized; ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} minimized: {1}", "PlanetTracker", minimized)); } GUILayout.Space(6f); GUILayout.EndHorizontal(); } private void DrawContent() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(10f); DrawScopeButtons(); GUILayout.FlexibleSpace(); GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(10f); float num = Mathf.Max(120f, ((Rect)(ref windowRect)).height - 250f); scrollPos = GUILayout.BeginScrollView(scrollPos, panelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) }); DrawListHeader(); if (visiblePlanets.Count == 0) { GUILayout.Label("No planets loaded", rowStyle, Array.Empty()); } else { foreach (PlanetEntry item in visiblePlanets.ToList()) { DrawPlanetRow(item); GUILayout.Space(3f); } } GUILayout.EndScrollView(); GUILayout.Space(10f); GUILayout.EndHorizontal(); DrawAliasEditor(); } private void DrawScopeButtons() { GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); for (int i = 0; i < scopes.Length; i++) { GUIStyle val = ((selectedScope == i) ? selectedScopeButtonStyle : buttonStyle); if (GUILayout.Button(scopes[i], val, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(160f), GUILayout.Height(26f) }) && selectedScope != i) { selectedScope = i; visiblePlanets.Clear(); LoadScopePlanets(); lastLoadedScope = selectedScope; } } GUILayout.EndVertical(); } private void DrawListHeader() { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Name", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); GUILayout.Label("Alias", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) }); GUILayout.Label("ID", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) }); GUILayout.FlexibleSpace(); GUILayout.Label("Fav", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }); GUILayout.Label("A", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }); GUILayout.Label("Go", smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }); GUILayout.EndHorizontal(); GUILayout.Space(4f); } private void DrawPlanetRow(PlanetEntry entry) { if (entry != null && entry.Planet != null) { string alias = GetAlias(entry); string text = (string.IsNullOrEmpty(alias) ? "-" : alias); string text2 = entry.Planet.id.ToString(); bool flag = IsFavorite(entry); bool flag2 = activeIndicatorPlanetId == entry.Planet.id; GUILayout.BeginHorizontal(panelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(42f) }); GUILayout.Label(entry.Name, rowStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); GUILayout.Label(text, smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) }); GUILayout.Label(text2, smallTextStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) }); GUILayout.FlexibleSpace(); if (GUILayout.Button(flag ? "X" : "+", miniButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(28f), GUILayout.Height(26f) })) { ToggleFavorite(entry); } if (GUILayout.Button("A", miniButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(28f), GUILayout.Height(26f) })) { editingAlias = entry; aliasInput = alias; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Editing alias for: " + entry.Name)); } GUIStyle val = (flag2 ? activeIndicatorButtonStyle : miniButtonStyle); if (GUILayout.Button(flag2 ? "*" : "Go", val, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(28f), GUILayout.Height(26f) })) { TogglePlanetIndicator(entry); } GUILayout.EndHorizontal(); } } private void DrawAliasEditor() { GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(10f); GUILayout.BeginVertical(panelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(82f) }); if (editingAlias == null) { GUILayout.Label("Select A to set an alias.", smallTextStyle, Array.Empty()); } else { GUILayout.Label("Alias for: " + editingAlias.Name, smallTextStyle, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); aliasInput = GUILayout.TextField(aliasInput, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(210f), GUILayout.Height(28f) }); if (GUILayout.Button("Save", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(28f) })) { SaveAlias(editingAlias, aliasInput); editingAlias = null; aliasInput = ""; } if (GUILayout.Button("Clear", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(28f) })) { ClearAlias(editingAlias); editingAlias = null; aliasInput = ""; } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.Space(10f); GUILayout.EndHorizontal(); } private void DrawResizeHandle() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref windowRect)).width - 24f, ((Rect)(ref windowRect)).height - 24f, 22f, 22f); GUI.Label(val, "◢", smallTextStyle); } private void LoadScopePlanets() { visiblePlanets.Clear(); if (selectedScope == 0) { visiblePlanets.AddRange(favorites); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded favorites: " + visiblePlanets.Count)); } else if (selectedScope == 1) { LoadLocalSystemPlanets(); } else if (selectedScope == 2) { LoadEntireGalaxyPlanets(); } } private void LoadLocalSystemPlanets() { PlanetData localPlanet = GameMain.localPlanet; if (localPlanet == null || localPlanet.star == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not detect current star system."); return; } StarData star = localPlanet.star; if (star.planets == null || star.planets.Length == 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"No planets found in current star system."); return; } PlanetData[] planets = star.planets; foreach (PlanetData planet in planets) { AddVisiblePlanet(planet); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded local system planets: " + visiblePlanets.Count)); } private void LoadEntireGalaxyPlanets() { if (GameMain.galaxy == null || GameMain.galaxy.stars == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Galaxy data not available."); return; } StarData[] stars = GameMain.galaxy.stars; foreach (StarData val in stars) { if (val != null && val.planets != null) { PlanetData[] planets = val.planets; foreach (PlanetData planet in planets) { AddVisiblePlanet(planet); } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded entire galaxy planets: " + visiblePlanets.Count)); } private void AddVisiblePlanet(PlanetData planet) { if (planet != null) { string planetName = GetPlanetName(planet); if (!string.IsNullOrEmpty(planetName)) { visiblePlanets.Add(new PlanetEntry { Name = planetName, Planet = planet }); } } } private bool IsFavorite(PlanetEntry entry) { if (entry == null || entry.Planet == null) { return false; } return favorites.Any((PlanetEntry f) => f.Planet != null && f.Planet.id == entry.Planet.id); } private void ToggleFavorite(PlanetEntry entry) { if (entry == null || entry.Planet == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot toggle favorite. Planet is null."); } else if (IsFavorite(entry)) { favorites.RemoveAll((PlanetEntry f) => f.Planet != null && f.Planet.id == entry.Planet.id); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Removed favorite planet: " + entry.Name)); if (selectedScope == 0) { LoadScopePlanets(); } } else { favorites.Add(new PlanetEntry { Name = entry.Name, Planet = entry.Planet }); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Added favorite planet: " + entry.Name)); } } private string GetAlias(PlanetEntry entry) { if (entry == null || entry.Planet == null) { return ""; } if (aliases.TryGetValue(entry.Planet.id, out var value)) { return value; } return ""; } private void SaveAlias(PlanetEntry entry, string alias) { if (entry != null && entry.Planet != null) { alias = alias?.Trim() ?? ""; if (string.IsNullOrEmpty(alias)) { ClearAlias(entry); return; } aliases[entry.Planet.id] = alias; SaveAliasesToDisk(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Alias set: " + entry.Name + " => " + alias)); } } private void ClearAlias(PlanetEntry entry) { if (entry != null && entry.Planet != null && aliases.ContainsKey(entry.Planet.id)) { aliases.Remove(entry.Planet.id); SaveAliasesToDisk(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Alias cleared: " + entry.Name)); } } private void TogglePlanetIndicator(PlanetEntry entry) { if (entry == null || entry.Planet == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot toggle indicator. Planet is null."); return; } if (activeIndicatorPlanetId == entry.Planet.id) { ClearPlanetIndicator(); return; } ActivatePlanetIndicator(entry); activeIndicatorPlanetId = entry.Planet.id; } private void ActivatePlanetIndicator(PlanetEntry entry) { try { object mainPlayer = GameMain.mainPlayer; if (mainPlayer == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot activate indicator. mainPlayer is null."); return; } object fieldOrProperty = GetFieldOrProperty(mainPlayer, "navigation"); if (fieldOrProperty == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot activate indicator. Player navigation not found."); return; } int astroId = entry.Planet.astroId; string text = ((!string.IsNullOrEmpty(GetAlias(entry))) ? GetAlias(entry) : entry.Name); bool flag = false; flag |= SetFieldOrProperty(fieldOrProperty, "indicatorAstroId", astroId); flag |= SetFieldOrProperty(fieldOrProperty, "indicatorEntityId", 0); flag |= SetFieldOrProperty(fieldOrProperty, "indicatorMsg", text); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Indicator requested for {text}. AstroId: {astroId}. Success: {flag}"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Indicator activation failed: " + ex.Message)); } } private void ClearPlanetIndicator() { try { object mainPlayer = GameMain.mainPlayer; if (mainPlayer == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot clear indicator. mainPlayer is null."); activeIndicatorPlanetId = -1; return; } object fieldOrProperty = GetFieldOrProperty(mainPlayer, "navigation"); if (fieldOrProperty == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Cannot clear indicator. Player navigation not found."); activeIndicatorPlanetId = -1; return; } bool flag = false; flag |= SetFieldOrProperty(fieldOrProperty, "indicatorAstroId", 0); flag |= SetFieldOrProperty(fieldOrProperty, "indicatorEntityId", 0); flag |= SetFieldOrProperty(fieldOrProperty, "indicatorMsg", ""); activeIndicatorPlanetId = -1; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Indicator cleared. Success: " + flag)); } catch (Exception ex) { activeIndicatorPlanetId = -1; ((BaseUnityPlugin)this).Logger.LogError((object)("Indicator clear failed: " + ex.Message)); } } private object GetFieldOrProperty(object target, string name) { Type type = target.GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(target); } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { return property.GetValue(target, null); } return null; } private bool SetFieldOrProperty(object target, string name, object value) { Type type = target.GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(target, value); return true; } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { property.SetValue(target, value, null); return true; } return false; } private string GetPlanetName(PlanetData planet) { if (planet == null) { return null; } if (!string.IsNullOrEmpty(planet.displayName)) { return planet.displayName; } return planet.name; } private void SetupStyles() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00cc: 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_0107: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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_020c: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Expected O, but got Unknown //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Expected O, but got Unknown //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Expected O, but got Unknown if (!stylesReady) { titleStyle = new GUIStyle(GUI.skin.label); titleStyle.normal.textColor = textColor; titleStyle.fontSize = 15; titleStyle.fontStyle = (FontStyle)1; titleStyle.alignment = (TextAnchor)3; rowStyle = new GUIStyle(GUI.skin.label); rowStyle.normal.textColor = textColor; rowStyle.fontSize = 14; rowStyle.alignment = (TextAnchor)3; smallTextStyle = new GUIStyle(GUI.skin.label); smallTextStyle.normal.textColor = subTextColor; smallTextStyle.fontSize = 11; smallTextStyle.alignment = (TextAnchor)3; buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.normal.textColor = textColor; buttonStyle.hover.textColor = Color.white; buttonStyle.active.textColor = Color.white; buttonStyle.fontSize = 13; buttonStyle.alignment = (TextAnchor)4; buttonStyle.normal.background = MakeTex(2, 2, new Color(0.02f, 0.08f, 0.1f, 0.7f)); buttonStyle.hover.background = MakeTex(2, 2, new Color(0.07f, 0.2f, 0.24f, 0.85f)); buttonStyle.active.background = MakeTex(2, 2, new Color(0.06f, 0.18f, 0.22f, 0.9f)); selectedScopeButtonStyle = new GUIStyle(buttonStyle); selectedScopeButtonStyle.normal.background = MakeTex(2, 2, new Color(0.035f, 0.14f, 0.17f, 0.92f)); selectedScopeButtonStyle.hover.background = MakeTex(2, 2, new Color(0.06f, 0.2f, 0.24f, 0.95f)); selectedScopeButtonStyle.active.background = MakeTex(2, 2, new Color(0.06f, 0.2f, 0.24f, 0.95f)); selectedScopeButtonStyle.normal.textColor = new Color(0.72f, 1f, 1f, 1f); miniButtonStyle = new GUIStyle(buttonStyle); miniButtonStyle.fontSize = 14; miniButtonStyle.fontStyle = (FontStyle)1; activeIndicatorButtonStyle = new GUIStyle(miniButtonStyle); activeIndicatorButtonStyle.normal.background = MakeTex(2, 2, new Color(0.08f, 0.32f, 0.36f, 0.95f)); activeIndicatorButtonStyle.hover.background = MakeTex(2, 2, new Color(0.1f, 0.42f, 0.48f, 1f)); activeIndicatorButtonStyle.active.background = MakeTex(2, 2, new Color(0.12f, 0.52f, 0.58f, 1f)); activeIndicatorButtonStyle.normal.textColor = Color.white; panelStyle = new GUIStyle(GUI.skin.box); panelStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.04f, 0.05f, 0.55f)); panelStyle.padding = new RectOffset(8, 8, 8, 8); stylesReady = true; } } private void HandleDrag(float currentWidth) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Invalid comparison between Unknown and I4 //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_00ea: 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_00f5: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; float num = (minimized ? (((Rect)(ref windowRect)).x + (((Rect)(ref windowRect)).width - currentWidth)) : ((Rect)(ref windowRect)).x); Rect val = default(Rect); ((Rect)(ref val))..ctor(num, ((Rect)(ref windowRect)).y, currentWidth - 40f, 34f); if ((int)current.type == 0 && ((Rect)(ref val)).Contains(current.mousePosition)) { draggingWindow = true; dragOffset = current.mousePosition - new Vector2(((Rect)(ref windowRect)).x, ((Rect)(ref windowRect)).y); current.Use(); } if ((int)current.type == 1) { draggingWindow = false; } if (draggingWindow && (int)current.type == 3) { ((Rect)(ref windowRect)).position = current.mousePosition - dragOffset; float num2 = (minimized ? 220f : ((Rect)(ref windowRect)).width); float num3 = (minimized ? 34f : ((Rect)(ref windowRect)).height); if (minimized) { float num4 = ((Rect)(ref windowRect)).x + (((Rect)(ref windowRect)).width - 220f); num4 = Mathf.Clamp(num4, 0f, (float)Screen.width - 220f); ((Rect)(ref windowRect)).x = num4 - (((Rect)(ref windowRect)).width - 220f); } else { ((Rect)(ref windowRect)).x = Mathf.Clamp(((Rect)(ref windowRect)).x, 0f, (float)Screen.width - num2); } ((Rect)(ref windowRect)).y = Mathf.Clamp(((Rect)(ref windowRect)).y, 0f, (float)Screen.height - num3); current.Use(); } } private void HandleResize() { //IL_004a: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Invalid comparison between Unknown and I4 //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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) if (!minimized) { Event current = Event.current; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref windowRect)).xMax - 26f, ((Rect)(ref windowRect)).yMax - 26f, 26f, 26f); if ((int)current.type == 0 && ((Rect)(ref val)).Contains(current.mousePosition)) { resizingWindow = true; resizeStartMouse = current.mousePosition; resizeStartSize = new Vector2(((Rect)(ref windowRect)).width, ((Rect)(ref windowRect)).height); current.Use(); } if ((int)current.type == 1) { resizingWindow = false; } if (resizingWindow && (int)current.type == 3) { Vector2 val2 = current.mousePosition - resizeStartMouse; ((Rect)(ref windowRect)).width = Mathf.Clamp(resizeStartSize.x + val2.x, 520f, 900f); ((Rect)(ref windowRect)).height = Mathf.Clamp(resizeStartSize.y + val2.y, 320f, 900f); current.Use(); } } } private void ConsumeInputWhenMouseOver(Rect drawRect) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 Event current = Event.current; mouseOverWindow = ((Rect)(ref drawRect)).Contains(current.mousePosition); if (mouseOverWindow && ((int)current.type == 6 || (int)current.type == 0 || (int)current.type == 1 || (int)current.type == 3)) { current.Use(); } } private void LateUpdate() { if (IsInGame()) { UpdateMouseOverTracker(); if (mouseOverTracker) { BlockGameMouseInput(); } } } private void UpdateMouseOverTracker() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); mouseOverTracker = showWindow && ((Rect)(ref currentWindowScreenRect)).width > 0f && ((Rect)(ref currentWindowScreenRect)).Contains(val); BlockDSPInput = mouseOverTracker; } private void BlockGameMouseInput() { try { VFInput.UseMouseLeft(); VFInput.UseMouseRight(); VFInput.ResetGUIStates(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Input block failed: " + ex.Message)); } } private void DrawBorder(Rect rect, Color color, int thickness) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) GUI.color = color; GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, (float)thickness), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - (float)thickness, ((Rect)(ref rect)).width, (float)thickness), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, (float)thickness, ((Rect)(ref rect)).height), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(((Rect)(ref rect)).xMax - (float)thickness, ((Rect)(ref rect)).y, (float)thickness, ((Rect)(ref rect)).height), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } private Texture2D MakeTex(int width, int height, Color color) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = color; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } } [HarmonyPatch(typeof(VFInput), "get__openInventoryPanel")] public static class Patch_OpenInventoryPanel { public static bool Prefix(ref bool __result) { if (!Plugin.BlockDSPInput) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(VFInput), "get__openStarmap")] public static class Patch_OpenStarmap { public static bool Prefix(ref bool __result) { if (!Plugin.BlockDSPInput) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(VFInput), "get__openProductionPanel")] public static class Patch_OpenProductionPanel { public static bool Prefix(ref bool __result) { if (!Plugin.BlockDSPInput) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(VFInput), "get__openMechaPanel")] public static class Patch_OpenMechaPanel { public static bool Prefix(ref bool __result) { if (!Plugin.BlockDSPInput) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(VFInput), "get__openPlanetView")] public static class Patch_OpenPlanetView { public static bool Prefix(ref bool __result) { if (!Plugin.BlockDSPInput) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(VFInput), "get__openTechTree")] public static class Patch_OpenTechTree { public static bool Prefix(ref bool __result) { if (!Plugin.BlockDSPInput) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(VFInput), "get__openReplicatorPanel")] public static class Patch_OpenReplicatorPanel { public static bool Prefix(ref bool __result) { if (!Plugin.BlockDSPInput) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(VFInput), "get__openBuildingPanel")] public static class Patch_OpenBuildingPanel { public static bool Prefix(ref bool __result) { if (!Plugin.BlockDSPInput) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(VFInput), "get_mouseWheel")] public static class Patch_MouseWheel { public static bool Prefix(ref float __result) { if (!Plugin.BlockDSPInput) { return true; } __result = 0f; return false; } } [HarmonyPatch(typeof(VFInput), "get_inScrollMouseWheel")] public static class Patch_InScrollMouseWheel { public static bool Prefix(ref float __result) { if (!Plugin.BlockDSPInput) { return true; } __result = 0f; return false; } }