Decompiled source of OneForAll v1.0.3

BepInEx/plugins/OneForAllDEV.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using OneForAll.Heal.Patches;
using OneForAll.Horn.Coroutines;
using OneForAll.Horn.Manager;
using OneForAll.MiniMap.Component;
using OneForAll.MiniMap.Patches;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
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("OneForAllDEV")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OneForAllDEV")]
[assembly: AssemblyTitle("OneForAllDEV")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace OneForAll.Skip
{
	[BepInPlugin("FraZy.OneForAll.Skip", "OneForAll.Skip", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private static Plugin instance;

		private void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			instance = this;
			_harmony = new Harmony("FraZy.OneForAll.Skip");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"OneForAll.Skip loaded");
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FraZy.OneForAll.Skip";

		public const string PLUGIN_NAME = "OneForAll.Skip";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}
namespace OneForAll.Skip.Patches
{
	[HarmonyPatch]
	internal class SkipToMultiplayerMenuPatcher
	{
		private static bool skippedPreInitScene;

		private static bool skippedInitScene;

		[HarmonyPatch(typeof(PreInitSceneScript), "Awake")]
		[HarmonyPrefix]
		public static bool InitializeGameManager()
		{
			if (skippedPreInitScene)
			{
				return true;
			}
			skippedPreInitScene = true;
			Plugin.Log("Loading GameManager in InitScene.");
			SceneManager.LoadScene("InitScene");
			return false;
		}

		[HarmonyPatch(typeof(InitializeGame), "Start")]
		[HarmonyPrefix]
		public static bool LoadMultiplayerMenuScene()
		{
			if (skippedInitScene)
			{
				return true;
			}
			skippedInitScene = true;
			Plugin.Log("Skipping to Multiplayer MainMenu scene.");
			SceneManager.LoadScene("MainMenu");
			return false;
		}
	}
}
namespace OneForAll.Restart
{
	[BepInPlugin("FraZy-OneForAll.Restart", "OneForAll.Restart", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		public static bool verifying;

		private ConfigEntry<bool> overrideConfirmation;

		public static bool bypassConfirm;

		private Harmony harmony;

		private static MethodInfo chat;

		private void Awake()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			overrideConfirmation = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "Override Confirmation", true, "Ignore the confirmation step of restarting.");
			bypassConfirm = overrideConfirmation.Value;
			harmony = new Harmony("FraZy-OneForAll.Restart");
			harmony.PatchAll();
			chat = AccessTools.Method(typeof(HUDManager), "AddChatMessage", (Type[])null, (Type[])null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"OneForAll.Restart loaded!");
		}

		public static void SendChatMessage(string message)
		{
			chat?.Invoke(HUDManager.Instance, new object[2] { message, "" });
			HUDManager.Instance.lastChatMessage = "";
		}

		public static void ConfirmRestart()
		{
			verifying = true;
			SendChatMessage("Are you sure? Type CONFIRM or DENY.");
		}

		public static void AcceptRestart(StartOfRound manager)
		{
			SendChatMessage("Restarting Soon...Please Wait...");
			verifying = false;
			int[] array = new int[4]
			{
				manager.gameStats.daysSpent,
				manager.gameStats.scrapValueCollected,
				manager.gameStats.deaths,
				manager.gameStats.allStepsTaken
			};
			manager.FirePlayersAfterDeadlineClientRpc(array, false);
		}

		public static void DeclineRestart()
		{
			SendChatMessage("Restart aborted. You Scared?");
			verifying = false;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "OneForAll.Restart";

		public const string PLUGIN_NAME = "OneForAll.Restart";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}
namespace OneForAll.Restart.Patches
{
	[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
	public class SubmitChat
	{
		private static bool Prefix(HUDManager __instance, ref CallbackContext context)
		{
			if (!((CallbackContext)(ref context)).performed || string.IsNullOrEmpty(__instance.chatTextField.text))
			{
				return true;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null)
			{
				return true;
			}
			StartOfRound playersManager = localPlayerController.playersManager;
			if ((Object)(object)playersManager == (Object)null)
			{
				return true;
			}
			string text = __instance.chatTextField.text;
			if (Plugin.verifying)
			{
				if (text.ToLower() == "confirm")
				{
					ResetTextbox(__instance, localPlayerController);
					if (!localPlayerController.isInHangarShipRoom || !playersManager.inShipPhase || playersManager.travellingToNewLevel)
					{
						Plugin.SendChatMessage("nice try! you can't restart session on a planet, please ship back to orbit.");
						return false;
					}
					Plugin.AcceptRestart(playersManager);
					return false;
				}
				if (text.ToLower() == "deny")
				{
					return true;
				}
				ResetTextbox(__instance, localPlayerController);
				Plugin.DeclineRestart();
				return false;
			}
			if (text == "!restart")
			{
				return true;
			}
			ResetTextbox(__instance, localPlayerController);
			if (!GameNetworkManager.Instance.isHostingGame)
			{
				Plugin.SendChatMessage("quiting already? ask the host to restart lobby. type /restart or !restart");
				return false;
			}
			if (!localPlayerController.isInHangarShipRoom || !playersManager.inShipPhase || playersManager.travellingToNewLevel)
			{
				Plugin.SendChatMessage("Cannot restart, ship must be in orbit.");
				return false;
			}
			if (Plugin.bypassConfirm)
			{
				Plugin.AcceptRestart(playersManager);
			}
			else
			{
				Plugin.ConfirmRestart();
			}
			return false;
		}

		private static void ResetTextbox(HUDManager manager, PlayerControllerB local)
		{
			local.isTypingChat = false;
			manager.chatTextField.text = "";
			EventSystem.current.SetSelectedGameObject((GameObject)null);
			manager.PingHUDElement(manager.Chat, 2f, 1f, 0.2f);
			((Behaviour)manager.typingIndicator).enabled = false;
		}
	}
}
namespace OneForAll.Remover
{
	[HarmonyPatch(typeof(HUDManager), "DisplayTip")]
	public static class DisplayTipPatch
	{
		public static bool Prefix(HUDManager __instance, string headerText, string bodyText, bool isWarning = false, bool useSave = false, string prefsKey = "LC_Tip1")
		{
			if (headerText.StartsWith("Mod List"))
			{
				return false;
			}
			return true;
		}
	}
	public static class PluginInfo
	{
		private const string GUID = "FraZy.OneForAll.Remover";

		private const string NAME = "OneForAll.Remover";

		private const string VERSION = "1.0.3";
	}
}
namespace OneForAll.Remover.Patches
{
	internal class Patches
	{
		private static ManualLogSource Logger { get; set; }

		public static void Init(ManualLogSource logger)
		{
			Logger = logger;
		}
	}
}
namespace OneForAll.MiniMap
{
	public class HostSettingsToSync
	{
		public bool ShowLoots { get; set; }

		public bool ShowEnemies { get; set; }

		public bool ShowLivePlayers { get; set; }

		public bool ShowDeadPlayers { get; set; }

		public bool ShowRadarBoosters { get; set; }

		public bool ShowTerminalCodes { get; set; }

		public HostSettingsToSync()
		{
			ShowLoots = true;
			ShowEnemies = true;
			ShowLivePlayers = true;
			ShowDeadPlayers = true;
			ShowRadarBoosters = true;
			ShowTerminalCodes = true;
		}

		public void Sync()
		{
			MinimapMod.minimapGUI.showLoots = ShowLoots;
			MinimapMod.minimapGUI.showEnemies = ShowEnemies;
			MinimapMod.minimapGUI.showLivePlayers = ShowLivePlayers;
			MinimapMod.minimapGUI.showDeadPlayers = ShowDeadPlayers;
			MinimapMod.minimapGUI.showRadarBoosters = ShowRadarBoosters;
			MinimapMod.minimapGUI.showTerminalCodes = ShowTerminalCodes;
		}

		public bool IsSync()
		{
			return MinimapMod.minimapGUI.showLoots == ShowLoots && MinimapMod.minimapGUI.showEnemies == ShowEnemies && MinimapMod.minimapGUI.showLivePlayers == ShowLivePlayers && MinimapMod.minimapGUI.showDeadPlayers == ShowDeadPlayers && MinimapMod.minimapGUI.showRadarBoosters == ShowRadarBoosters && MinimapMod.minimapGUI.showTerminalCodes == ShowTerminalCodes;
		}

		public static HostSettingsToSync Parse(string data)
		{
			if (string.IsNullOrEmpty(data))
			{
				return null;
			}
			string[] array = data.Split(';');
			if (array.Length != 6)
			{
				return null;
			}
			HostSettingsToSync hostSettingsToSync = new HostSettingsToSync();
			HashSet<string> hashSet = new HashSet<string> { "loots", "enemies", "livePlayers", "deadPlayers", "radarBoosters", "terminalCodes" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				char[] separator = new char[1] { '=' };
				string[] array3 = text.Split(separator);
				if (array3.Length != 2)
				{
					return null;
				}
				string text2 = array3[0].Trim();
				string text3 = array3[1].Trim();
				if (!hashSet.Remove(text2))
				{
					return null;
				}
				string text4 = text3;
				string text5 = text4;
				bool flag;
				if (!(text5 == "show"))
				{
					if (!(text5 == "hide"))
					{
						return null;
					}
					flag = false;
				}
				else
				{
					flag = true;
				}
				switch (text2)
				{
				case "loots":
					hostSettingsToSync.ShowLoots = flag;
					break;
				case "enemies":
					hostSettingsToSync.ShowEnemies = flag;
					break;
				case "livePlayers":
					hostSettingsToSync.ShowLivePlayers = flag;
					break;
				case "deadPlayers":
					hostSettingsToSync.ShowDeadPlayers = flag;
					break;
				case "radarBoosters":
					hostSettingsToSync.ShowRadarBoosters = flag;
					break;
				case "terminalCodes":
					hostSettingsToSync.ShowTerminalCodes = flag;
					break;
				default:
					return null;
				}
			}
			return (hashSet.Count > 0) ? null : hostSettingsToSync;
		}
	}
	public class HotkeyManager
	{
		public ModHotkey[] AllHotkeys;

		public HotkeyManager(int numberOfHotkeys)
		{
			AllHotkeys = new ModHotkey[numberOfHotkeys];
		}

		public bool AnyHotkeyIsSettingKey()
		{
			ModHotkey[] allHotkeys = AllHotkeys;
			foreach (ModHotkey modHotkey in allHotkeys)
			{
				if (modHotkey.IsSettingKey)
				{
					return true;
				}
			}
			return false;
		}

		private static MouseAndKeyboard ConvertToExtendedKey(Key key)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			foreach (MouseAndKeyboard value in Enum.GetValues(typeof(MouseAndKeyboard)))
			{
				if (Enum.GetName(typeof(Key), key) == Enum.GetName(typeof(MouseAndKeyboard), value))
				{
					return value;
				}
			}
			return MouseAndKeyboard.None;
		}

		public bool SetHotKey(Key key)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return SetHotKey(ConvertToExtendedKey(key));
		}

		public bool SetHotKey(MouseAndKeyboard key)
		{
			ModHotkey[] allHotkeys = AllHotkeys;
			foreach (ModHotkey modHotkey in allHotkeys)
			{
				if (modHotkey.IsSettingKey)
				{
					modHotkey.Key = key;
					ResetIsSettingKey();
					return true;
				}
			}
			return false;
		}

		public void ResetIsSettingKey()
		{
			ModHotkey[] allHotkeys = AllHotkeys;
			foreach (ModHotkey modHotkey in allHotkeys)
			{
				modHotkey.IsSettingKey = false;
			}
		}

		public void ResetSettingKey()
		{
			ModHotkey[] allHotkeys = AllHotkeys;
			foreach (ModHotkey modHotkey in allHotkeys)
			{
				modHotkey.IsSettingKey = false;
			}
		}

		public void ResetToDefaultKey()
		{
			ModHotkey[] allHotkeys = AllHotkeys;
			foreach (ModHotkey modHotkey in allHotkeys)
			{
				modHotkey.Key = modHotkey.DefaultKey;
			}
		}

		public void Update()
		{
			ModHotkey[] allHotkeys = AllHotkeys;
			foreach (ModHotkey modHotkey in allHotkeys)
			{
				modHotkey.Update();
			}
		}
	}
	[BepInPlugin("FraZy.OneForAll.MiniMap", "OneForAll.MiniMap", "1.0.3")]
	public class MinimapMod : BaseUnityPlugin
	{
		public const string modGUID = "FraZy.OneForAll.MiniMap";

		public const string modName = "OneForAll.MiniMap";

		public const string modVersion = "1.0.3";

		public static MouseAndKeyboard defaultGuiKey = MouseAndKeyboard.F1;

		public static MouseAndKeyboard defaultToggleMinimapKey = MouseAndKeyboard.F2;

		public static MouseAndKeyboard defaultToggleOverrideKey = MouseAndKeyboard.F3;

		public static MouseAndKeyboard defaultSwitchTargetKey = MouseAndKeyboard.F4;

		public const int defaultMinimapSize = 129;

		public const float defaultXoffset = -6.944445f;

		public const float defaultYoffset = -6.944445f;

		public const float defaultMapZoom = 19.7f;

		public const float defaultBrightness = 0f;

		private static ConfigEntry<MouseAndKeyboard> guiKeyConfig;

		private static ConfigEntry<MouseAndKeyboard> toggleMinimapKeyConfig;

		private static ConfigEntry<MouseAndKeyboard> toggleOverrideKeyConfig;

		private static ConfigEntry<MouseAndKeyboard> switchTargetKeyConfig;

		private static ConfigEntry<bool> enableMinimapConfig;

		private static ConfigEntry<bool> autoRotateConfig;

		private static ConfigEntry<int> minimapSizeConfig;

		private static ConfigEntry<float> minimapXPosConfig;

		private static ConfigEntry<float> minimapYPosConfig;

		private static ConfigEntry<float> minimapZoomConfig;

		private static ConfigEntry<float> brightnessConfig;

		private static ConfigEntry<bool> showLootsConfig;

		private static ConfigEntry<bool> showEnemiesConfig;

		private static ConfigEntry<bool> showLivePlayersConfig;

		private static ConfigEntry<bool> showDeadPlayersConfig;

		private static ConfigEntry<bool> showRadarBoostersConfig;

		private static ConfigEntry<bool> showTerminalCodesConfig;

		private static ConfigEntry<bool> showShipArrowConfig;

		private static ConfigEntry<bool> freezePlayerIndexConfig;

		public static MinimapMod Instance;

		public static ManualLogSource mls;

		private readonly Harmony harmony = new Harmony("FraZy.OneForAll.MiniMap");

		public static MinimapGUI minimapGUI;

		private void Awake()
		{
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("FraZy.OneForAll.Minimap");
			mls.LogInfo((object)"Minimap 1.0.3 loaded!");
			VersionChecker.GetLatestVersionAsync();
			harmony.PatchAll(typeof(ManualCameraRendererPatch));
			harmony.PatchAll(typeof(QuickMenuManagerPatch));
			harmony.PatchAll(typeof(ShipTeleporterPatch));
			harmony.PatchAll(typeof(GrabbableObjectPatch));
			harmony.PatchAll(typeof(TerminalAccessibleObjectPatch));
			harmony.PatchAll(typeof(EnemyAIPatch));
			harmony.PatchAll(typeof(OneForAll.MiniMap.Patches.PlayerControllerBPatch));
			harmony.PatchAll(typeof(RadarBoosterItemPatch));
			harmony.PatchAll(typeof(HUDManagerPatch));
			harmony.PatchAll(typeof(TimeOfDayPatch));
			harmony.PatchAll(typeof(DeadBodyInfoPatch));
			GameObject val = new GameObject("MinimapGUI");
			Object.DontDestroyOnLoad((Object)(object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<MinimapGUI>();
			minimapGUI = (MinimapGUI)(object)val.GetComponent("MinimapGUI");
			SetBindings();
			SyncGUIFromConfigs();
		}

		private void SetBindings()
		{
			guiKeyConfig = ((BaseUnityPlugin)this).Config.Bind<MouseAndKeyboard>("Hotkeys", "Open Mod Menu", defaultGuiKey, "Hotkey to open the Minimap mod menu");
			toggleMinimapKeyConfig = ((BaseUnityPlugin)this).Config.Bind<MouseAndKeyboard>("Hotkeys", "Toggle Minimap", defaultToggleMinimapKey, "Hotkey to toggle the visibility of your Minimap");
			toggleOverrideKeyConfig = ((BaseUnityPlugin)this).Config.Bind<MouseAndKeyboard>("Hotkeys", "Toggle Override Ship", defaultToggleOverrideKey, "Hotkey to toggle the override ship controls");
			switchTargetKeyConfig = ((BaseUnityPlugin)this).Config.Bind<MouseAndKeyboard>("Hotkeys", "Switch Minimap Focus", defaultSwitchTargetKey, "Hotkey to switch the Minimap focus");
			enableMinimapConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Basic Settings", "Enable Minimap", true, "Toggles visibility of your Minimap");
			autoRotateConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Basic Settings", "Auto Rotate", true, "Auto-rotate the Map based on where you are facing");
			minimapSizeConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Basic Settings", "Minimap Size", 129, "Adjusts the size of your Minimap");
			minimapXPosConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Basic Settings", "X Offset", -6.944445f, "Shifts the Minimap position horizontally");
			minimapYPosConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Basic Settings", "Y Offset", -6.944445f, "Shifts the Minimap position vertically");
			minimapZoomConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Basic Settings", "Map Zoom", 19.7f, "Adjust the Map zoom level");
			brightnessConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Basic Settings", "Brightness", 0f, "Adjust the brightness level");
			showLootsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Minimap Icons", "Show Loots", true, "Toggles visibility of loots (small triangles) on your Minimap");
			showEnemiesConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Minimap Icons", "Show Enemies", true, "Toggles visibility of enemies (red circles) on your Minimap");
			showLivePlayersConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Minimap Icons", "Show Live Players", true, "Toggles visibility of live players (cyan circles) on your Minimap");
			showDeadPlayersConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Minimap Icons", "Show Dead Players", true, "Toggles visibility of dead players (greyed-out cyan circles) on your Minimap");
			showRadarBoostersConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Minimap Icons", "Show Radar Boosters", true, "Toggles visibility of radar boosters (blue circles) on your Minimap");
			showTerminalCodesConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Minimap Icons", "Show Terminal Codes", true, "Toggles visibility of terminal codes on your Minimap");
			showShipArrowConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Minimap Icons", "Show Ship Arrow", true, "Toggles visibility of the arrow pointing to the Ship");
			freezePlayerIndexConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Advance Settings", "Override Ship Controls", false, "Disables the ability to change the Minimap focus through the ship control panel, allowing Minimap focus changes only through the mod menu");
		}

		public void SyncGUIFromConfigs()
		{
			minimapGUI.guiKey.Key = guiKeyConfig.Value;
			minimapGUI.toggleMinimapKey.Key = toggleMinimapKeyConfig.Value;
			minimapGUI.toggleOverrideKey.Key = toggleOverrideKeyConfig.Value;
			minimapGUI.switchTargetKey.Key = switchTargetKeyConfig.Value;
			minimapGUI.enableMinimap = enableMinimapConfig.Value;
			minimapGUI.autoRotate = autoRotateConfig.Value;
			minimapGUI.minimapSize = minimapSizeConfig.Value;
			minimapGUI.minimapXPos = minimapXPosConfig.Value;
			minimapGUI.minimapYPos = minimapYPosConfig.Value;
			minimapGUI.minimapZoom = minimapZoomConfig.Value;
			minimapGUI.brightness = brightnessConfig.Value;
			minimapGUI.showLoots = showLootsConfig.Value;
			minimapGUI.showEnemies = showEnemiesConfig.Value;
			minimapGUI.showLivePlayers = showLivePlayersConfig.Value;
			minimapGUI.showDeadPlayers = showDeadPlayersConfig.Value;
			minimapGUI.showRadarBoosters = showRadarBoostersConfig.Value;
			minimapGUI.showTerminalCodes = showTerminalCodesConfig.Value;
			minimapGUI.showShipArrow = showShipArrowConfig.Value;
			minimapGUI.freezePlayerIndex = freezePlayerIndexConfig.Value;
		}

		public void SyncConfigFromGUI()
		{
			guiKeyConfig.Value = minimapGUI.guiKey.Key;
			toggleMinimapKeyConfig.Value = minimapGUI.toggleMinimapKey.Key;
			toggleOverrideKeyConfig.Value = minimapGUI.toggleOverrideKey.Key;
			switchTargetKeyConfig.Value = minimapGUI.switchTargetKey.Key;
			enableMinimapConfig.Value = minimapGUI.enableMinimap;
			autoRotateConfig.Value = minimapGUI.autoRotate;
			minimapSizeConfig.Value = minimapGUI.minimapSize;
			minimapXPosConfig.Value = minimapGUI.minimapXPos;
			minimapYPosConfig.Value = minimapGUI.minimapYPos;
			minimapZoomConfig.Value = minimapGUI.minimapZoom;
			brightnessConfig.Value = minimapGUI.brightness;
			showLootsConfig.Value = minimapGUI.showLoots;
			showEnemiesConfig.Value = minimapGUI.showEnemies;
			showLivePlayersConfig.Value = minimapGUI.showLivePlayers;
			showDeadPlayersConfig.Value = minimapGUI.showDeadPlayers;
			showRadarBoostersConfig.Value = minimapGUI.showRadarBoosters;
			showTerminalCodesConfig.Value = minimapGUI.showTerminalCodes;
			showShipArrowConfig.Value = minimapGUI.showShipArrow;
			freezePlayerIndexConfig.Value = minimapGUI.freezePlayerIndex;
		}
	}
	public class ModHotkey
	{
		public MouseAndKeyboard DefaultKey { get; set; }

		public MouseAndKeyboard Key { get; set; }

		public bool KeyWasDown { get; set; }

		public bool IsSettingKey { get; set; }

		public Action OnKey { get; set; }

		public ModHotkey(MouseAndKeyboard defaultKey, Action onKey)
		{
			DefaultKey = defaultKey;
			Key = defaultKey;
			KeyWasDown = false;
			IsSettingKey = false;
			OnKey = onKey;
		}

		public void Update()
		{
			Mouse current = Mouse.current;
			Keyboard current2 = Keyboard.current;
			if (current != null && current2 != null)
			{
				ButtonControl val = (ButtonControl)(Key switch
				{
					MouseAndKeyboard.MouseBack => current.backButton, 
					MouseAndKeyboard.MouseForward => current.forwardButton, 
					MouseAndKeyboard.MouseRight => current.rightButton, 
					MouseAndKeyboard.MouseMiddle => current.middleButton, 
					MouseAndKeyboard.MouseLeft => current.leftButton, 
					_ => current2[(Key)Key], 
				});
				if (val.wasPressedThisFrame && !KeyWasDown && !IsSettingKey)
				{
					KeyWasDown = true;
				}
				if (val.wasReleasedThisFrame && KeyWasDown)
				{
					KeyWasDown = false;
					OnKey?.Invoke();
				}
			}
		}
	}
	public class ModUser
	{
		public string Version { get; set; }

		public bool Comply { get; set; }

		public ModUser(string version = null, bool comply = false)
		{
			Version = version;
			Comply = comply;
		}
	}
	public enum MouseAndKeyboard
	{
		MouseBack = -5,
		MouseForward = -4,
		MouseRight = -3,
		MouseMiddle = -2,
		MouseLeft = -1,
		None = 0,
		Space = 1,
		Enter = 2,
		Tab = 3,
		Backquote = 4,
		Quote = 5,
		Semicolon = 6,
		Comma = 7,
		Period = 8,
		Slash = 9,
		Backslash = 10,
		LeftBracket = 11,
		RightBracket = 12,
		Minus = 13,
		Equals = 14,
		A = 15,
		B = 16,
		C = 17,
		D = 18,
		E = 19,
		F = 20,
		G = 21,
		H = 22,
		I = 23,
		J = 24,
		K = 25,
		L = 26,
		M = 27,
		N = 28,
		O = 29,
		P = 30,
		Q = 31,
		R = 32,
		S = 33,
		T = 34,
		U = 35,
		V = 36,
		W = 37,
		X = 38,
		Y = 39,
		Z = 40,
		Digit1 = 41,
		Digit2 = 42,
		Digit3 = 43,
		Digit4 = 44,
		Digit5 = 45,
		Digit6 = 46,
		Digit7 = 47,
		Digit8 = 48,
		Digit9 = 49,
		Digit0 = 50,
		LeftShift = 51,
		RightShift = 52,
		LeftAlt = 53,
		AltGr = 54,
		RightAlt = 54,
		LeftCtrl = 55,
		RightCtrl = 56,
		LeftApple = 57,
		LeftCommand = 57,
		LeftMeta = 57,
		LeftWindows = 57,
		RightApple = 58,
		RightCommand = 58,
		RightMeta = 58,
		RightWindows = 58,
		ContextMenu = 59,
		Escape = 60,
		LeftArrow = 61,
		RightArrow = 62,
		UpArrow = 63,
		DownArrow = 64,
		Backspace = 65,
		PageDown = 66,
		PageUp = 67,
		Home = 68,
		End = 69,
		Insert = 70,
		Delete = 71,
		CapsLock = 72,
		NumLock = 73,
		PrintScreen = 74,
		ScrollLock = 75,
		Pause = 76,
		NumpadEnter = 77,
		NumpadDivide = 78,
		NumpadMultiply = 79,
		NumpadPlus = 80,
		NumpadMinus = 81,
		NumpadPeriod = 82,
		NumpadEquals = 83,
		Numpad0 = 84,
		Numpad1 = 85,
		Numpad2 = 86,
		Numpad3 = 87,
		Numpad4 = 88,
		Numpad5 = 89,
		Numpad6 = 90,
		Numpad7 = 91,
		Numpad8 = 92,
		Numpad9 = 93,
		F1 = 94,
		F2 = 95,
		F3 = 96,
		F4 = 97,
		F5 = 98,
		F6 = 99,
		F7 = 100,
		F8 = 101,
		F9 = 102,
		F10 = 103,
		F11 = 104,
		F12 = 105,
		OEM1 = 106,
		OEM2 = 107,
		OEM3 = 108,
		OEM4 = 109,
		OEM5 = 110,
		IMESelected = 111
	}
	public enum SettingAsHostAction
	{
		DontSync,
		SyncIcons
	}
	public enum SyncSettingsAction
	{
		AlwaysAsk,
		Allow,
		Deny
	}
	public class VersionChecker
	{
		public static string latestVersion;

		private static async Task<bool> GetVersionFromUrlAsync(string url)
		{
			using HttpClient client = new HttpClient();
			client.DefaultRequestHeaders.Add("User-Agent", BuildUserAgentString());
			try
			{
				latestVersion = ParseTagNameFromJson(await client.GetStringAsync(url));
				return true;
			}
			catch (Exception ex2)
			{
				Exception ex = ex2;
				MinimapMod.mls.LogError((object)("Failed to get the latest version from " + url + " for Minimap Mod. Error: " + ex.Message));
				return false;
			}
		}

		public static async Task GetLatestVersionAsync()
		{
			string mainUrl = "https://thunderstore.io/c/lethal-company/p/FraZy/OneForAll/versions/";
			string fallbackUrl = "https://api.github.com/repos/FraZy";
			if (!(await GetVersionFromUrlAsync(mainUrl)) && await GetVersionFromUrlAsync(fallbackUrl))
			{
			}
		}

		private static string ParseTagNameFromJson(string jsonString)
		{
			string text = "\"tag_name\":\"";
			int num = jsonString.IndexOf(text);
			if (num != -1)
			{
				int num2 = num + text.Length;
				int num3 = jsonString.IndexOf("\"", num2);
				if (num3 != -1)
				{
					return LStrip(jsonString.Substring(num2, num3 - num2), 'v');
				}
			}
			return null;
		}

		private static string LStrip(string input, char charToStrip)
		{
			int i;
			for (i = 0; i < input.Length && input[i] == charToStrip; i++)
			{
			}
			return input.Substring(i);
		}

		private static string BuildUserAgentString()
		{
			return "OneForAll/1.0.2 (" + GetOperatingSystemInfo() + "; " + (Environment.Is64BitOperatingSystem ? "x64" : "x86") + ")";
		}

		private static string GetOperatingSystemInfo()
		{
			if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
			{
				return $"Windows NT {Environment.OSVersion.Version}";
			}
			if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
			{
				return $"Mac OS X {Environment.OSVersion.Version}";
			}
			return RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? $"Linux {Environment.OSVersion.Version}" : $"Unknown OS {Environment.OSVersion.Version}";
		}
	}
}
namespace OneForAll.MiniMap.Component
{
	public class MinimapGUI : MonoBehaviour
	{
		private const int GUI_WIDTH = 500;

		private const int GUI_HEIGHT = 650;

		private const int ITEMWIDTH = 300;

		public ModHotkey guiKey = new ModHotkey(MinimapMod.defaultGuiKey, null);

		public ModHotkey toggleMinimapKey = new ModHotkey(MinimapMod.defaultToggleMinimapKey, null);

		public ModHotkey toggleOverrideKey = new ModHotkey(MinimapMod.defaultToggleOverrideKey, null);

		public ModHotkey switchTargetKey = new ModHotkey(MinimapMod.defaultSwitchTargetKey, null);

		public HotkeyManager hotkeyManager = new HotkeyManager(4);

		public bool enableMinimap;

		public bool autoRotate;

		public int minimapSize;

		public float minimapXPos;

		public float minimapYPos;

		public float minimapZoom;

		public float brightness;

		public bool showLoots;

		public bool showEnemies;

		public bool showLivePlayers;

		public bool showDeadPlayers;

		public bool showRadarBoosters;

		public bool showTerminalCodes;

		public bool showShipArrow;

		public bool freezePlayerIndex;

		private string[] navbarStr = new string[4] { "Minimap", "Icons", "Select Target", "Keybinds" };

		private readonly KeyboardShortcut escapeKey = new KeyboardShortcut((KeyCode)27, Array.Empty<KeyCode>());

		private int navbarIndex = 0;

		public bool isGUIOpen = false;

		private bool escKeyWasDown = false;

		public int playerIndex = 0;

		public int realPlayerIndex = 0;

		private bool lockPrefix = false;

		private string prefix = "MONITORING";

		private CursorLockMode lastCursorState = Cursor.lockState;

		private Vector2 scrollPos = Vector2.zero;

		private int validTargetCount = 0;

		public IDictionary<PlayerControllerB, ModUser> modUsers;

		private GUIStyle menuStyle;

		private GUIStyle buttonStyle;

		private GUIStyle labelStyle;

		private GUIStyle midLabelStyle;

		private GUIStyle tinyLabelStyle;

		private GUIStyle toggleStyle;

		private GUIStyle midToggleStyle;

		private void Awake()
		{
			MinimapMod.mls.LogInfo((object)"MinimapGUI loaded.");
			modUsers = new Dictionary<PlayerControllerB, ModUser>();
			guiKey.OnKey = ToggleGUI;
			toggleMinimapKey.OnKey = delegate
			{
				enableMinimap = !enableMinimap;
			};
			toggleOverrideKey.OnKey = delegate
			{
				freezePlayerIndex = !freezePlayerIndex;
			};
			switchTargetKey.OnKey = SwitchTarget;
			hotkeyManager.AllHotkeys[0] = guiKey;
			hotkeyManager.AllHotkeys[1] = toggleMinimapKey;
			hotkeyManager.AllHotkeys[2] = toggleOverrideKey;
			hotkeyManager.AllHotkeys[3] = switchTargetKey;
		}

		private Texture2D MakeTex(int width, int height, Color col)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = col;
			}
			Texture2D val = new Texture2D(width, height);
			val.SetPixels(array);
			val.Apply();
			return val;
		}

		public string GetPlayerNameAtIndex(int index)
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				return "n/a";
			}
			List<TransformAndName> radarTargets = StartOfRound.Instance.mapScreen.radarTargets;
			return (index < 0 || index >= radarTargets.Count) ? "n/a" : radarTargets[index].name;
		}

		public void SetMinimapTarget(int targetTransformIndex)
		{
			playerIndex = targetTransformIndex;
			StartOfRound.Instance.mapScreen.targetTransformIndex = playerIndex;
			StartOfRound.Instance.mapScreen.targetedPlayer = ((Component)StartOfRound.Instance.mapScreen.radarTargets[playerIndex].transform).gameObject.GetComponent<PlayerControllerB>();
			((TMP_Text)StartOfRound.Instance.mapScreenPlayerName).text = prefix + ": " + StartOfRound.Instance.mapScreen.radarTargets[playerIndex].name;
		}

		private void IntitializeMenu()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00b1: 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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: 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_01be: 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_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			if (menuStyle == null)
			{
				menuStyle = new GUIStyle(GUI.skin.box);
				buttonStyle = new GUIStyle(GUI.skin.button);
				labelStyle = new GUIStyle(GUI.skin.label);
				midLabelStyle = new GUIStyle(GUI.skin.label);
				tinyLabelStyle = new GUIStyle(GUI.skin.label);
				toggleStyle = new GUIStyle(GUI.skin.toggle);
				midToggleStyle = new GUIStyle(GUI.skin.toggle);
				menuStyle.normal.textColor = Color.white;
				menuStyle.normal.background = MakeTex(2, 2, new Color(0.19f, 0.2f, 0.22f, 0.9f));
				menuStyle.fontSize = 20;
				((Object)menuStyle.normal.background).hideFlags = (HideFlags)61;
				buttonStyle.normal.textColor = Color.white;
				buttonStyle.fontSize = 18;
				labelStyle.normal.textColor = Color.white;
				labelStyle.normal.background = MakeTex(2, 2, new Color(0.19f, 0.2f, 0.22f, 0f));
				labelStyle.fontSize = 18;
				labelStyle.alignment = (TextAnchor)4;
				((Object)labelStyle.normal.background).hideFlags = (HideFlags)61;
				midLabelStyle.normal.textColor = Color.white;
				midLabelStyle.normal.background = MakeTex(2, 2, new Color(0.19f, 0.2f, 0.22f, 0f));
				midLabelStyle.fontSize = 14;
				midLabelStyle.alignment = (TextAnchor)4;
				((Object)midLabelStyle.normal.background).hideFlags = (HideFlags)61;
				tinyLabelStyle.normal.textColor = Color.white;
				tinyLabelStyle.normal.background = MakeTex(2, 2, new Color(0.19f, 0.2f, 0.22f, 0f));
				tinyLabelStyle.fontSize = 11;
				tinyLabelStyle.alignment = (TextAnchor)4;
				((Object)tinyLabelStyle.normal.background).hideFlags = (HideFlags)61;
				toggleStyle.normal.textColor = Color.white;
				toggleStyle.fontSize = 18;
				midToggleStyle.normal.textColor = Color.white;
				midToggleStyle.fontSize = 14;
			}
		}

		public int CalculateValidTargetIndex(int setRadarTargetIndex)
		{
			List<TransformAndName> radarTargets = StartOfRound.Instance.mapScreen.radarTargets;
			if (radarTargets.Count <= setRadarTargetIndex)
			{
				setRadarTargetIndex = radarTargets.Count - 1;
			}
			for (int i = 0; i < radarTargets.Count; i++)
			{
				if (radarTargets[setRadarTargetIndex] == null)
				{
					setRadarTargetIndex = (setRadarTargetIndex + 1) % radarTargets.Count;
					continue;
				}
				PlayerControllerB component = ((Component)radarTargets[setRadarTargetIndex].transform).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && !component.isPlayerControlled && !component.isPlayerDead)
				{
					setRadarTargetIndex = (setRadarTargetIndex + 1) % radarTargets.Count;
					continue;
				}
				break;
			}
			return setRadarTargetIndex;
		}

		public void SwitchTarget()
		{
			List<TransformAndName> list = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.mapScreen.radarTargets : new List<TransformAndName>());
			if (freezePlayerIndex && list.Count >= 1)
			{
				SetMinimapTarget(CalculateValidTargetIndex((playerIndex + 1) % list.Count));
			}
		}

		private void ToggleGUI()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (!isGUIOpen)
			{
				isGUIOpen = true;
				Cursor.visible = true;
				lastCursorState = Cursor.lockState;
				Cursor.lockState = (CursorLockMode)2;
			}
			else
			{
				isGUIOpen = false;
				Cursor.visible = false;
				Cursor.lockState = lastCursorState;
			}
		}

		public void Update()
		{
			//IL_000e: 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_005f: 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)
			hotkeyManager.Update();
			KeyboardShortcut val = escapeKey;
			if (((KeyboardShortcut)(ref val)).IsDown())
			{
				escKeyWasDown = true;
				if (isGUIOpen)
				{
					if (hotkeyManager.AnyHotkeyIsSettingKey())
					{
						Cursor.lockState = (CursorLockMode)2;
					}
					else
					{
						isGUIOpen = false;
						Cursor.visible = false;
					}
				}
			}
			val = escapeKey;
			if (((KeyboardShortcut)(ref val)).IsUp() && escKeyWasDown)
			{
				escKeyWasDown = false;
			}
			if (freezePlayerIndex != lockPrefix && (Object)(object)StartOfRound.Instance != (Object)null)
			{
				lockPrefix = freezePlayerIndex;
				prefix = (freezePlayerIndex ? "LOCKED" : "MONITORING");
				((TMP_Text)StartOfRound.Instance.mapScreenPlayerName).text = prefix + ": " + StartOfRound.Instance.mapScreen.radarTargets[playerIndex].name;
			}
			if (!freezePlayerIndex && playerIndex != realPlayerIndex)
			{
				realPlayerIndex = CalculateValidTargetIndex(realPlayerIndex);
				SetMinimapTarget(realPlayerIndex);
			}
		}

		private static MouseAndKeyboard MouseWasPressedThisFrame()
		{
			Mouse current = Mouse.current;
			if (current == null || current.leftButton.wasPressedThisFrame)
			{
				return MouseAndKeyboard.None;
			}
			if (current.middleButton.wasPressedThisFrame)
			{
				return MouseAndKeyboard.MouseMiddle;
			}
			if (current.rightButton.wasPressedThisFrame)
			{
				return MouseAndKeyboard.MouseRight;
			}
			if (current.forwardButton.wasPressedThisFrame)
			{
				return MouseAndKeyboard.MouseForward;
			}
			return current.backButton.wasPressedThisFrame ? MouseAndKeyboard.MouseBack : MouseAndKeyboard.None;
		}

		public void OnGUI()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: 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_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: 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_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: 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_05a6: 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_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06af: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0828: Unknown result type (might be due to invalid IL or missing references)
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_0899: Unknown result type (might be due to invalid IL or missing references)
			//IL_090a: Unknown result type (might be due to invalid IL or missing references)
			//IL_094b: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a13: Unknown result type (might be due to invalid IL or missing references)
			if (menuStyle == null)
			{
				IntitializeMenu();
			}
			if (!isGUIOpen)
			{
				return;
			}
			float num = Screen.width / 2 - 250;
			float num2 = Screen.height / 2 - 325;
			float num3 = num + 100f;
			GUI.Box(new Rect(num, num2, 500f, 650f), "\nOneForAll Map\n", menuStyle);
			GUI.Label(new Rect(num3, num2 + 60f, 300f, 30f), "v1.0.3\t\t\tby FraZy", tinyLabelStyle);
			navbarIndex = GUI.Toolbar(new Rect(num, num2 - 30f, 500f, 30f), navbarIndex, navbarStr, buttonStyle);
			float num4 = num2 + 20f;
			switch (navbarIndex)
			{
			case 0:
				enableMinimap = GUI.Toggle(new Rect(num3, num4 + 90f, 300f, 30f), enableMinimap, "Toggle Minimap", toggleStyle);
				autoRotate = GUI.Toggle(new Rect(num3, num4 + 130f, 300f, 30f), autoRotate, "Auto Rotate Map", toggleStyle);
				GUI.Label(new Rect(num3, num4 + 170f, 300f, 30f), $"Minimap Size: {minimapSize}", labelStyle);
				minimapSize = (int)GUI.HorizontalSlider(new Rect(num3, num4 + 200f, 300f, 30f), (float)minimapSize, 0f, 1000f);
				GUI.Label(new Rect(num3, num4 + 220f, 300f, 30f), $"X Position Offset: {minimapXPos}", labelStyle);
				minimapXPos = GUI.HorizontalSlider(new Rect(num3, num4 + 250f, 300f, 30f), minimapXPos, -1000f, 1000f);
				GUI.Label(new Rect(num3, num4 + 270f, 300f, 30f), $"Y Position Offset: {minimapYPos}", labelStyle);
				minimapYPos = GUI.HorizontalSlider(new Rect(num3, num4 + 300f, 300f, 30f), minimapYPos, -1000f, 1000f);
				GUI.Label(new Rect(num3, num4 + 320f, 300f, 30f), $"Map Zoom: {minimapZoom}", labelStyle);
				minimapZoom = GUI.HorizontalSlider(new Rect(num3, num4 + 350f, 300f, 30f), minimapZoom, 0f, 80f);
				GUI.Label(new Rect(num3, num4 + 370f, 300f, 30f), $"Extra Brightness: {brightness}", labelStyle);
				brightness = GUI.HorizontalSlider(new Rect(num3, num4 + 400f, 300f, 30f), brightness, 0f, 50f);
				if (LeftClickButton(new Rect(num3, num4 + 440f, 300f, 30f), "Reset to Default Size"))
				{
					minimapSize = 200;
				}
				if (LeftClickButton(new Rect(num3, num4 + 480f, 300f, 30f), "Reset to Default Position"))
				{
					minimapXPos = 0f;
					minimapYPos = 0f;
				}
				if (LeftClickButton(new Rect(num3, num4 + 520f, 300f, 30f), "Reset to Default Zoom"))
				{
					minimapZoom = 19.7f;
				}
				if (LeftClickButton(new Rect(num3, num4 + 560f, 300f, 30f), "Reset to Default Brightness"))
				{
					brightness = 0f;
				}
				break;
			case 1:
				showLoots = GUI.Toggle(new Rect(num3, num4 + 90f, 300f, 30f), showLoots, "Show Loots", toggleStyle);
				showEnemies = GUI.Toggle(new Rect(num3, num4 + 130f, 300f, 30f), showEnemies, "Show Enemies", toggleStyle);
				showLivePlayers = GUI.Toggle(new Rect(num3, num4 + 170f, 300f, 30f), showLivePlayers, "Show Live Players", toggleStyle);
				showDeadPlayers = GUI.Toggle(new Rect(num3, num4 + 210f, 300f, 30f), showDeadPlayers, "Show Dead Players", toggleStyle);
				showRadarBoosters = GUI.Toggle(new Rect(num3, num4 + 250f, 300f, 30f), showRadarBoosters, "Show Radar Boosters", toggleStyle);
				showTerminalCodes = GUI.Toggle(new Rect(num3, num4 + 290f, 300f, 30f), showTerminalCodes, "Show Terminal Codes", toggleStyle);
				showShipArrow = GUI.Toggle(new Rect(num3, num4 + 330f, 300f, 30f), showShipArrow, "Show Ship Arrow", toggleStyle);
				break;
			case 2:
			{
				List<TransformAndName> list = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.mapScreen.radarTargets : new List<TransformAndName>());
				GUI.Label(new Rect(num3, num4 + 90f, 300f, 30f), "Selected Target: " + GetPlayerNameAtIndex(playerIndex), labelStyle);
				freezePlayerIndex = GUI.Toggle(new Rect(num3, num4 + 140f, 300f, 30f), freezePlayerIndex, "Override Ship Controls", toggleStyle);
				int num5 = 0;
				if (freezePlayerIndex)
				{
					float num6 = num4 + 180f;
					scrollPos = GUI.BeginScrollView(new Rect(num3, num6, 300f, 400f), scrollPos, new Rect(0f, 0f, 280f, (float)(40 * validTargetCount)));
					for (int i = 0; i < list.Count; i++)
					{
						PlayerControllerB component = ((Component)list[i].transform).gameObject.GetComponent<PlayerControllerB>();
						if (!((Object)(object)component != (Object)null) || component.isPlayerControlled || component.isPlayerDead)
						{
							if (LeftClickButton(new Rect(0f, (float)(40 * num5), 270f, 30f), list[i].name))
							{
								SetMinimapTarget(i);
							}
							num5++;
						}
					}
					GUI.EndScrollView();
				}
				validTargetCount = num5;
				break;
			}
			case 3:
			{
				string text = (guiKey.IsSettingKey ? "Press a Key..." : $"Open Mod Menu: {guiKey.Key}");
				if (LeftClickButton(new Rect(num3, num4 + 90f, 300f, 30f), text))
				{
					hotkeyManager.ResetSettingKey();
					guiKey.IsSettingKey = true;
				}
				string text2 = (toggleMinimapKey.IsSettingKey ? "Press a Key..." : $"Toggle Minimap: {toggleMinimapKey.Key}");
				if (LeftClickButton(new Rect(num3, num4 + 130f, 300f, 30f), text2))
				{
					hotkeyManager.ResetSettingKey();
					toggleMinimapKey.IsSettingKey = true;
				}
				string text3 = (toggleOverrideKey.IsSettingKey ? "Press a Key..." : $"Override Ship Controls: {toggleOverrideKey.Key}");
				if (LeftClickButton(new Rect(num3, num4 + 170f, 300f, 30f), text3))
				{
					hotkeyManager.ResetSettingKey();
					toggleOverrideKey.IsSettingKey = true;
				}
				string text4 = (switchTargetKey.IsSettingKey ? "Press a Key..." : $"Switch Minimap Target: {switchTargetKey.Key}");
				if (LeftClickButton(new Rect(num3, num4 + 210f, 300f, 30f), text4))
				{
					hotkeyManager.ResetSettingKey();
					switchTargetKey.IsSettingKey = true;
				}
				if (LeftClickButton(new Rect(num3, num4 + 280f, 300f, 30f), "Reset to Default Keybinds"))
				{
					hotkeyManager.ResetToDefaultKey();
				}
				if (!hotkeyManager.AnyHotkeyIsSettingKey())
				{
					break;
				}
				MouseAndKeyboard mouseAndKeyboard = MouseWasPressedThisFrame();
				if (mouseAndKeyboard != 0)
				{
					hotkeyManager.SetHotKey(mouseAndKeyboard);
				}
				else if (((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame)
				{
					hotkeyManager.ResetIsSettingKey();
				}
				else
				{
					if (!((ButtonControl)Keyboard.current.anyKey).wasPressedThisFrame)
					{
						break;
					}
					Enumerator<KeyControl> enumerator = Keyboard.current.allKeys.GetEnumerator();
					try
					{
						while (enumerator.MoveNext())
						{
							KeyControl current = enumerator.Current;
							if (((ButtonControl)current).wasPressedThisFrame && hotkeyManager.SetHotKey(current.keyCode))
							{
								break;
							}
						}
					}
					finally
					{
						((IDisposable)enumerator).Dispose();
					}
				}
				break;
			}
			}
			MinimapMod.Instance.SyncConfigFromGUI();
		}

		private bool LeftClickButton(Rect rect, string text, GUIStyle style = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_002a: 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_0031: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected I4, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Invalid comparison between Unknown and I4
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			GUIContent val = new GUIContent(text);
			if (style == null)
			{
				style = GUI.skin.button;
			}
			Event current = Event.current;
			int controlID = GUIUtility.GetControlID((FocusType)2);
			EventType type = current.type;
			EventType val2 = type;
			switch ((int)val2)
			{
			default:
				if ((int)val2 == 7)
				{
					style.Draw(rect, val, controlID);
				}
				break;
			case 0:
				if (GUIUtility.hotControl == 0 && ((Rect)(ref rect)).Contains(current.mousePosition) && current.button == 0)
				{
					GUIUtility.hotControl = controlID;
					current.Use();
				}
				break;
			case 1:
				if (GUIUtility.hotControl == controlID && ((Rect)(ref rect)).Contains(current.mousePosition) && current.button == 0)
				{
					GUIUtility.hotControl = 0;
					current.Use();
					return true;
				}
				break;
			case 3:
				if (GUIUtility.hotControl == controlID)
				{
					current.Use();
				}
				break;
			case 2:
				break;
			}
			return false;
		}
	}
}
namespace OneForAll.MiniMap.Patches
{
	[HarmonyPatch(typeof(DeadBodyInfo))]
	internal class DeadBodyInfoPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void MapCameraAlwaysEnabledPatch(ref Transform ___radarDot)
		{
			if (MinimapMod.minimapGUI.showDeadPlayers != ((Component)___radarDot).gameObject.activeSelf)
			{
				((Component)___radarDot).gameObject.SetActive(MinimapMod.minimapGUI.showDeadPlayers);
			}
		}
	}
	[HarmonyPatch(typeof(EnemyAI))]
	internal class EnemyAIPatch
	{
		private static GameObject FindMapDot(GameObject enemyObject, bool isModel = false)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			foreach (Transform item in enemyObject.transform)
			{
				Transform val = item;
				if (((Object)val).name.StartsWith("MapDot"))
				{
					return ((Component)val).gameObject;
				}
				if (!isModel && (((Object)val).name.EndsWith("Model") || ((Object)val).name.EndsWith("ModelContainer")))
				{
					GameObject val2 = FindMapDot(((Component)val).gameObject, isModel = true);
					if ((Object)(object)val2 != (Object)null)
					{
						return val2;
					}
				}
			}
			return null;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void EnemyVisibilityOnMapPatch(EnemyAI __instance)
		{
			if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).gameObject != (Object)null)
			{
				GameObject val = FindMapDot(((Component)__instance).gameObject);
				if ((Object)(object)val != (Object)null && MinimapMod.minimapGUI.showEnemies != val.activeSelf)
				{
					val.SetActive(MinimapMod.minimapGUI.showEnemies);
				}
			}
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbableObjectPatch
	{
		private static bool showTerminalCodes = MinimapMod.minimapGUI.showTerminalCodes;

		[HarmonyPatch("LateUpdate")]
		[HarmonyPostfix]
		private static void LootVisibilityOnMapPatch(GrabbableObject __instance)
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.radarIcon != (Object)null && (Object)(object)((Component)__instance.radarIcon).gameObject != (Object)null && MinimapMod.minimapGUI.showLoots != ((Component)__instance.radarIcon).gameObject.activeSelf)
			{
				((Component)__instance.radarIcon).gameObject.SetActive(MinimapMod.minimapGUI.showLoots);
			}
			if (showTerminalCodes != MinimapMod.minimapGUI.showTerminalCodes)
			{
				showTerminalCodes = MinimapMod.minimapGUI.showTerminalCodes;
				TerminalAccessibleObject[] array = Object.FindObjectsOfType<TerminalAccessibleObject>();
				FieldInfo fieldInfo = AccessTools.Field(typeof(TerminalAccessibleObject), "mapRadarText");
				for (int i = 0; i < array.Length; i++)
				{
					TextMeshProUGUI val = (TextMeshProUGUI)fieldInfo.GetValue(array[i]);
					((Component)val).gameObject.SetActive(MinimapMod.minimapGUI.showTerminalCodes);
				}
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		public static readonly string prefix = "<color=#00ffffff>[Minimap]</color> ";

		public static readonly string prefixForBroadcast = "FraZy.OneForAll.Minimap";

		private static readonly Regex parserRegex = new Regex("\\A<size=0>" + Regex.Escape(prefixForBroadcast) + "/([ -~]+)/([ -~]+)/([ -~]+)</size>\\z", RegexOptions.Compiled);

		private static IDictionary<string, string> myBroadcasts = new Dictionary<string, string>();

		private static string lastMessage = "";

		public static void SendClientMessage(string message)
		{
			HUDManager.Instance.AddTextToChatOnServer(prefix + message, -1);
		}

		[HarmonyPatch("AddTextMessageServerRpc")]
		[HarmonyPrefix]
		private static bool DontSendMinimapMessagesPatch(string chatMessage)
		{
			return !chatMessage.StartsWith(prefix);
		}

		public static void SendMinimapBroadcast(string signature, string data = "null")
		{
			int num = (int)GameNetworkManager.Instance.localPlayerController.playerClientId;
			if (!myBroadcasts.ContainsKey(signature))
			{
				myBroadcasts.Add(signature, data);
			}
			else
			{
				myBroadcasts[signature] = data;
			}
			HUDManager.Instance.AddTextToChatOnServer($"<size=0>{prefixForBroadcast}/{num}/{signature}/{data}</size>", -1);
		}
	}
	[HarmonyPatch(typeof(ManualCameraRenderer))]
	internal class ManualCameraRendererPatch
	{
		private static Vector3 defaultEulerAngles = new Vector3(90f, 315f, 0f);

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void MapCameraAlwaysEnabledPatch(ref Camera ___mapCamera, ref PlayerControllerB ___targetedPlayer, ref Light ___mapCameraLight, ref Transform ___shipArrowPointer, ref GameObject ___shipArrowUI)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)___mapCamera != (Object)null)
			{
				((Behaviour)___mapCamera).enabled = true;
				if (___mapCamera.orthographicSize != MinimapMod.minimapGUI.minimapZoom)
				{
					___mapCamera.orthographicSize = MinimapMod.minimapGUI.minimapZoom;
				}
				if (MinimapMod.minimapGUI.autoRotate && (Object)(object)___targetedPlayer != (Object)null)
				{
					((Component)___mapCamera).transform.eulerAngles = new Vector3(defaultEulerAngles.x, ((Component)___targetedPlayer).transform.eulerAngles.y, defaultEulerAngles.z);
				}
				else if (((Component)___mapCamera).transform.eulerAngles != defaultEulerAngles)
				{
					((Component)___mapCamera).transform.eulerAngles = defaultEulerAngles;
				}
				TerminalAccessibleObject[] array = Object.FindObjectsOfType<TerminalAccessibleObject>();
				foreach (TerminalAccessibleObject val in array)
				{
					FieldInfo field = ((object)val).GetType().GetField("mapRadarText", BindingFlags.Instance | BindingFlags.NonPublic);
					if (field != null)
					{
						((TMP_Text)field.GetValue(val)).transform.eulerAngles = new Vector3(defaultEulerAngles.x, ((Component)___mapCamera).transform.eulerAngles.y, defaultEulerAngles.z);
					}
				}
			}
			if ((Object)(object)___mapCameraLight != (Object)null && (Object)(object)___targetedPlayer != (Object)null)
			{
				((Behaviour)___mapCameraLight).enabled = ___targetedPlayer.isInsideFactory;
				if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
				{
					___mapCameraLight.cullingMask = ~GameNetworkManager.Instance.localPlayerController.gameplayCamera.cullingMask;
				}
			}
			if (!((Object)(object)___shipArrowPointer != (Object)null) || !((Object)(object)___shipArrowUI != (Object)null) || !((Object)(object)___targetedPlayer != (Object)null))
			{
				return;
			}
			if (MinimapMod.minimapGUI.showShipArrow && !___targetedPlayer.isInsideFactory && (double)Vector3.Distance(((Component)___targetedPlayer).transform.position, ((Component)StartOfRound.Instance.elevatorTransform).transform.position) > 16.0)
			{
				if ((Object)(object)StartOfRound.Instance != (Object)null)
				{
					___shipArrowPointer.LookAt(StartOfRound.Instance.elevatorTransform);
				}
				int num = (MinimapMod.minimapGUI.autoRotate ? 45 : 0);
				___shipArrowPointer.eulerAngles = new Vector3(0f, ___shipArrowPointer.eulerAngles.y + (float)num, 0f);
				___shipArrowUI.SetActive(true);
			}
			else
			{
				___shipArrowUI.SetActive(false);
			}
		}

		[HarmonyPatch("updateMapTarget")]
		[HarmonyPrefix]
		private static bool RadarMapSwitchTargetPatch(int setRadarTargetIndex, ref int ___targetTransformIndex, ref IEnumerator __result)
		{
			MinimapMod.minimapGUI.realPlayerIndex = setRadarTargetIndex;
			if (MinimapMod.minimapGUI.freezePlayerIndex)
			{
				MinimapMod.minimapGUI.SetMinimapTarget(MinimapMod.minimapGUI.playerIndex);
				__result = DoNothingCoroutine();
				return false;
			}
			MinimapMod.minimapGUI.playerIndex = ___targetTransformIndex;
			return true;
		}

		private static IEnumerator DoNothingCoroutine()
		{
			yield break;
		}

		[HarmonyPatch("RemoveTargetFromRadar")]
		[HarmonyPostfix]
		private static void RemoveTargetFromMapPatch()
		{
			if (MinimapMod.minimapGUI.freezePlayerIndex)
			{
				MinimapMod.minimapGUI.SwitchTarget();
			}
		}

		[HarmonyPatch("SwitchRadarTargetForward")]
		[HarmonyPrefix]
		private static bool DontSwitchTargetForwardPatch()
		{
			return !MinimapMod.minimapGUI.freezePlayerIndex;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private const int padding = -5;

		private static GameObject minimapObj;

		private static RawImage minimap;

		private static RectTransform tooltips;

		private static Vector2 tooltipsOriginalPos;

		private static GameObject minimapLightObj;

		public static Light minimapLight;

		[HarmonyPatch("ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		private static void DisplayMinimapPatch()
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Expected O, but got Unknown
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			string text = null;
			if (VersionChecker.latestVersion == null)
			{
				text = "<color=red>Failed to check for latest version</color>";
			}
			else if (new Version("1.0.3") < new Version(VersionChecker.latestVersion))
			{
				text = "<color=white>There is a new version available: </color><color=green>" + VersionChecker.latestVersion + "</color>";
			}
			if (text != null)
			{
				HUDManagerPatch.SendClientMessage(text);
			}
			int minimapSize = MinimapMod.minimapGUI.minimapSize;
			if ((Object)(object)minimap == (Object)null || (Object)(object)minimapObj == (Object)null)
			{
				minimapObj = new GameObject("Minimap");
				minimap = minimapObj.AddComponent<RawImage>();
				((Graphic)minimap).rectTransform.anchorMin = new Vector2(1f, 1f);
				((Graphic)minimap).rectTransform.anchorMax = new Vector2(1f, 1f);
				((Graphic)minimap).rectTransform.pivot = new Vector2(1f, 1f);
				((Graphic)minimap).rectTransform.sizeDelta = new Vector2((float)minimapSize, (float)minimapSize);
				((Graphic)minimap).rectTransform.anchoredPosition = new Vector2(MinimapMod.minimapGUI.minimapXPos, MinimapMod.minimapGUI.minimapYPos - 5f);
			}
			if ((Object)(object)minimapLight == (Object)null || (Object)(object)minimapLightObj == (Object)null)
			{
				minimapLightObj = new GameObject("MinimapLight");
				minimapLightObj.transform.position = new Vector3(0f, 100f, 0f);
				minimapLightObj.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
				minimapLight = minimapLightObj.AddComponent<Light>();
				minimapLight.type = (LightType)1;
				minimapLight.range = 100f;
				minimapLight.color = Color.white;
				minimapLight.colorTemperature = 6500f;
				minimapLight.intensity = 0f;
				minimapLight.cullingMask = 0;
			}
			minimap.texture = (Texture)(object)StartOfRound.Instance.mapScreen.cam.targetTexture;
			((Component)minimap).transform.SetParent(((Component)HUDManager.Instance.playerScreenTexture).transform, false);
			tooltips = ((Component)HUDManager.Instance.Tooltips.canvasGroup).gameObject.GetComponent<RectTransform>();
			Vector2 val = tooltipsOriginalPos;
			bool flag = false;
			RectTransform obj = tooltips;
			obj.anchoredPosition -= new Vector2(0f, (float)minimapSize);
			HUDManagerPatch.SendMinimapBroadcast("VersionReq");
			HUDManagerPatch.SendMinimapBroadcast("VersionResp", "1.0.3");
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdateMinimapPatch(PlayerControllerB __instance)
		{
			//IL_00f0: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			if (MinimapMod.minimapGUI.showLivePlayers != ((Component)__instance.mapRadarDotAnimator).gameObject.activeSelf)
			{
				((Component)__instance.mapRadarDotAnimator).gameObject.SetActive(MinimapMod.minimapGUI.showLivePlayers);
			}
			if ((Object)(object)minimap != (Object)null)
			{
				if (MinimapMod.minimapGUI.enableMinimap != ((Component)minimap).gameObject.activeSelf)
				{
					((Component)minimap).gameObject.SetActive(MinimapMod.minimapGUI.enableMinimap);
					if (MinimapMod.minimapGUI.enableMinimap)
					{
						RectTransform obj = tooltips;
						obj.anchoredPosition -= new Vector2(0f, (float)MinimapMod.minimapGUI.minimapSize);
					}
					else
					{
						tooltips.anchoredPosition = tooltipsOriginalPos;
					}
				}
				if ((float)MinimapMod.minimapGUI.minimapSize != ((Graphic)minimap).rectTransform.sizeDelta.y)
				{
					int minimapSize = MinimapMod.minimapGUI.minimapSize;
					((Graphic)minimap).rectTransform.sizeDelta = new Vector2((float)minimapSize, (float)minimapSize);
					tooltips.anchoredPosition = tooltipsOriginalPos - new Vector2(0f, (float)minimapSize);
				}
				if (MinimapMod.minimapGUI.minimapXPos != ((Graphic)minimap).rectTransform.anchoredPosition.x || MinimapMod.minimapGUI.minimapYPos != ((Graphic)minimap).rectTransform.anchoredPosition.y)
				{
					((Graphic)minimap).rectTransform.anchoredPosition = new Vector2(MinimapMod.minimapGUI.minimapXPos, MinimapMod.minimapGUI.minimapYPos - 5f);
				}
			}
			if ((Object)(object)minimapLight != (Object)null)
			{
				if (minimapLight.cullingMask == 0 && (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
				{
					minimapLight.cullingMask = ~GameNetworkManager.Instance.localPlayerController.gameplayCamera.cullingMask;
				}
				minimapLight.intensity = MinimapMod.minimapGUI.brightness;
			}
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager))]
	internal class QuickMenuManagerPatch
	{
		private static bool isRealMenuOpen;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void FreezeWhenOpenedGUIPatch(ref bool ___isMenuOpen)
		{
			bool flag = MinimapMod.minimapGUI.isGUIOpen || isRealMenuOpen;
			if (___isMenuOpen != flag)
			{
				___isMenuOpen = flag;
			}
		}

		[HarmonyPatch("OpenQuickMenu")]
		[HarmonyPostfix]
		private static void OpenQuickMenuPatch()
		{
			isRealMenuOpen = true;
		}

		[HarmonyPatch("CloseQuickMenu")]
		[HarmonyPostfix]
		private static void CloseQuickMenuPatch()
		{
			isRealMenuOpen = false;
		}
	}
	[HarmonyPatch(typeof(RadarBoosterItem))]
	internal class RadarBoosterItemPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void RadarBoosterVisibilityPatch(RadarBoosterItem __instance)
		{
			if (MinimapMod.minimapGUI.showRadarBoosters != __instance.radarDot.activeSelf)
			{
				__instance.radarDot.SetActive(MinimapMod.minimapGUI.showRadarBoosters);
			}
		}
	}
	[HarmonyPatch(typeof(ShipTeleporter))]
	internal class ShipTeleporterPatch
	{
		private static PlayerControllerB playerToBeamUp;

		[HarmonyPatch("beamUpPlayer")]
		[HarmonyPrefix]
		private static void BeforeTeleportPatch()
		{
			int realPlayerIndex = MinimapMod.minimapGUI.realPlayerIndex;
			if (StartOfRound.Instance.mapScreen.targetTransformIndex != realPlayerIndex)
			{
				playerToBeamUp = ((Component)StartOfRound.Instance.mapScreen.radarTargets[MinimapMod.minimapGUI.CalculateValidTargetIndex(realPlayerIndex)].transform).gameObject.GetComponent<PlayerControllerB>();
				StartOfRound.Instance.mapScreen.targetedPlayer = playerToBeamUp;
			}
		}

		[HarmonyPatch("SetPlayerTeleporterId")]
		[HarmonyPrefix]
		private static void DuringTeleportPatch()
		{
			if ((Object)(object)playerToBeamUp != (Object)null)
			{
				playerToBeamUp = null;
				MinimapMod.minimapGUI.SetMinimapTarget(MinimapMod.minimapGUI.playerIndex);
			}
		}
	}
	[HarmonyPatch(typeof(TerminalAccessibleObject))]
	internal class TerminalAccessibleObjectPatch
	{
		[HarmonyPatch("InitializeValues")]
		[HarmonyPostfix]
		private static void TerminalCodeVisibilityPatch(ref TextMeshProUGUI ___mapRadarText)
		{
			((Component)___mapRadarText).gameObject.SetActive(MinimapMod.minimapGUI.showTerminalCodes);
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	internal class TimeOfDayPatch
	{
		[HarmonyPatch("SetInsideLightingDimness")]
		[HarmonyPostfix]
		private static void MinimapBrightnessPatch()
		{
			if ((Object)(object)TimeOfDay.Instance.sunDirect != (Object)null)
			{
				((Behaviour)TimeOfDay.Instance.sunDirect).enabled = true;
			}
		}
	}
}
namespace OneForAll.Horn
{
	[BepInPlugin("FraZy.OneForAll.Horn", "OneForAll.Horn", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "FraZy.OneForAll.Horn";

		private const string NAME = "OneForAll.Horn";

		private const string VERSION = "1.0.3";

		private readonly Harmony harmony = new Harmony("FraZy.OneForAll.Horn");

		public static Plugin Instance;

		public static ManualLogSource mls;

		private void Awake()
		{
			mls = Logger.CreateLogSource("FraZy.OneForAll.Horn");
			Instance = this;
			harmony.PatchAll();
			mls.LogInfo((object)"OneForAll.Horn has been Patched");
		}
	}
}
namespace OneForAll.Horn.Patches
{
	[HarmonyPatch]
	internal class ShipAlarmCordPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void LoadAudio()
		{
			HornManager.Load();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ShipAlarmCord), "Start")]
		private static void ChangeShipAlarmCordSFX(ShipAlarmCord __instance)
		{
			if (HornManager.Loaded)
			{
				HornManager.ChangeClip(__instance);
				return;
			}
			HornManager.OnLoaded += delegate
			{
				HornManager.ChangeClip(__instance);
			};
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ShipAlarmCord), "StopHorn")]
		private static void ActuallyStopHorn(ShipAlarmCord __instance)
		{
			__instance.cordAudio.Stop();
			HornManager.NextClip(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ShipAlarmCord), "HoldCordDown")]
		private static void LoopNewHornSFX(ShipAlarmCord __instance)
		{
			if (!__instance.cordAudio.isPlaying)
			{
				__instance.cordAudio.PlayOneShot(__instance.cordPullSFX);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ShipAlarmCord), "PullCordClientRpc")]
		private static void LoopNewHornSFXClient(ShipAlarmCord __instance)
		{
			if (!__instance.cordAudio.isPlaying)
			{
				__instance.cordAudio.PlayOneShot(__instance.cordPullSFX);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ShipAlarmCord), "StopPullingCordClientRpc")]
		private static void ActuallyStopHornClient(ShipAlarmCord __instance)
		{
			__instance.cordAudio.Stop();
			HornManager.NextClip(__instance);
		}
	}
}
namespace OneForAll.Horn.Manager
{
	internal static class HornManager
	{
		public static List<AudioClip> clips = new List<AudioClip>();

