Decompiled source of REPO Companion v1.0.0

RepoCompanion.dll

Decompiled 4 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RepoCompanion")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RepoCompanion")]
[assembly: AssemblyTitle("RepoCompanion")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Codex.RepoCompanion
{
	[BepInPlugin("codex.repocompanion", "REPO Companion", "1.0.0")]
	public sealed class RepoCompanionPlugin : BaseUnityPlugin
	{
		private enum Page
		{
			Home,
			Loot,
			Notes,
			Lobby,
			Navigate,
			Recap
		}

		private sealed class LootEntry
		{
			public string Name;

			public Vector3 Position;
		}

		private ConfigEntry<KeyCode> _menuKey;

		private ConfigEntry<bool> _lootEnabled;

		private ConfigEntry<bool> _notesEnabled;

		private ConfigEntry<bool> _lobbyEnabled;

		private ConfigEntry<bool> _navigationEnabled;

		private ConfigEntry<bool> _recapEnabled;

		private ConfigEntry<string> _savedNotes;

		private ConfigEntry<float> _lookRange;

		private readonly List<LootEntry> _loot = new List<LootEntry>();

		private Texture2D _pixel;

		private GUIStyle _title;

		private GUIStyle _subTitle;

		private GUIStyle _text;

		private GUIStyle _muted;

		private GUIStyle _button;

		private GUIStyle _tab;

		private GUIStyle _notesStyle;

		private Page _page;

		private bool _open;

		private bool _cursorWasLocked;

		private bool _cursorWasVisible;

		private bool _hasWaypoint;

		private bool _wasInRun;

		private bool _hasRecap;

		private Vector3 _waypoint;

		private string _notes = "";

		private float _scanCooldown;

		private float _runElapsed;

		private float _lastRunElapsed;

		private int _lastHaul;

		private int _lastLevels;

		private string _lastArea = "Run";

		private static readonly Color Bg = new Color(0.025f, 0.04f, 0.06f, 0.97f);

		private static readonly Color Panel = new Color(0.045f, 0.065f, 0.085f, 0.98f);

		private static readonly Color Mint = new Color(0.34f, 0.94f, 0.76f, 1f);

		private static readonly Color Blue = new Color(0.41f, 0.77f, 1f, 1f);

		private static readonly Color Pale = new Color(0.9f, 0.94f, 0.96f, 1f);

		private static readonly Color Dim = new Color(0.62f, 0.72f, 0.78f, 1f);

		private void Awake()
		{
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			_menuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "MenuKey", (KeyCode)287, "Open or close the REPO Companion dashboard.");
			_lootEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "LootLog", true, "Track valuables you personally look at.");
			_notesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "QuickNotes", true, "Keep private notes on this computer.");
			_lobbyEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "LobbyInfo", true, "Show the player roster visible to your game.");
			_navigationEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "Navigation", true, "Show your direction, coordinates, and a local waypoint.");
			_recapEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "RoundRecap", true, "Track a local run summary for the current session.");
			_savedNotes = ((BaseUnityPlugin)this).Config.Bind<string>("Notes", "Text", "", "Private notes stored in the local BepInEx config.");
			_lookRange = ((BaseUnityPlugin)this).Config.Bind<float>("Loot Log", "LookRange", 8f, "Maximum distance for noting a valuable you are looking at.");
			_notes = _savedNotes.Value ?? "";
			_pixel = new Texture2D(1, 1, (TextureFormat)4, false);
			_pixel.SetPixel(0, 0, Color.white);
			_pixel.Apply();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"REPO Companion ready. Press F6 to open the local dashboard.");
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(_menuKey.Value))
			{
				SetOpen(!_open);
			}
			if (_open && Input.GetKeyDown((KeyCode)27))
			{
				SaveNotes();
				SetOpen(open: false);
			}
			if (_lootEnabled.Value)
			{
				ScanLoot();
			}
			if (_recapEnabled.Value)
			{
				TrackRun();
			}
			if (_open && _notesEnabled.Value && _page == Page.Notes && _notes != (_savedNotes.Value ?? ""))
			{
				_savedNotes.Value = ((_notes.Length > 1200) ? _notes.Substring(0, 1200) : _notes);
			}
		}

		private void ScanLoot()
		{
			//IL_0041: 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_0092: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			_scanCooldown -= Time.unscaledDeltaTime;
			if (_scanCooldown > 0f)
			{
				return;
			}
			_scanCooldown = 0.3f;
			Camera main = Camera.main;
			RaycastHit val = default(RaycastHit);
			if ((Object)(object)main == (Object)null || !Physics.Raycast(((Component)main).transform.position, ((Component)main).transform.forward, ref val, Mathf.Clamp(_lookRange.Value, 2f, 20f)))
			{
				return;
			}
			ValuableObject componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<ValuableObject>();
			if ((Object)(object)componentInParent == (Object)null)
			{
				return;
			}
			Vector3 position = ((Component)componentInParent).transform.position;
			for (int i = 0; i < _loot.Count; i++)
			{
				Vector3 val2 = _loot[i].Position - position;
				if (((Vector3)(ref val2)).sqrMagnitude < 0.25f)
				{
					return;
				}
			}
			_loot.Insert(0, new LootEntry
			{
				Name = ((Object)((Component)componentInParent).gameObject).name.Replace("(Clone)", "").Trim(),
				Position = position
			});
			if (_loot.Count > 40)
			{
				_loot.RemoveAt(_loot.Count - 1);
			}
		}

		private void TrackRun()
		{
			if (SemiFunc.RunIsLobby() || !((Object)(object)RunManager.instance != (Object)null) || !((Object)(object)SemiFunc.PlayerGetLocal() != (Object)null))
			{
				if (_wasInRun)
				{
					_wasInRun = false;
					_hasRecap = true;
					_lastRunElapsed = _runElapsed;
					_runElapsed = 0f;
				}
				return;
			}
			_wasInRun = true;
			_runElapsed += Time.unscaledDeltaTime;
			RunManager instance = RunManager.instance;
			if ((Object)(object)instance.levelCurrent != (Object)null)
			{
				_lastArea = ((Object)instance.levelCurrent).name;
			}
			_lastHaul = SemiFunc.StatGetRunTotalHaul();
			_lastLevels = instance.levelsCompleted;
		}

		private void SetOpen(bool open)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			if (_open != open)
			{
				if (open)
				{
					_cursorWasLocked = (int)Cursor.lockState == 1;
					_cursorWasVisible = Cursor.visible;
					Cursor.lockState = (CursorLockMode)0;
					Cursor.visible = true;
				}
				else
				{
					Cursor.lockState = (CursorLockMode)(_cursorWasLocked ? 1 : 0);
					Cursor.visible = _cursorWasVisible;
				}
				_open = open;
			}
		}

		private void OnGUI()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			if (_open)
			{
				EnsureStyles();
				float num = Mathf.Min(820f, (float)Screen.width - 28f);
				float num2 = Mathf.Min(540f, (float)Screen.height - 28f);
				Rect rect = default(Rect);
				((Rect)(ref rect))..ctor(((float)Screen.width - num) * 0.5f, ((float)Screen.height - num2) * 0.5f, num, num2);
				Draw(rect, Bg);
				Draw(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 4f), Mint);
				GUI.Label(new Rect(((Rect)(ref rect)).x + 22f, ((Rect)(ref rect)).y + 16f, ((Rect)(ref rect)).width - 90f, 28f), "REPO COMPANION", _title);
				GUI.Label(new Rect(((Rect)(ref rect)).x + 22f, ((Rect)(ref rect)).y + 44f, ((Rect)(ref rect)).width - 90f, 20f), "LOCAL SESSION TOOLS  ·  PRIVATE TO THIS CLIENT", _muted);
				if (GUI.Button(new Rect(((Rect)(ref rect)).xMax - 48f, ((Rect)(ref rect)).y + 16f, 30f, 28f), "×", _button))
				{
					SaveNotes();
					SetOpen(open: false);
				}
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref rect)).x + 16f, ((Rect)(ref rect)).y + 82f, 168f, ((Rect)(ref rect)).height - 102f);
				Draw(val, Panel);
				PageButton(val, Page.Home, "OVERVIEW");
				PageButton(val, Page.Loot, "LOOT LOG");
				PageButton(val, Page.Notes, "QUICK NOTES");
				PageButton(val, Page.Lobby, "LOBBY INFO");
				PageButton(val, Page.Navigate, "NAVIGATION");
				PageButton(val, Page.Recap, "ROUND RECAP");
				GUI.Label(new Rect(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).yMax - 42f, ((Rect)(ref val)).width - 24f, 32f), "F6  CLOSE\nESC  CLOSE", _muted);
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(((Rect)(ref val)).xMax + 14f, ((Rect)(ref val)).y, ((Rect)(ref rect)).xMax - ((Rect)(ref val)).xMax - 30f, ((Rect)(ref val)).height);
				Draw(val2, Panel);
				Draw(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, 3f, ((Rect)(ref val2)).height), (_page == Page.Navigate) ? Blue : Mint);
				DrawPage(val2);
			}
		}

		private void PageButton(Rect nav, Page page, string label)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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)
			float num = ((Rect)(ref nav)).y + 12f + (float)((int)page * 46);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref nav)).x + 9f, num, ((Rect)(ref nav)).width - 18f, 38f);
			if (_page == page)
			{
				Draw(val, new Color(0.09f, 0.16f, 0.18f, 1f));
			}
			if (GUI.Button(val, label, _tab))
			{
				_page = page;
			}
		}

		private void DrawPage(Rect r)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004f: Unknown result type (might be due to invalid IL or missing references)
			switch (_page)
			{
			case Page.Home:
				DrawHome(r);
				break;
			case Page.Loot:
				DrawLoot(r);
				break;
			case Page.Notes:
				DrawNotes(r);
				break;
			case Page.Lobby:
				DrawLobby(r);
				break;
			case Page.Navigate:
				DrawNavigation(r);
				break;
			case Page.Recap:
				DrawRecap(r);
				break;
			}
		}

		private void DrawHome(Rect r)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			GUI.Label(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).y + 18f, ((Rect)(ref r)).width - 44f, 30f), "Your run, in one place.", _subTitle);
			GUI.Label(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).y + 48f, ((Rect)(ref r)).width - 44f, 40f), "Companion tools use information already available to your game client. Nothing is sent to other players.", _text);
			FeatureRow(r, 104f, "Loot Log", "Note valuables you look at", _lootEnabled);
			FeatureRow(r, 163f, "Quick Notes", "Private notes saved on this computer", _notesEnabled);
			FeatureRow(r, 222f, "Lobby Info", "Local player roster", _lobbyEnabled);
			FeatureRow(r, 281f, "Navigation", "Compass, coordinates, and waypoint", _navigationEnabled);
			FeatureRow(r, 340f, "Round Recap", "Local session time and run totals", _recapEnabled);
			GUI.Label(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).yMax - 48f, ((Rect)(ref r)).width - 44f, 26f), "Use the left tabs to open each tool. Features can be switched on or off here.", _muted);
		}

		private void FeatureRow(Rect r, float y, string name, string detail, ConfigEntry<bool> setting)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(((Rect)(ref r)).x + 20f, ((Rect)(ref r)).y + y, ((Rect)(ref r)).width - 40f, 48f);
			Draw(rect, new Color(0.065f, 0.09f, 0.11f, 1f));
			GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 5f, ((Rect)(ref rect)).width - 115f, 20f), name, _text);
			GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 25f, ((Rect)(ref rect)).width - 115f, 18f), detail, _muted);
			if (GUI.Button(new Rect(((Rect)(ref rect)).xMax - 96f, ((Rect)(ref rect)).y + 8f, 84f, 32f), setting.Value ? "ON" : "OFF", _button))
			{
				setting.Value = !setting.Value;
			}
		}

		private void DrawLoot(Rect r)
		{
			//IL_0001: 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_0055: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			Header(r, "LOOT LOG", "Valuables you personally look at · local only", _lootEnabled.Value);
			if (FeatureMessage(r, _lootEnabled.Value))
			{
				if (GUI.Button(new Rect(((Rect)(ref r)).xMax - 112f, ((Rect)(ref r)).y + 18f, 90f, 30f), "CLEAR", _button))
				{
					_loot.Clear();
				}
				GUI.Label(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).y + 88f, ((Rect)(ref r)).width - 44f, 22f), (_loot.Count == 0) ? "Look at a valuable to add it to this session's log." : (_loot.Count + " valuables noted this session"), _muted);
				int num = Mathf.Min(_loot.Count, 12);
				for (int i = 0; i < num; i++)
				{
					LootEntry lootEntry = _loot[i];
					float num2 = ((Rect)(ref r)).y + 124f + (float)(i * 27);
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, num2, ((Rect)(ref r)).width - 48f, 24f), (i + 1).ToString("00") + "   " + lootEntry.Name + "     X " + Mathf.RoundToInt(lootEntry.Position.x) + "   Z " + Mathf.RoundToInt(lootEntry.Position.z), _text);
				}
			}
		}

		private void DrawNotes(Rect r)
		{
			//IL_0001: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			Header(r, "QUICK NOTES", "Private notes saved in this profile's local config", _notesEnabled.Value);
			if (FeatureMessage(r, _notesEnabled.Value))
			{
				_notes = GUI.TextArea(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).y + 92f, ((Rect)(ref r)).width - 44f, ((Rect)(ref r)).height - 120f), _notes ?? "", 1200, _notesStyle);
			}
		}

		private void DrawLobby(Rect r)
		{
			//IL_0001: 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_0070: 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)
			Header(r, "LOBBY INFO", "Player roster visible to your local game client", _lobbyEnabled.Value);
			if (!FeatureMessage(r, _lobbyEnabled.Value))
			{
				return;
			}
			List<PlayerAvatar> list = SemiFunc.PlayerGetAll();
			int num = list?.Count ?? 0;
			GUI.Label(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).y + 88f, ((Rect)(ref r)).width - 44f, 24f), num + ((num == 1) ? " player in this session" : " players in this session"), _subTitle);
			int num2 = Mathf.Min(num, 12);
			for (int i = 0; i < num2; i++)
			{
				PlayerAvatar val = list[i];
				if (!((Object)(object)val == (Object)null))
				{
					string text = SemiFunc.PlayerGetName(val);
					if (string.IsNullOrEmpty(text))
					{
						text = "Player " + (i + 1);
					}
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 126f + (float)(i * 28), ((Rect)(ref r)).width - 48f, 24f), "•  " + text, _text);
				}
			}
		}

		private void DrawNavigation(Rect r)
		{
			//IL_0001: 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_007b: 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_009c: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: 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_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: 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_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			Header(r, "NAVIGATION", "Local direction, coordinates, and a personal waypoint", _navigationEnabled.Value);
			if (!FeatureMessage(r, _navigationEnabled.Value))
			{
				return;
			}
			PlayerAvatar val = SemiFunc.PlayerGetLocal();
			Camera main = Camera.main;
			if ((Object)(object)val == (Object)null || (Object)(object)main == (Object)null)
			{
				GUI.Label(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).y + 98f, ((Rect)(ref r)).width - 44f, 28f), "Navigation appears when you are in a run.", _muted);
				return;
			}
			Vector3 position = ((Component)val).transform.position;
			float num = (((Component)main).transform.eulerAngles.y + 360f) % 360f;
			GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 94f, ((Rect)(ref r)).width - 48f, 42f), Direction(num) + "   " + Mathf.RoundToInt(num) + "°", _subTitle);
			GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 140f, ((Rect)(ref r)).width - 48f, 26f), "X " + Mathf.RoundToInt(position.x) + "     Y " + Mathf.RoundToInt(position.y) + "     Z " + Mathf.RoundToInt(position.z), _text);
			if (GUI.Button(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 188f, 160f, 36f), "SET WAYPOINT HERE", _button))
			{
				_waypoint = position;
				_hasWaypoint = true;
			}
			if (GUI.Button(new Rect(((Rect)(ref r)).x + 194f, ((Rect)(ref r)).y + 188f, 125f, 36f), "CLEAR", _button))
			{
				_hasWaypoint = false;
			}
			if (_hasWaypoint)
			{
				Vector3 val2 = _waypoint - position;
				Vector3 val3 = ((Component)main).transform.InverseTransformDirection(val2);
				float yaw = Mathf.Atan2(val3.x, val3.z) * 57.29578f;
				GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 246f, ((Rect)(ref r)).width - 48f, 36f), "WAYPOINT   " + Direction(yaw) + "   " + Mathf.RoundToInt(((Vector3)(ref val2)).magnitude) + " m", _text);
				GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 282f, ((Rect)(ref r)).width - 48f, 24f), "X " + Mathf.RoundToInt(_waypoint.x) + "     Y " + Mathf.RoundToInt(_waypoint.y) + "     Z " + Mathf.RoundToInt(_waypoint.z), _muted);
			}
			else
			{
				GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 246f, ((Rect)(ref r)).width - 48f, 28f), "No waypoint set. Choose SET WAYPOINT HERE at a spot.", _muted);
			}
		}

		private void DrawRecap(Rect r)
		{
			//IL_0001: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: 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_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			Header(r, "ROUND RECAP", "Session summary · values observed by your local client", _recapEnabled.Value);
			if (FeatureMessage(r, _recapEnabled.Value))
			{
				if (_wasInRun)
				{
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 96f, ((Rect)(ref r)).width - 48f, 28f), "A run is in progress", _subTitle);
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 142f, ((Rect)(ref r)).width - 48f, 26f), "Current area: " + _lastArea, _text);
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 178f, ((Rect)(ref r)).width - 48f, 26f), "Levels completed: " + _lastLevels, _text);
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 214f, ((Rect)(ref r)).width - 48f, 26f), "Run haul: $" + _lastHaul, _text);
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 250f, ((Rect)(ref r)).width - 48f, 26f), "Session time: " + Format(_runElapsed), _text);
				}
				else if (_hasRecap)
				{
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 96f, ((Rect)(ref r)).width - 48f, 28f), "Last run summary", _subTitle);
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 142f, ((Rect)(ref r)).width - 48f, 26f), "Last area: " + _lastArea, _text);
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 178f, ((Rect)(ref r)).width - 48f, 26f), "Levels completed: " + _lastLevels, _text);
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 214f, ((Rect)(ref r)).width - 48f, 26f), "Run haul: $" + _lastHaul, _text);
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 250f, ((Rect)(ref r)).width - 48f, 26f), "Session time: " + Format(_lastRunElapsed), _text);
				}
				else
				{
					GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 100f, ((Rect)(ref r)).width - 48f, 30f), "Start a run to collect a local recap.", _muted);
				}
			}
		}

		private void Header(Rect r, string title, string subtitle, bool enabled)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			GUI.Label(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).y + 18f, ((Rect)(ref r)).width - 44f, 28f), title, _subTitle);
			GUI.Label(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).y + 49f, ((Rect)(ref r)).width - 44f, 24f), subtitle, _muted);
			if (!enabled)
			{
				GUI.Label(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).y + 73f, ((Rect)(ref r)).width - 44f, 20f), "This feature is turned off in Overview.", _muted);
			}
		}

		private bool FeatureMessage(Rect r, bool enabled)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (enabled)
			{
				return true;
			}
			GUI.Label(new Rect(((Rect)(ref r)).x + 22f, ((Rect)(ref r)).y + 112f, ((Rect)(ref r)).width - 44f, 28f), "Turn it back on from the Overview tab.", _muted);
			return false;
		}

		private void EnsureStyles()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0071: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_0145: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_017c: Expected O, but got Unknown
			if (_title == null)
			{
				_title = new GUIStyle(GUI.skin.label)
				{
					fontSize = 22,
					fontStyle = (FontStyle)1
				};
				_title.normal.textColor = Mint;
				_subTitle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 17,
					fontStyle = (FontStyle)1
				};
				_subTitle.normal.textColor = Pale;
				_text = new GUIStyle(GUI.skin.label)
				{
					fontSize = 14,
					wordWrap = true
				};
				_text.normal.textColor = Pale;
				_muted = new GUIStyle(GUI.skin.label)
				{
					fontSize = 12,
					wordWrap = true
				};
				_muted.normal.textColor = Dim;
				_button = new GUIStyle(GUI.skin.button)
				{
					fontSize = 12,
					fontStyle = (FontStyle)1
				};
				_tab = new GUIStyle(GUI.skin.button)
				{
					fontSize = 12,
					alignment = (TextAnchor)3,
					padding = new RectOffset(12, 6, 4, 4)
				};
				_notesStyle = new GUIStyle(GUI.skin.textArea)
				{
					fontSize = 14,
					wordWrap = true,
					padding = new RectOffset(12, 12, 10, 10)
				};
			}
		}

		private void SaveNotes()
		{
			_savedNotes.Value = (((_notes ?? "").Length > 1200) ? _notes.Substring(0, 1200) : (_notes ?? ""));
		}

		private void Draw(Rect rect, Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Color color2 = GUI.color;
			GUI.color = color;
			GUI.DrawTexture(rect, (Texture)(object)_pixel);
			GUI.color = color2;
		}

		private static string Direction(float yaw)
		{
			string[] array = new string[8] { "N", "NE", "E", "SE", "S", "SW", "W", "NW" };
			return array[Mathf.RoundToInt((yaw + 360f) / 45f) % array.Length];
		}

		private static string Format(float time)
		{
			int num = Mathf.Max(0, Mathf.FloorToInt(time));
			return (num / 3600).ToString("00") + ":" + (num / 60 % 60).ToString("00") + ":" + (num % 60).ToString("00");
		}

		private void OnDestroy()
		{
			SaveNotes();
			if (_open)
			{
				SetOpen(open: false);
			}
			if ((Object)(object)_pixel != (Object)null)
			{
				Object.Destroy((Object)(object)_pixel);
			}
		}
	}
}