Decompiled source of GWYF Admin Menu v1.1.0

GWYFAdminMenu.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Extensions;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
using Steamworks;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GWYF Admin Menu")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("GWYF Admin Menu")]
[assembly: AssemblyTitle("GWYFAdminMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[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 GWYFAdminMenu
{
	internal class AdminMenu : MonoBehaviour
	{
		private const int WindowId = 27165;

		private static readonly string[] Tabs = new string[4] { "Argent", "Tickets", "Items", "Bonus" };

		private static readonly (string label, double amount)[] MoneyPresets = new(string, double)[6]
		{
			("+1 K", 1000.0),
			("+100 K", 100000.0),
			("+1 M", 1000000.0),
			("+100 M", 100000000.0),
			("+1 B", 1000000000.0),
			("+1 T", 1000000000000.0)
		};

		private static readonly (string label, long amount)[] TicketPresets = new(string, long)[6]
		{
			("+1", 1L),
			("+5", 5L),
			("+10", 10L),
			("+50", 50L),
			("+100", 100L),
			("+1000", 1000L)
		};

		private bool _open;

		private Rect _window = new Rect(80f, 80f, 480f, 600f);

		private int _tab;

		private string _moneyInput = "1m";

		private string _ticketInput = "10";

		private List<SpawnableSO> _items = new List<SpawnableSO>();

		private float _nextItemScan;

		private string _search = "";

		private SpawnableSO _selected;

		private Vector2 _scroll;

		private int _quantity = 1;

		private float _achievementConfirmUntil;

		private string _status = "Pret.";

		private bool _statusError;

		private InputLayer _previousLayer;

		private CursorLockMode _previousLock;

		private bool _previousCursorVisible;

		private bool _previousUiCursorVisible;

		private Texture2D _texWindow;

		private Texture2D _texHeader;

		private Texture2D _texButton;

		private Texture2D _texButtonHover;

		private Texture2D _texAccent;

		private Texture2D _texField;

		private Texture2D _texRowSelected;

		private GUIStyle _sWindow;

		private GUIStyle _sTitle;

		private GUIStyle _sLabel;

		private GUIStyle _sBig;

		private GUIStyle _sButton;

		private GUIStyle _sTab;

		private GUIStyle _sTabActive;

		private GUIStyle _sField;

		private GUIStyle _sRow;

		private GUIStyle _sRowSelected;

		private GUIStyle _sStatus;

		private GUIStyle _sHint;

		private GUIStyle _sToggle;

		private void Update()
		{
			if (TogglePressed())
			{
				SetOpen(!_open);
			}
			BonusActions.TickInfiniteJump(_open);
		}

		private void LateUpdate()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			if (_open)
			{
				if ((int)InputEvents.ActiveLayer != 3)
				{
					_previousLayer = InputEvents.ActiveLayer;
					InputEvents.ActiveLayer = (InputLayer)3;
				}
				UICursorSimple instance = UICursorSimple._instance;
				if ((Object)(object)instance != (Object)null && !instance._cursorShouldBeVisible)
				{
					instance.ShowCursor();
				}
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
		}

		private void OnDisable()
		{
			if (_open)
			{
				SetOpen(open: false);
			}
		}

		private static bool TogglePressed()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Keyboard current = Keyboard.current;
			if (current == null)
			{
				return false;
			}
			try
			{
				KeyControl val = current[Plugin.ToggleKey.Value];
				return val != null && ((ButtonControl)val).wasPressedThisFrame;
			}
			catch (ArgumentException)
			{
				return ((ButtonControl)current.f6Key).wasPressedThisFrame;
			}
		}

		private void SetOpen(bool open)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Invalid comparison between Unknown and I4
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			if (open == _open)
			{
				return;
			}
			_open = open;
			if (open)
			{
				_previousLayer = InputEvents.ActiveLayer;
				_previousLock = Cursor.lockState;
				_previousCursorVisible = Cursor.visible;
				UICursorSimple instance = UICursorSimple._instance;
				_previousUiCursorVisible = (Object)(object)instance != (Object)null && instance._cursorShouldBeVisible;
				InputEvents.ActiveLayer = (InputLayer)3;
				ReleaseHeldInputs();
				if ((Object)(object)instance != (Object)null)
				{
					instance.ShowCursor();
				}
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
				if (_items.Count == 0)
				{
					RefreshItems();
				}
				UpdateHostStatus();
				return;
			}
			GUI.FocusControl((string)null);
			if ((int)InputEvents.ActiveLayer == 3)
			{
				InputEvents.ActiveLayer = _previousLayer;
			}
			UICursorSimple instance2 = UICursorSimple._instance;
			if ((Object)(object)instance2 != (Object)null)
			{
				if (!_previousUiCursorVisible)
				{
					instance2.HideCursor();
				}
			}
			else
			{
				Cursor.lockState = _previousLock;
				Cursor.visible = _previousCursorVisible;
			}
		}

		private static void ReleaseHeldInputs()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				InputEvents.OnMoveEvent?.Invoke(Vector2.zero);
				InputEvents.OnAimEvent?.Invoke(Vector2.zero);
				if (InputEvents.IsSprintPressed)
				{
					InputEvents.UpdateSprint(false);
				}
				if (InputEvents.IsJumpPressed)
				{
					InputEvents.UpdateJump(false);
				}
				if (InputEvents.IsCrouchPressed)
				{
					InputEvents.UpdateCrouch(false);
				}
				if (InputEvents.IsInteractPressed)
				{
					InputEvents.UpdateInteract(false);
				}
				if (InputEvents.IsUseItemPressed)
				{
					InputEvents.UpdateUseItem(false);
				}
				if (InputEvents.IsZoomPressed)
				{
					InputEvents.UpdateZoom(false);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("ReleaseHeldInputs: " + ex.Message));
			}
		}

		private void UpdateHostStatus()
		{
			if (GameActions.CanUse(out var error))
			{
				SetStatus("Pret. Clique sur un bouton.", error: false);
			}
			else
			{
				SetStatus(error, error: true);
			}
		}

		private void SetStatus(string message, bool error)
		{
			_status = message;
			_statusError = error;
			if (error)
			{
				Plugin.Log.LogWarning((object)message);
			}
			else
			{
				Plugin.Log.LogInfo((object)message);
			}
		}

		private void RefreshItems()
		{
			try
			{
				_items = GameActions.FindSpawnables();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
				_items = new List<SpawnableSO>();
			}
			if ((Object)(object)_selected != (Object)null && !_items.Contains(_selected))
			{
				_selected = null;
			}
			_nextItemScan = Time.unscaledTime + 3f;
		}

		private void OnGUI()
		{
			//IL_0047: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			if (_open)
			{
				EnsureStyles();
				float num = Mathf.Clamp(Plugin.UiScale.Value, 0.5f, 3f) * Mathf.Max(1f, (float)Screen.height / 1080f);
				GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
				GUI.depth = -1000;
				_window = GUI.Window(27165, _window, new WindowFunction(DrawWindow), GUIContent.none, _sWindow);
				float num2 = (float)Screen.width / num - ((Rect)(ref _window)).width;
				float num3 = (float)Screen.height / num - ((Rect)(ref _window)).height;
				((Rect)(ref _window)).x = Mathf.Clamp(((Rect)(ref _window)).x, 0f, Mathf.Max(0f, num2));
				((Rect)(ref _window)).y = Mathf.Clamp(((Rect)(ref _window)).y, 0f, Mathf.Max(0f, num3));
			}
		}

		private void DrawWindow(int id)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			GUI.DrawTexture(new Rect(0f, 0f, ((Rect)(ref _window)).width, 44f), (Texture)(object)_texHeader);
			GUI.Label(new Rect(14f, 8f, ((Rect)(ref _window)).width - 70f, 30f), "GWYF Admin Menu", _sTitle);
			if (GUI.Button(new Rect(((Rect)(ref _window)).width - 46f, 7f, 34f, 30f), "X", _sButton))
			{
				SetOpen(open: false);
			}
			GUILayout.Space(50f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int i = 0; i < Tabs.Length; i++)
			{
				if (GUILayout.Button(Tabs[i], (i == _tab) ? _sTabActive : _sTab, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) }))
				{
					_tab = i;
					GUI.FocusControl((string)null);
					if (i == 2 && _items.Count == 0)
					{
						RefreshItems();
					}
				}
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			switch (_tab)
			{
			case 0:
				DrawMoneyTab();
				break;
			case 1:
				DrawTicketTab();
				break;
			case 2:
				DrawItemTab();
				break;
			case 3:
				DrawBonusTab();
				break;
			}
			GUILayout.FlexibleSpace();
			Color color = GUI.color;
			GUI.color = (_statusError ? new Color(1f, 0.55f, 0.5f) : new Color(0.6f, 1f, 0.65f));
			GUILayout.Label(_status, _sStatus, Array.Empty<GUILayoutOption>());
			GUI.color = color;
			GUILayout.Label($"{Plugin.ToggleKey.Value} : ouvrir / fermer le menu  -  glisse le titre pour deplacer", _sHint, Array.Empty<GUILayoutOption>());
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _window)).width - 50f, 44f));
		}

		private void DrawMoneyTab()
		{
			GUILayout.Label("Solde actuel", _sLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label(GameActions.BalanceText + " $", _sBig, Array.Empty<GUILayoutOption>());
			GUILayout.Space(8f);
			DrawPresetGrid(MoneyPresets, delegate(double amount)
			{
				string message2;
				bool flag2 = GameActions.AddMoney(amount, out message2);
				SetStatus(message2, !flag2);
			});
			GUILayout.Space(12f);
			GUILayout.Label("Montant personnalise (ex : 2500, 5k, 2.5m, 1b, 3t)", _sLabel, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			_moneyInput = GUILayout.TextField(_moneyInput, 24, _sField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) });
			if (GUILayout.Button("Ajouter", _sButton, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(110f),
				GUILayout.Height(34f)
			}))
			{
				if (GameActions.TryParseAmount(_moneyInput, out var value))
				{
					string message;
					bool flag = GameActions.AddMoney(value, out message);
					SetStatus(message, !flag);
				}
				else
				{
					SetStatus("Montant invalide. Exemples : 2500, 5k, 2.5m, 1b", error: true);
				}
			}
			GUILayout.EndHorizontal();
		}

		private void DrawTicketTab()
		{
			GUILayout.Label("Tickets actuels", _sLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label(GameActions.TicketText, _sBig, Array.Empty<GUILayoutOption>());
			GUILayout.Space(8f);
			DrawPresetGrid(TicketPresets, delegate(long amount)
			{
				string message2;
				bool flag2 = GameActions.AddTickets(amount, out message2);
				SetStatus(message2, !flag2);
			});
			GUILayout.Space(12f);
			GUILayout.Label("Nombre personnalise", _sLabel, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			_ticketInput = GUILayout.TextField(_ticketInput, 12, _sField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) });
			if (GUILayout.Button("Ajouter", _sButton, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(110f),
				GUILayout.Height(34f)
			}))
			{
				if (GameActions.TryParseAmount(_ticketInput, out var value) && value <= 4.611686018427388E+18)
				{
					string message;
					bool flag = GameActions.AddTickets((long)value, out message);
					SetStatus(message, !flag);
				}
				else
				{
					SetStatus("Nombre de tickets invalide.", error: true);
				}
			}
			GUILayout.EndHorizontal();
		}

		private void DrawItemTab()
		{
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			if (_items.Count == 0 && Time.unscaledTime >= _nextItemScan)
			{
				RefreshItems();
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Recherche", _sLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) });
			_search = GUILayout.TextField(_search, 32, _sField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) });
			if (GUILayout.Button("Actualiser", _sButton, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(100f),
				GUILayout.Height(30f)
			}))
			{
				RefreshItems();
				SetStatus($"{_items.Count} items trouves.", error: false);
			}
			GUILayout.EndHorizontal();
			List<SpawnableSO> list = (string.IsNullOrWhiteSpace(_search) ? _items : _items.Where((SpawnableSO so) => GameActions.DisplayName(so).IndexOf(_search.Trim(), StringComparison.OrdinalIgnoreCase) >= 0).ToList());
			_scroll = GUILayout.BeginScrollView(_scroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(230f) });
			if (list.Count == 0)
			{
				GUILayout.Label((_items.Count == 0) ? "Aucun item charge. Entre dans une partie puis clique sur Actualiser." : "Aucun item ne correspond a la recherche.", _sLabel, Array.Empty<GUILayoutOption>());
			}
			foreach (SpawnableSO item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					bool flag = (Object)(object)item == (Object)(object)_selected;
					if (GUILayout.Button(GameActions.DisplayName(item), flag ? _sRowSelected : _sRow, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
					{
						_selected = item;
					}
				}
			}
			GUILayout.EndScrollView();
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Quantite", _sLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) });
			if (GUILayout.Button("-", _sButton, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(40f),
				GUILayout.Height(30f)
			}))
			{
				_quantity = Mathf.Max(1, _quantity - 1);
			}
			GUILayout.Label(_quantity.ToString(), _sBig, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("+", _sButton, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(40f),
				GUILayout.Height(30f)
			}))
			{
				_quantity = Mathf.Min(10, _quantity + 1);
			}
			GUILayout.FlexibleSpace();
			Plugin.AutoPickup.Value = GUILayout.Toggle(Plugin.AutoPickup.Value, " Mettre en main", _sToggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) });
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			string obj = (((Object)(object)_selected == (Object)null) ? "Choisis un item dans la liste" : ("Faire apparaitre : " + GameActions.DisplayName(_selected)));
			GUI.enabled = (Object)(object)_selected != (Object)null;
			if (GUILayout.Button(obj, _sTabActive, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(42f) }))
			{
				string message;
				bool flag2 = GameActions.SpawnItem(_selected, _quantity, Plugin.AutoPickup.Value, (MonoBehaviour)(object)this, out message);
				SetStatus(message, !flag2);
			}
			GUI.enabled = true;
		}

		private void DrawBonusTab()
		{
			GUILayout.Label("Cosmetiques debloques : " + BonusActions.CosmeticsText, _sLabel, Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Debloquer tous les cosmetiques", _sButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }))
			{
				string message;
				bool flag = BonusActions.UnlockAllCosmetics(out message);
				SetStatus(message, !flag);
			}
			GUILayout.Space(12f);
			bool flag2 = GUILayout.Toggle(Plugin.AllFloors.Value, " Tous les etages dans l'ascenseur", _sToggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) });
			if (flag2 != Plugin.AllFloors.Value)
			{
				Plugin.AllFloors.Value = flag2;
				BonusActions.ApplyAllFloors(out var message2);
				SetStatus(message2, error: false);
			}
			GUILayout.Space(12f);
			GUILayout.Label("Succes Steam : " + BonusActions.AchievementsText, _sLabel, Array.Empty<GUILayoutOption>());
			bool flag3 = Time.unscaledTime < _achievementConfirmUntil;
			if (GUILayout.Button(flag3 ? "Clique encore pour confirmer (definitif sur ton compte)" : "Debloquer tous les succes Steam", flag3 ? _sTabActive : _sButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }))
			{
				if (flag3)
				{
					_achievementConfirmUntil = 0f;
					string message3;
					bool flag4 = BonusActions.UnlockAllAchievements(out message3);
					SetStatus(message3, !flag4);
				}
				else
				{
					_achievementConfirmUntil = Time.unscaledTime + 4f;
					SetStatus("Les succes Steam restent sur ton compte. Reclique pour confirmer.", error: false);
				}
			}
			GUILayout.Space(12f);
			bool flag5 = GUILayout.Toggle(Plugin.InfiniteJump.Value, " Saut infini (maintiens Espace pour voler)", _sToggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) });
			if (flag5 != Plugin.InfiniteJump.Value)
			{
				Plugin.InfiniteJump.Value = flag5;
				SetStatus(flag5 ? "Saut infini active : ferme le menu et maintiens Espace." : "Saut infini desactive.", error: false);
			}
		}

		private void DrawPresetGrid<T>((string label, T amount)[] presets, Action<T> onClick)
		{
			for (int i = 0; i < presets.Length; i += 3)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				for (int j = i; j < Mathf.Min(i + 3, presets.Length); j++)
				{
					if (GUILayout.Button(presets[j].label, _sButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(44f) }))
					{
						onClick(presets[j].amount);
					}
				}
				GUILayout.EndHorizontal();
			}
		}

		private void EnsureStyles()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_013a: Expected O, but got Unknown
			//IL_0156: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: 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_01f7: Expected O, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: 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_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Expected O, but got Unknown
			//IL_0257: 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_0272: Expected O, but got Unknown
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: 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_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Expected O, but got Unknown
			//IL_02dd: Expected O, but got Unknown
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Expected O, but got Unknown
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Expected O, but got Unknown
			//IL_034a: Expected O, but got Unknown
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Expected O, but got Unknown
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: 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_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Expected O, but got Unknown
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Expected O, but got Unknown
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			if (_sWindow == null || !((Object)(object)_texWindow != (Object)null))
			{
				_texWindow = MakeTex(new Color(0.09f, 0.08f, 0.12f, 0.97f));
				_texHeader = MakeTex(new Color(0.55f, 0.12f, 0.22f, 1f));
				_texButton = MakeTex(new Color(0.2f, 0.18f, 0.27f, 1f));
				_texButtonHover = MakeTex(new Color(0.3f, 0.27f, 0.4f, 1f));
				_texAccent = MakeTex(new Color(0.85f, 0.65f, 0.15f, 1f));
				_texField = MakeTex(new Color(0.04f, 0.04f, 0.06f, 1f));
				_texRowSelected = MakeTex(new Color(0.35f, 0.55f, 0.3f, 1f));
				_sWindow = new GUIStyle(GUI.skin.box)
				{
					padding = new RectOffset(14, 14, 0, 10)
				};
				SetBackground(_sWindow, _texWindow);
				_sTitle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 20,
					fontStyle = (FontStyle)1
				};
				_sTitle.normal.textColor = Color.white;
				_sLabel = new GUIStyle(GUI.skin.label)
				{
					fontSize = 15,
					wordWrap = true
				};
				_sLabel.normal.textColor = new Color(0.85f, 0.85f, 0.9f);
				_sBig = new GUIStyle(GUI.skin.label)
				{
					fontSize = 26,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				_sBig.normal.textColor = new Color(1f, 0.85f, 0.3f);
				_sButton = new GUIStyle(GUI.skin.button)
				{
					fontSize = 16,
					fontStyle = (FontStyle)1
				};
				SetButtonTextures(_sButton, _texButton, _texButtonHover, _texAccent, Color.white);
				_sTab = new GUIStyle(_sButton);
				_sTabActive = new GUIStyle(_sButton);
				SetButtonTextures(_sTabActive, _texAccent, _texAccent, _texButtonHover, Color.black);
				_sRow = new GUIStyle(_sButton)
				{
					alignment = (TextAnchor)3,
					fontSize = 15,
					fontStyle = (FontStyle)0,
					padding = new RectOffset(10, 10, 4, 4)
				};
				_sRowSelected = new GUIStyle(_sRow)
				{
					fontStyle = (FontStyle)1
				};
				SetButtonTextures(_sRowSelected, _texRowSelected, _texRowSelected, _texAccent, Color.white);
				_sField = new GUIStyle(GUI.skin.textField)
				{
					fontSize = 17,
					alignment = (TextAnchor)3,
					padding = new RectOffset(8, 8, 4, 4)
				};
				SetBackground(_sField, _texField);
				GUIStyleState normal = _sField.normal;
				GUIStyleState focused = _sField.focused;
				Color val = (_sField.hover.textColor = Color.white);
				Color textColor = (focused.textColor = val);
				normal.textColor = textColor;
				_sToggle = new GUIStyle(GUI.skin.toggle)
				{
					fontSize = 15
				};
				GUIStyleState normal2 = _sToggle.normal;
				GUIStyleState onNormal = _sToggle.onNormal;
				GUIStyleState hover = _sToggle.hover;
				Color val3 = (_sToggle.onHover.textColor = Color.white);
				val = (hover.textColor = val3);
				textColor = (onNormal.textColor = val);
				normal2.textColor = textColor;
				_sStatus = new GUIStyle(GUI.skin.label)
				{
					fontSize = 15,
					wordWrap = true,
					fontStyle = (FontStyle)1
				};
				_sStatus.normal.textColor = Color.white;
				_sHint = new GUIStyle(GUI.skin.label)
				{
					fontSize = 12,
					alignment = (TextAnchor)4
				};
				_sHint.normal.textColor = new Color(0.6f, 0.6f, 0.68f);
			}
		}

		private static Texture2D MakeTex(Color color)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false)
			{
				hideFlags = (HideFlags)61
			};
			val.SetPixel(0, 0, color);
			val.Apply();
			return val;
		}

		private static void SetBackground(GUIStyle style, Texture2D tex)
		{
			GUIStyleState normal = style.normal;
			GUIStyleState hover = style.hover;
			GUIStyleState active = style.active;
			Texture2D val = (style.focused.background = tex);
			Texture2D val3 = (active.background = val);
			Texture2D background = (hover.background = val3);
			normal.background = background;
			GUIStyleState onNormal = style.onNormal;
			GUIStyleState onHover = style.onHover;
			GUIStyleState onActive = style.onActive;
			val = (style.onFocused.background = tex);
			val3 = (onActive.background = val);
			background = (onHover.background = val3);
			onNormal.background = background;
		}

		private static void SetButtonTextures(GUIStyle style, Texture2D normal, Texture2D hover, Texture2D active, Color text)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_008a: 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_0091: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			GUIStyleState normal2 = style.normal;
			Texture2D background = (style.onNormal.background = normal);
			normal2.background = background;
			GUIStyleState hover2 = style.hover;
			background = (style.onHover.background = hover);
			hover2.background = background;
			GUIStyleState active2 = style.active;
			background = (style.onActive.background = active);
			active2.background = background;
			GUIStyleState focused = style.focused;
			background = (style.onFocused.background = normal);
			focused.background = background;
			GUIStyleState normal3 = style.normal;
			GUIStyleState hover3 = style.hover;
			GUIStyleState active3 = style.active;
			Color val5 = (style.focused.textColor = text);
			Color val7 = (active3.textColor = val5);
			Color textColor = (hover3.textColor = val7);
			normal3.textColor = textColor;
			GUIStyleState onNormal = style.onNormal;
			GUIStyleState onHover = style.onHover;
			val7 = (style.onActive.textColor = text);
			textColor = (onHover.textColor = val7);
			onNormal.textColor = textColor;
		}
	}
	internal static class BonusActions
	{
		private static float _nextAchievementScan;

		private static string _achievementCache = "-";

		private const float RepeatDelay = 0.15f;

		private const float RepeatInterval = 0.12f;

		private static float _jumpHeldSince = -1f;

		private static float _nextRepeat;

		private static CosmeticsUnlockManager Cosmetics => MonoSingleton<CosmeticsUnlockManager>._instance;

		internal static string CosmeticsText
		{
			get
			{
				CosmeticsUnlockManager cosmetics = Cosmetics;
				if ((Object)(object)cosmetics == (Object)null)
				{
					return "-";
				}
				try
				{
					return $"{cosmetics.GetUnlockedCount()} / {cosmetics.GetTotalCosmeticsCount()}";
				}
				catch
				{
					return "-";
				}
			}
		}

		private static ElevatorManager Elevator => NetworkSingleton<ElevatorManager>._instance;

		internal static string AchievementsText
		{
			get
			{
				if (Time.unscaledTime < _nextAchievementScan)
				{
					return _achievementCache;
				}
				_nextAchievementScan = Time.unscaledTime + 2f;
				try
				{
					uint numAchievements = SteamUserStats.GetNumAchievements();
					int num = 0;
					bool flag = default(bool);
					for (uint num2 = 0u; num2 < numAchievements; num2++)
					{
						if (SteamUserStats.GetAchievement(SteamUserStats.GetAchievementName(num2), ref flag) && flag)
						{
							num++;
						}
					}
					_achievementCache = $"{num} / {numAchievements}";
				}
				catch (Exception)
				{
					_achievementCache = "Steam non disponible";
				}
				return _achievementCache;
			}
		}

		internal static bool UnlockAllCosmetics(out string message)
		{
			CosmeticsUnlockManager cm = Cosmetics;
			if ((Object)(object)cm == (Object)null)
			{
				message = "Gestionnaire de cosmetiques introuvable, reessaie au lobby.";
				return false;
			}
			try
			{
				CosmeticDataManager.Initialize();
				int[] validCosmeticIdsSorted = CosmeticDataManager.GetValidCosmeticIdsSorted();
				List<int> list = validCosmeticIdsSorted.Where((int id) => !cm.unlockedCosmetics.Contains(id)).ToList();
				if (list.Count == 0)
				{
					message = $"Tous les cosmetiques sont deja debloques ({validCosmeticIdsSorted.Length}).";
					return true;
				}
				foreach (int item in list)
				{
					cm.UnlockCosmetic(item);
				}
				message = $"{list.Count} cosmetiques debloques ! Total : {CosmeticsText}";
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
				message = "Erreur en debloquant les cosmetiques (voir la console BepInEx).";
				return false;
			}
		}

		internal static void ApplyAllFloors(out string message)
		{
			ElevatorManager elevator = Elevator;
			if ((Object)(object)elevator == (Object)null)
			{
				message = (Plugin.AllFloors.Value ? "Active : tous les boutons de l'ascenseur seront disponibles en partie." : "Desactive.");
				return;
			}
			try
			{
				if (Plugin.AllFloors.Value)
				{
					if (NetworkServer.active)
					{
						elevator.RpcEnableAllButtons();
					}
					else
					{
						elevator.UserCode_RpcEnableAllButtons();
					}
					message = "Tous les etages sont disponibles dans l'ascenseur.";
				}
				else
				{
					elevator.SetButtons();
					message = "Ascenseur remis a la normale.";
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
				message = "Erreur sur l'ascenseur (voir la console BepInEx).";
			}
		}

		internal static bool UnlockAllAchievements(out string message)
		{
			try
			{
				uint numAchievements = SteamUserStats.GetNumAchievements();
				if (numAchievements == 0)
				{
					message = "Aucun succes trouve (Steam pas encore pret ?).";
					return false;
				}
				int num = 0;
				bool flag = default(bool);
				for (uint num2 = 0u; num2 < numAchievements; num2++)
				{
					string achievementName = SteamUserStats.GetAchievementName(num2);
					if (!(SteamUserStats.GetAchievement(achievementName, ref flag) && flag) && SteamUserStats.SetAchievement(achievementName))
					{
						num++;
					}
				}
				SteamUserStats.StoreStats();
				_nextAchievementScan = 0f;
				message = ((num == 0) ? $"Tous les succes sont deja debloques ({numAchievements})." : $"{num} succes Steam debloques !");
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
				message = "Steam n'est pas disponible (lance le jeu via Steam).";
				return false;
			}
		}

		internal static void TickInfiniteJump(bool menuOpen)
		{
			if (!Plugin.InfiniteJump.Value || menuOpen || !InputEvents.IsJumpPressed)
			{
				_jumpHeldSince = -1f;
				return;
			}
			float time = Time.time;
			if (_jumpHeldSince < 0f)
			{
				_jumpHeldSince = time;
				_nextRepeat = time + 0.15f;
			}
			else
			{
				if (time < _nextRepeat)
				{
					return;
				}
				_nextRepeat = time + 0.12f;
				NetworkIdentity localPlayer = NetworkClient.localPlayer;
				if ((Object)(object)localPlayer == (Object)null)
				{
					return;
				}
				PlayerController component = ((Component)localPlayer).GetComponent<PlayerController>();
				if (!((Object)(object)component == (Object)null))
				{
					try
					{
						component._canJump = true;
						component.Jump();
					}
					catch (Exception ex)
					{
						Plugin.Log.LogWarning((object)("Saut infini : " + ex.Message));
					}
				}
			}
		}
	}
	internal static class GameActions
	{
		private const float SpawnDistance = 1.5f;

		internal static MoneyManager Money => NetworkSingleton<MoneyManager>._instance;

		private static ItemManager Items => NetworkSingleton<ItemManager>._instance;

		private static GameManager Game => NetworkSingleton<GameManager>._instance;

		internal static bool IsHost => NetworkServer.active;

		internal static string BalanceText
		{
			get
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)Money == (Object)null))
				{
					return FormatBig(Money.balance);
				}
				return "-";
			}
		}

		internal static string TicketText
		{
			get
			{
				if (!((Object)(object)Money == (Object)null))
				{
					return FormatDouble(Money.ticketBalance);
				}
				return "-";
			}
		}

		internal static bool CanUse(out string error)
		{
			if (!NetworkServer.active)
			{
				error = (NetworkClient.active ? "Hote uniquement : seul l'hote de la partie peut utiliser ce menu." : "Lance une partie d'abord (solo ou en tant qu'hote).");
				return false;
			}
			if ((Object)(object)Money == (Object)null)
			{
				error = "Partie pas encore chargee, reessaie dans un instant.";
				return false;
			}
			error = null;
			return true;
		}

		internal static bool AddMoney(double amount, out string message)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (!CanUse(out message))
			{
				return false;
			}
			if (amount <= 0.0 || double.IsNaN(amount) || double.IsInfinity(amount))
			{
				message = "Montant invalide.";
				return false;
			}
			try
			{
				Money.AddBalance(BigNumber.FromDouble(amount), LocalProfile(), (ChangeType)4);
				message = "+" + FormatDouble(amount) + " $ ajoutes. Solde : " + BalanceText;
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
				message = "Erreur en ajoutant l'argent (voir la console BepInEx).";
				return false;
			}
		}

		internal static bool AddTickets(long amount, out string message)
		{
			if (!CanUse(out message))
			{
				return false;
			}
			if (amount <= 0)
			{
				message = "Nombre de tickets invalide.";
				return false;
			}
			try
			{
				Money.AddTicket(amount);
				message = "+" + FormatDouble(amount) + " tickets ajoutes. Total : " + TicketText;
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
				message = "Erreur en ajoutant les tickets (voir la console BepInEx).";
				return false;
			}
		}

		internal static string DisplayName(SpawnableSO so)
		{
			if (!string.IsNullOrWhiteSpace(so.spawnableName))
			{
				return so.spawnableName;
			}
			return ((Object)so).name;
		}

		internal static List<SpawnableSO> FindSpawnables()
		{
			HashSet<SpawnableSO> hashSet = new HashSet<SpawnableSO>();
			SpawnableSO[] array = Resources.FindObjectsOfTypeAll<SpawnableSO>();
			foreach (SpawnableSO item in array)
			{
				hashSet.Add(item);
			}
			SpawnableSettings[] array2 = Resources.FindObjectsOfTypeAll<SpawnableSettings>();
			foreach (SpawnableSettings val in array2)
			{
				if ((Object)(object)val == (Object)null || val.spawnables == null)
				{
					continue;
				}
				foreach (SpawnableSO spawnable in val.spawnables)
				{
					if ((Object)(object)spawnable != (Object)null)
					{
						hashSet.Add(spawnable);
					}
				}
			}
			return hashSet.Where((SpawnableSO so) => (Object)(object)so != (Object)null && (Object)(object)so.prefab != (Object)null && (Object)(object)so.prefab.GetComponent<NetworkIdentity>() != (Object)null).OrderBy<SpawnableSO, string>(DisplayName, StringComparer.OrdinalIgnoreCase).ToList();
		}

		internal static bool SpawnItem(SpawnableSO so, int count, bool pickup, MonoBehaviour runner, out string message)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_006f: Invalid comparison between Unknown and I4
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			if (!CanUse(out message))
			{
				return false;
			}
			if ((Object)(object)so == (Object)null || (Object)(object)so.prefab == (Object)null)
			{
				message = "Choisis un item dans la liste.";
				return false;
			}
			NetworkIdentity localPlayer = NetworkClient.localPlayer;
			if ((Object)(object)localPlayer == (Object)null)
			{
				message = "Joueur local introuvable.";
				return false;
			}
			count = Mathf.Clamp(count, 1, 10);
			Vector3 spawnPoint = GetSpawnPoint(localPlayer);
			bool flag = (Object)(object)Game != (Object)null && (int)Game.state == 1 && (Object)(object)Items != (Object)null;
			List<Item> list = new List<Item>();
			try
			{
				for (int i = 0; i < count; i++)
				{
					GameObject val = Object.Instantiate<GameObject>(so.prefab, spawnPoint + Vector3.up * (0.3f * (float)i), Quaternion.identity);
					NetworkServer.Spawn(val, (NetworkConnectionToClient)null);
					if (flag)
					{
						Items.ServerAddItem(so);
						ConsumableItem component = val.GetComponent<ConsumableItem>();
						if ((Object)(object)component != (Object)null)
						{
							Items.spawnedItemInstances.Add(component);
						}
					}
					Item component2 = val.GetComponent<Item>();
					if ((Object)(object)component2 != (Object)null)
					{
						list.Add(component2);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
				message = "Erreur pendant l'apparition de l'item (voir la console BepInEx).";
				return false;
			}
			if (pickup && list.Count > 0)
			{
				PlayerInteract val2 = ((Component)localPlayer).GetComponent<PlayerInteract>() ?? ((Component)localPlayer).GetComponentInChildren<PlayerInteract>();
				if ((Object)(object)val2 != (Object)null)
				{
					runner.StartCoroutine(PickupNextFrame(list, val2));
				}
			}
			message = $"{count} x {DisplayName(so)} apparu(s)" + (pickup ? " et ramasse(s)." : " devant toi.");
			return true;
		}

		private static IEnumerator PickupNextFrame(List<Item> items, PlayerInteract interact)
		{
			yield return null;
			foreach (Item item in items)
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)interact == (Object)null))
				{
					try
					{
						((InteractableBase)item).ServerOnInteract(interact);
					}
					catch (Exception ex)
					{
						Plugin.Log.LogWarning((object)("Ramassage auto impossible : " + ex.Message));
					}
				}
			}
		}

		private static Vector3 GetSpawnPoint(NetworkIdentity player)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			Camera main = Camera.main;
			Vector3 val = (((Object)(object)main != (Object)null) ? ((Component)main).transform.position : (((Component)player).transform.position + Vector3.up * 1.5f));
			Vector3 val2 = (((Object)(object)main != (Object)null) ? ((Component)main).transform.forward : ((Component)player).transform.forward);
			float num = 1.5f;
			Transform root = ((Component)player).transform.root;
			RaycastHit[] array = Physics.RaycastAll(val, val2, 1.5f, -1, (QueryTriggerInteraction)1);
			for (int i = 0; i < array.Length; i++)
			{
				RaycastHit val3 = array[i];
				if (!((Object)(object)((RaycastHit)(ref val3)).transform.root == (Object)(object)root))
				{
					num = Mathf.Min(num, Mathf.Max(0.3f, ((RaycastHit)(ref val3)).distance - 0.3f));
				}
			}
			return val + val2 * num;
		}

		private static PlayerProfile LocalProfile()
		{
			NetworkIdentity localPlayer = NetworkClient.localPlayer;
			if ((Object)(object)localPlayer == (Object)null)
			{
				return null;
			}
			return ((Component)localPlayer).GetComponent<PlayerProfile>() ?? ((Component)localPlayer).GetComponentInChildren<PlayerProfile>();
		}

		internal static string FormatBig(BigNumber value)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			double num = ((BigNumber)(ref value)).ToDouble();
			if (!double.IsNaN(num) && !double.IsInfinity(num) && Math.Abs(num) < 1000000000000000.0)
			{
				return FormatDouble(num);
			}
			return string.Format("{0}e{1}", value.Mantissa.ToString("0.###", CultureInfo.InvariantCulture), value.Exponent);
		}

		internal static string FormatDouble(double d)
		{
			return Math.Floor(d).ToString("#,0", CultureInfo.InvariantCulture).Replace(',', ' ');
		}

		internal static bool TryParseAmount(string text, out double value)
		{
			value = 0.0;
			if (string.IsNullOrWhiteSpace(text))
			{
				return false;
			}
			string text2 = text.Trim().ToLowerInvariant().Replace(" ", "")
				.Replace("_", "")
				.Replace(',', '.');
			double num = 1.0;
			if (text2.Length > 0)
			{
				switch (text2[text2.Length - 1])
				{
				case 'k':
					num = 1000.0;
					break;
				case 'm':
					num = 1000000.0;
					break;
				case 'b':
					num = 1000000000.0;
					break;
				case 't':
					num = 1000000000000.0;
					break;
				}
				if (num > 1.0)
				{
					text2 = text2.Substring(0, text2.Length - 1);
				}
			}
			if (!double.TryParse(text2, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
			{
				return false;
			}
			value = result * num;
			if (value > 0.0)
			{
				return !double.IsInfinity(value);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerController), "CheckJump")]
	internal static class InfiniteJumpPatch
	{
		private static void Postfix(PlayerController __instance)
		{
			if (Plugin.InfiniteJump.Value && ((NetworkBehaviour)__instance).isLocalPlayer)
			{
				__instance._canJump = true;
			}
		}
	}
	[HarmonyPatch(typeof(ElevatorManager), "SetButtons")]
	internal static class AllFloorsPatch
	{
		private static void Postfix(ElevatorManager __instance)
		{
			if (Plugin.AllFloors.Value)
			{
				__instance.UserCode_RpcEnableAllButtons();
			}
		}
	}
	[BepInPlugin("gwyf.adminmenu", "GWYF Admin Menu", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "gwyf.adminmenu";

		public const string Name = "GWYF Admin Menu";

		public const string Version = "1.1.0";

		internal static ManualLogSource Log;

		internal static ConfigEntry<Key> ToggleKey;

		internal static ConfigEntry<float> UiScale;

		internal static ConfigEntry<bool> AutoPickup;

		internal static ConfigEntry<bool> InfiniteJump;

		internal static ConfigEntry<bool> AllFloors;

		private void Awake()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			//IL_00de: 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)
			Log = ((BaseUnityPlugin)this).Logger;
			ToggleKey = ((BaseUnityPlugin)this).Config.Bind<Key>("General", "ToggleKey", (Key)99, "Touche pour ouvrir / fermer le menu (noms de touches Unity Input System : F6, F7, Insert, Home...).");
			UiScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "UiScale", 1f, "Taille du menu (1 = normal, 1.25 = plus grand).");
			AutoPickup = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "AutoPickup", true, "Mettre automatiquement l'item dans la main du joueur quand il apparait.");
			InfiniteJump = ((BaseUnityPlugin)this).Config.Bind<bool>("Bonus", "InfiniteJump", false, "Saut infini : sauter en l'air, et maintenir Espace pour monter en continu.");
			AllFloors = ((BaseUnityPlugin)this).Config.Bind<bool>("Bonus", "AllFloors", false, "Tous les etages disponibles dans l'ascenseur.");
			new Harmony("gwyf.adminmenu").PatchAll(typeof(Plugin).Assembly);
			GameObject val = new GameObject("GWYFAdminMenu");
			Object.DontDestroyOnLoad((Object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<AdminMenu>();
			Log.LogInfo((object)string.Format("{0} {1} loaded - appuie sur {2} en jeu.", "GWYF Admin Menu", "1.1.0", ToggleKey.Value));
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}