		public static bool Loaded;

		public static int clipIndex = 0;

		private static bool canSwitch = true;

		public static event Action OnLoaded;

		public static void Load()
		{
			string path = Path.Combine(Paths.PluginPath, "Audio");
			if (!Directory.Exists(path))
			{
				return;
			}
			string[] files = Directory.GetFiles(path);
			if (files.Length < 1)
			{
				Plugin.mls.LogInfo((object)"No Horn Audio Found!");
				return;
			}
			List<Coroutine> list = new List<Coroutine>();
			string[] array = files;
			string[] array2 = array;
			foreach (string filePath in array2)
			{
				Coroutine item = CorStarter.StartCoroutine(LoadAudioClip(filePath));
				list.Add(item);
			}
			CorStarter.StartCoroutine(WaitForAllClips(list));
		}

		private static IEnumerator WaitForAllClips(List<Coroutine> coroutines)
		{
			foreach (Coroutine coroutine in coroutines)
			{
				yield return coroutine;
			}
			Loaded = true;
			HornManager.OnLoaded?.Invoke();
		}

		private static IEnumerator LoadAudioClip(string filePath)
		{
			Plugin.mls.LogInfo((object)("Loading " + filePath + "!"));
			AudioType audioType = GetAudioType(filePath);
			if ((int)audioType == 0)
			{
				Plugin.mls.LogError((object)("Failed to load AudioClip from " + filePath + "\nUnsupported file extension!"));
				yield break;
			}
			UnityWebRequest loader = UnityWebRequestMultimedia.GetAudioClip(filePath, GetAudioType(filePath));
			loader.SendWebRequest();
			while (!loader.isDone)
			{
				yield return null;
			}
			if (loader.error != null)
			{
				Plugin.mls.LogError((object)("Error loading clip from path: " + filePath + "\n" + loader.error));
				Plugin.mls.LogError((object)loader.error);
				yield break;
			}
			AudioClip dlClip = DownloadHandlerAudioClip.GetContent(loader);
			if (Object.op_Implicit((Object)(object)dlClip) && (int)dlClip.loadState == 2)
			{
				Plugin.mls.LogInfo((object)("Loaded " + filePath));
				((Object)dlClip).name = Path.GetFileName(filePath);
				clips.Add(dlClip);
				Plugin.mls.LogInfo((object)$"Clips loaded: {clips.Count()}");
			}
			else
			{
				Plugin.mls.LogError((object)("Failed to load clip at: " + filePath + "\nThis might be due to an mismatch between the audio codec and the file extension!"));
			}
		}

		public static void ChangeClip(ShipAlarmCord __instance)
		{
			__instance.cordPullSFX = clips[0];
			__instance.hornClose.clip = null;
			__instance.hornFar.clip = null;
			__instance.cordAudio.maxDistance = 155f;
		}

		public static void NextClip(ShipAlarmCord __instance)
		{
			if (canSwitch)
			{
				clipIndex++;
				if (clipIndex >= clips.Count)
				{
					clipIndex = 0;
				}
				__instance.cordPullSFX = clips[clipIndex];
				Plugin.mls.LogInfo((object)$"Switched Clip to index {clipIndex}");
				canSwitch = false;
				CorStarter.StartCoroutine(WaitToSwitch());
			}
		}

		private static IEnumerator WaitToSwitch()
		{
			yield return (object)new WaitForSeconds(0.25f);
			canSwitch = true;
		}

		private static AudioType GetAudioType(string path)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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)
			string text = Path.GetExtension(path).ToLower();
			switch (text)
			{
			case ".wav":
				return (AudioType)20;
			case ".ogg":
				return (AudioType)14;
			case ".mp3":
				return (AudioType)13;
			default:
				Plugin.mls.LogError((object)("Unsupported extension type: " + text));
				return (AudioType)0;
			}
		}
	}
}
namespace OneForAll.Horn.Coroutines
{
	public class CorStarter : MonoBehaviour
	{
		private static CorStarter Instance;

		public static Coroutine StartCoroutine(IEnumerator routine)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = new GameObject("Shared Coroutine Starter").AddComponent<CorStarter>();
				Object.DontDestroyOnLoad((Object)(object)Instance);
			}
			return ((MonoBehaviour)Instance).StartCoroutine(routine);
		}
	}
}
namespace OneForAll.Heal
{
	[BepInPlugin("FraZy.OneForAll.Heal", "OneForAll.Heal", "1.0.3")]
	public class Heal : BaseUnityPlugin
	{
		private const string modGUID = "FraZy.OneForAll.Heal";

		private const string modName = "OneForAll.Heal";

		private const string modVersion = "1.0.3";

		private readonly Harmony harmony = new Harmony("OneForAll.Heal");

		private ConfigEntry<bool> configInfiniteFuel;

		public static bool InfiniteFuel;

		private ConfigEntry<bool> configShowBatteryIcon;

		public static bool ShowBatteryIcon;

		private static Heal Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("OneForAll.Heal");
			mls.LogInfo((object)"OneForAll.Heal loaded");
			harmony.PatchAll(typeof(Heal));
			harmony.PatchAll(typeof(OneForAll.Heal.Patches.PlayerControllerBPatch));
			configInfiniteFuel = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Infinite TZP", true, "Prevent TZP from ever running out.");
			InfiniteFuel = configInfiniteFuel.Value;
			configShowBatteryIcon = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Battery Icon", true, "Show a battery icon with the current TZP Fuel");
			ShowBatteryIcon = configShowBatteryIcon.Value;
		}
	}
}
namespace OneForAll.Heal.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	[HarmonyPatch(typeof(TetraChemicalItem))]
	internal class PlayerControllerBPatch : GrabbableObject
	{
		[HarmonyPatch(typeof(TetraChemicalItem), "Update")]
		[HarmonyPrefix]
		private static void PatchBattery(ref Item ___itemProperties, ref Battery ___insertedBattery, ref float ___fuel)
		{
			___itemProperties.requiresBattery = false;
			___insertedBattery.charge = ___fuel;
			___insertedBattery.empty = false;
		}

		[HarmonyPatch(typeof(TetraChemicalItem), "Update")]
		[HarmonyPostfix]
		public static void healtzp(ref bool ___emittingGas, ref bool ___isHeld, PlayerControllerB __instance, ref float ___fuel, ref Item ___itemProperties, ref Battery ___insertedBattery)
		{
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			if (Heal.InfiniteFuel && (int)((double)___fuel * 1000.0) % 1000 < 500)
			{
				___fuel = 3f;
			}
			else if (Heal.ShowBatteryIcon)
			{
				___itemProperties.requiresBattery = true;
				___insertedBattery.charge = ___fuel;
				___insertedBattery.empty = false;
			}
			if (!(___emittingGas & ___isHeld) || !((NetworkBehaviour)__instance).IsOwner)
			{
				return;
			}
			int num = (int)((double)___fuel * 1000.0) % 1000;
			GameNetworkManager.Instance.localPlayerController.inSpecialInteractAnimation = true;
			if (((NetworkBehaviour)__instance).IsOwner && num % 30 == 0 && GameNetworkManager.Instance.localPlayerController.health < 100)
			{
				HUDManager.Instance.DisplayStatusEffect("Healing ... " + (GameNetworkManager.Instance.localPlayerController.health + 1) + "%");
				GameNetworkManager.Instance.localPlayerController.DamagePlayer(-2, false, true, (CauseOfDeath)0, 0, false, default(Vector3));
				if (GameNetworkManager.Instance.localPlayerController.health >= 10 && GameNetworkManager.Instance.localPlayerController.criticallyInjured)
				{
					GameNetworkManager.Instance.localPlayerController.MakeCriticallyInjured(false);
				}
				HUDManager.Instance.HUDAnimator.ResetTrigger("SmallHit");
			}
			if (GameNetworkManager.Instance.localPlayerController.health >= 99)
			{
				HUDManager.Instance.DisplayStatusEffect("Healthy.\nGet to work!");
				HUDManager.Instance.statusEffectAnimator.SetTrigger("IndicateStatus");
			}
			GameNetworkManager.Instance.localPlayerController.inSpecialInteractAnimation = false;
		}
	}
}