using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using Mirror; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("GambleAdminMenu")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GambleAdminMenu")] [assembly: AssemblyTitle("GambleAdminMenu")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GambleAdminMenu { public class AdminMenu : MonoBehaviour { public struct PlayerInfo { public ulong SteamId; public string Name; public NetworkIdentity Identity; public PlayerInfo(PlayerReferences p) { SteamId = p.profile?.steamId ?? 0; Name = (string.IsNullOrEmpty(p.profile?.playerName) ? "Player" : p.profile.playerName); Identity = p.identity; } } private bool _open; private Rect _winRect = new Rect(30f, 30f, 590f, 30f); private Vector2 _playerScroll; private Vector2 _banScroll; private string _timeoutInput = "30"; private float _timeoutSecs = 30f; private string _suspendInput = "5"; private float _suspendMins = 5f; private readonly HashSet _banned = new HashSet(); private readonly Dictionary _bannedNames = new Dictionary(); private readonly Dictionary _suspendExpiry = new Dictionary(); private readonly HashSet _frozen = new HashSet(); private readonly HashSet _muted = new HashSet(); private List _cachedPlayers = new List(); private float _playerCacheAge = -999f; private const float PLAYER_CACHE_TTL = 3f; private NetworkBehaviour[] _nbCache; private float _nbCacheAge = -999f; private const float NB_CACHE_TTL = 5f; private GUIStyle _sWin; private GUIStyle _sHeader; private GUIStyle _sLabel; private GUIStyle _sDim; private GUIStyle _sBtn; private GUIStyle _sDanger; private GUIStyle _sGreen; private GUIStyle _sOrange; private GUIStyle _sInput; private bool _stylesReady; private const int VK_F9 = 120; private float _keyCooldown; private CursorLockMode _savedLock; private bool _savedCursorVisible; private static readonly string[] _kickNames = new string[13] { "CmdKickPlayer", "CmdKick", "CmdBanPlayer", "CmdDisconnect", "CmdDisconnectPlayer", "CmdRemovePlayer", "CmdBootPlayer", "CmdForceDisconnect", "CmdKickUser", "CmdRemoveUser", "CmdKickConnection", "CmdForceLeave", "CmdKickAndBan" }; [DllImport("user32.dll")] private static extern short GetAsyncKeyState(int vk); private void Awake() { ((MonoBehaviour)this).StartCoroutine(EnforcerLoop()); } private void Update() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) try { _keyCooldown -= Time.unscaledDeltaTime; if (!(_keyCooldown > 0f) && ((uint)GetAsyncKeyState(120) & 0x8000u) != 0) { _keyCooldown = 0.3f; _open = !_open; if (_open) { _savedLock = Cursor.lockState; _savedCursorVisible = Cursor.visible; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else { Cursor.lockState = _savedLock; Cursor.visible = _savedCursorVisible; } } } catch { } } private void OnGUI() { //IL_0021: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //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) try { float num = 80f; float num2 = 22f; if (GUI.Button(new Rect((float)Screen.width - num - 4f, 4f, num, num2), _open ? "▲ ADMIN" : "▼ ADMIN")) { _open = !_open; if (_open) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else { Cursor.lockState = _savedLock; Cursor.visible = _savedCursorVisible; } } if (_open) { EnsureStyles(); if (_sWin != null) { _winRect = GUILayout.Window(19777, _winRect, new WindowFunction(DrawWindow), " GAMBLE ADMIN MENU — F9", _sWin, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(590f), GUILayout.ExpandHeight(true) }); } } } catch { } } private void DrawWindow(int _) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_0661: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_09fa: Unknown result type (might be due to invalid IL or missing references) try { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button("CLOSE", _sBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) })) { ToggleMenu(open: false); } GUILayout.EndHorizontal(); if (!NetworkServer.active) { GUILayout.Space(20f); GUILayout.Label(" Host a lobby to access admin controls.", _sDim, Array.Empty()); GUILayout.Space(20f); GUI.DragWindow(new Rect(0f, 0f, 10000f, 22f)); return; } Separator(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Timeout:", _sLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }); _timeoutInput = GUILayout.TextField(_timeoutInput, 5, _sInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) }); GUILayout.Label("s", _sLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(14f) }); GUILayout.Space(18f); GUILayout.Label("Suspend:", _sLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }); _suspendInput = GUILayout.TextField(_suspendInput, 5, _sInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) }); GUILayout.Label("min", _sLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(26f) }); GUILayout.EndHorizontal(); if (float.TryParse(_timeoutInput, out var result) && result > 0f) { _timeoutSecs = result; } if (float.TryParse(_suspendInput, out var result2) && result2 > 0f) { _suspendMins = result2; } Separator(); if (Time.realtimeSinceStartup - _playerCacheAge > 3f) { RefreshPlayers(); } List cachedPlayers = _cachedPlayers; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"CONNECTED PLAYERS ({cachedPlayers.Count})", _sHeader, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button("REFRESH", _sBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { RefreshPlayers(); } if (cachedPlayers.Count > 0) { GUILayout.Space(4f); if (GUILayout.Button("KICK ALL", _sDanger, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(68f) })) { foreach (PlayerInfo item in cachedPlayers) { DoKick(item); } } GUILayout.Space(4f); if (GUILayout.Button("FREEZE ALL", _sOrange, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(76f) })) { foreach (PlayerInfo item2 in cachedPlayers) { DoFreeze(item2); } } } GUILayout.EndHorizontal(); GUILayout.Space(4f); if (cachedPlayers.Count == 0) { GUILayout.Label(" No other players in the lobby.", _sDim, Array.Empty()); } else { float num = Mathf.Min((float)cachedPlayers.Count * 30f + 8f, 210f); _playerScroll = GUILayout.BeginScrollView(_playerScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) }); foreach (PlayerInfo item3 in cachedPlayers) { bool flag = _frozen.Contains(item3.SteamId); bool flag2 = _muted.Contains(item3.SteamId); string obj = (_banned.Contains(item3.SteamId) ? ("[BAN] " + item3.Name) : (_suspendExpiry.ContainsKey(item3.SteamId) ? ("[SUS] " + item3.Name) : item3.Name)); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(obj, _sLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); if (GUILayout.Button("KICK", _sDanger, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) })) { DoKick(item3); } if (GUILayout.Button("BAN", _sDanger, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) })) { DoBan(item3); } if (GUILayout.Button("TIMEOUT", _sBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { DoTimeout(item3); } if (GUILayout.Button("SUSPEND", _sBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { DoSuspend(item3); } if (GUILayout.Button(flag ? "UNFREEZE" : "FREEZE", flag ? _sGreen : _sOrange, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(72f) })) { if (flag) { DoUnfreeze(item3); } else { DoFreeze(item3); } } if (GUILayout.Button(flag2 ? "UNMUTE" : "MUTE", flag2 ? _sGreen : _sBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { if (flag2) { DoUnmute(item3); } else { DoMute(item3); } } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } if (_banned.Count > 0 || _suspendExpiry.Count > 0) { Separator(); GUILayout.Label("BANS / SUSPENSIONS", _sHeader, Array.Empty()); GUILayout.Space(4f); ulong num2 = 0uL; List list = new List(); float num3 = Mathf.Min((float)(_banned.Count + _suspendExpiry.Count) * 26f + 8f, 130f); _banScroll = GUILayout.BeginScrollView(_banScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num3) }); foreach (ulong item4 in _banned) { if (!_suspendExpiry.ContainsKey(item4)) { string value; string text = (_bannedNames.TryGetValue(item4, out value) ? value : item4.ToString()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("[BAN] " + text, _sLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); if (GUILayout.Button("UNBAN", _sBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) })) { num2 = item4; } GUILayout.EndHorizontal(); } } foreach (KeyValuePair item5 in _suspendExpiry) { if (item5.Value <= DateTime.UtcNow) { list.Add(item5.Key); continue; } string value2; string text2 = (_bannedNames.TryGetValue(item5.Key, out value2) ? value2 : item5.Key.ToString()); TimeSpan timeSpan = item5.Value - DateTime.UtcNow; string text3 = ((timeSpan.TotalMinutes >= 1.0) ? $"{(int)timeSpan.TotalMinutes}m {timeSpan.Seconds:D2}s" : $"{timeSpan.Seconds}s"); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("[SUSPEND] " + text2 + " (" + text3 + " left)", _sLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) }); if (GUILayout.Button("CANCEL", _sBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(56f) })) { list.Add(item5.Key); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); if (num2 != 0L) { _banned.Remove(num2); _bannedNames.Remove(num2); } foreach (ulong item6 in list) { _suspendExpiry.Remove(item6); _banned.Remove(item6); _bannedNames.Remove(item6); } GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("CLEAR ALL BANS", _sBtn, Array.Empty())) { _banned.Clear(); _bannedNames.Clear(); } GUILayout.Space(4f); if (GUILayout.Button("CLEAR SUSPENSIONS", _sBtn, Array.Empty())) { foreach (ulong item7 in new List(_suspendExpiry.Keys)) { _suspendExpiry.Remove(item7); _banned.Remove(item7); } } GUILayout.EndHorizontal(); } GUI.DragWindow(new Rect(0f, 0f, 10000f, 22f)); } catch { } } private void DoKick(PlayerInfo p) { if ((Object)(object)p.Identity == (Object)null) { return; } try { NetworkConnectionToClient connectionToClient = p.Identity.connectionToClient; if (connectionToClient != null) { ((NetworkConnection)connectionToClient).Disconnect(); } } catch { } } private void DoBan(PlayerInfo p) { _banned.Add(p.SteamId); _bannedNames[p.SteamId] = p.Name; _suspendExpiry.Remove(p.SteamId); DoKick(p); } private void DoTimeout(PlayerInfo p) { _frozen.Add(p.SteamId); TryCameramanModeOnPlayer(p, enable: true); ((MonoBehaviour)this).StartCoroutine(TimeoutCoroutine(p.SteamId, _timeoutSecs)); } private IEnumerator TimeoutCoroutine(ulong sid, float seconds) { yield return (object)new WaitForSeconds(seconds); _frozen.Remove(sid); try { RefreshPlayers(); foreach (PlayerInfo cachedPlayer in _cachedPlayers) { if (cachedPlayer.SteamId == sid) { TryCameramanModeOnPlayer(cachedPlayer, enable: false); break; } } } catch { } } private void DoSuspend(PlayerInfo p) { _banned.Add(p.SteamId); _bannedNames[p.SteamId] = p.Name; _suspendExpiry[p.SteamId] = DateTime.UtcNow.AddMinutes(_suspendMins); DoKick(p); } private void DoFreeze(PlayerInfo p) { _frozen.Add(p.SteamId); TryCameramanModeOnPlayer(p, enable: true); } private void DoUnfreeze(PlayerInfo p) { _frozen.Remove(p.SteamId); TryCameramanModeOnPlayer(p, enable: false); } private void DoMute(PlayerInfo p) { _muted.Add(p.SteamId); TryMuteCmd(p, mute: true); TryLocalAudioMute(p, mute: true); } private void DoUnmute(PlayerInfo p) { _muted.Remove(p.SteamId); TryMuteCmd(p, mute: false); TryLocalAudioMute(p, mute: false); } private IEnumerator EnforcerLoop() { while (true) { yield return (object)new WaitForSeconds(1f); try { List list = new List(); foreach (KeyValuePair item in _suspendExpiry) { if (item.Value <= DateTime.UtcNow) { list.Add(item.Key); } } foreach (ulong item2 in list) { _suspendExpiry.Remove(item2); _banned.Remove(item2); _bannedNames.Remove(item2); } if (!NetworkServer.active || (_banned.Count == 0 && _frozen.Count == 0 && _muted.Count == 0)) { continue; } RefreshPlayersLight(); foreach (PlayerInfo cachedPlayer in _cachedPlayers) { if ((Object)(object)cachedPlayer.Identity == (Object)null) { continue; } if (_banned.Contains(cachedPlayer.SteamId)) { try { NetworkConnectionToClient connectionToClient = cachedPlayer.Identity.connectionToClient; if (connectionToClient != null) { ((NetworkConnection)connectionToClient).Disconnect(); } } catch { } } if (_frozen.Contains(cachedPlayer.SteamId)) { TryCameramanModeOnPlayer(cachedPlayer, enable: true); } if (_muted.Contains(cachedPlayer.SteamId)) { TryLocalAudioMute(cachedPlayer, mute: true); } } } catch { } } } private bool TryFreeKickCmd(PlayerInfo p) { NetworkBehaviour[] nBCache = GetNBCache(); foreach (NetworkBehaviour val in nBCache) { if ((Object)(object)val == (Object)null) { continue; } string[] kickNames = _kickNames; foreach (string name in kickNames) { MethodInfo method = ((object)val).GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { continue; } try { ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length == 0) { method.Invoke(val, null); return true; } if (parameters.Length == 1 && (parameters[0].ParameterType == typeof(int) || parameters[0].ParameterType == typeof(uint))) { object[] array = new object[1]; NetworkIdentity identity = p.Identity; array[0] = (int)((identity != null) ? identity.netId : 0); method.Invoke(val, array); return true; } if (parameters.Length == 1 && parameters[0].ParameterType == typeof(NetworkIdentity) && (Object)(object)p.Identity != (Object)null) { method.Invoke(val, new object[1] { p.Identity }); return true; } } catch { } } } return false; } private static void TryCameramanModeOnPlayer(PlayerInfo p, bool enable) { if ((Object)(object)p.Identity == (Object)null) { return; } string[] array = ((!enable) ? new string[5] { "CmdSetCameramanMode", "CmdCameramanMode", "CmdUnfreeze", "CmdSetUnfrozen", "CmdUnspectate" } : new string[5] { "CmdSetCameramanMode", "CmdCameramanMode", "CmdFreeze", "CmdSetFrozen", "CmdSpectate" }); try { NetworkBehaviour[] components = ((Component)p.Identity).gameObject.GetComponents(); foreach (NetworkBehaviour val in components) { if ((Object)(object)val == (Object)null) { continue; } string[] array2 = array; foreach (string name in array2) { MethodInfo method = ((object)val).GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { continue; } try { ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length == 0) { method.Invoke(val, null); return; } if (parameters.Length == 1 && parameters[0].ParameterType == typeof(bool)) { method.Invoke(val, new object[1] { enable }); return; } } catch { } } } } catch { } } private static void TryDrainMoney(PlayerInfo p) { if ((Object)(object)p.Identity == (Object)null) { return; } string[] array = new string[5] { "CmdChangeBalance", "CmdSetBalance", "CmdDrainMoney", "CmdSetMoney", "CmdAddMoney" }; try { NetworkBehaviour[] components = ((Component)p.Identity).gameObject.GetComponents(); foreach (NetworkBehaviour val in components) { if ((Object)(object)val == (Object)null) { continue; } string[] array2 = array; foreach (string name in array2) { MethodInfo method = ((object)val).GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { continue; } try { ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length < 1) { continue; } Type parameterType = parameters[0].ParameterType; if (parameterType != typeof(long) && parameterType != typeof(int)) { continue; } object[] array3 = new object[parameters.Length]; array3[0] = ((parameterType == typeof(long)) ? ((object)(-999999999L)) : ((object)(-999999999))); for (int k = 1; k < parameters.Length; k++) { array3[k] = (parameters[k].HasDefaultValue ? parameters[k].DefaultValue : null); } method.Invoke(val, array3); return; } catch { } } } } catch { } } private static void TryMuteCmd(PlayerInfo p, bool mute) { if ((Object)(object)p.Identity == (Object)null) { return; } string[] array = ((!mute) ? new string[5] { "CmdUnmutePlayer", "CmdUnmute", "CmdSetUnmuted", "CmdUnsilencePlayer", "CmdUnsilence" } : new string[5] { "CmdMutePlayer", "CmdMute", "CmdSetMuted", "CmdSilencePlayer", "CmdSilence" }); try { NetworkBehaviour[] components = ((Component)p.Identity).gameObject.GetComponents(); foreach (NetworkBehaviour val in components) { if ((Object)(object)val == (Object)null) { continue; } string[] array2 = array; foreach (string name in array2) { MethodInfo method = ((object)val).GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { continue; } try { ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length == 0) { method.Invoke(val, null); return; } if (parameters.Length == 1 && parameters[0].ParameterType == typeof(bool)) { method.Invoke(val, new object[1] { mute }); return; } if (parameters.Length == 1 && (parameters[0].ParameterType == typeof(uint) || parameters[0].ParameterType == typeof(int))) { method.Invoke(val, new object[1] { (int)p.Identity.netId }); return; } } catch { } } } } catch { } } private static void TryLocalAudioMute(PlayerInfo p, bool mute) { if ((Object)(object)p.Identity == (Object)null) { return; } try { AudioSource[] componentsInChildren = ((Component)p.Identity).gameObject.GetComponentsInChildren(); foreach (AudioSource val in componentsInChildren) { if ((Object)(object)val != (Object)null) { try { val.mute = mute; } catch { } } } } catch { } } private void RefreshPlayers() { _playerCacheAge = Time.realtimeSinceStartup; _cachedPlayers = BuildPlayerList(); } private void RefreshPlayersLight() { _playerCacheAge = Time.realtimeSinceStartup; try { LocalManager val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { return; } List value = Traverse.Create((object)val).Field("players").GetValue>(); if (value == null) { return; } List list = new List(value.Count); foreach (PlayerReferences item in value) { if (item != null) { NetworkIdentity identity = item.identity; if ((identity == null || !identity.isLocalPlayer) && !((Object)(object)item.profile == (Object)null)) { list.Add(new PlayerInfo(item)); } } } _cachedPlayers = list; } catch { } } private static List BuildPlayerList() { List list = new List(); try { LocalManager val = Object.FindObjectOfType(); if ((Object)(object)val != (Object)null) { List value = Traverse.Create((object)val).Field("players").GetValue>(); if (value != null && value.Count > 0) { foreach (PlayerReferences item in value) { if (item != null) { NetworkIdentity identity = item.identity; if ((identity == null || !identity.isLocalPlayer) && !((Object)(object)item.profile == (Object)null)) { list.Add(new PlayerInfo(item)); } } } if (list.Count > 0) { return list; } } } } catch { } try { MonoBehaviour[] array = Object.FindObjectsOfType(); foreach (MonoBehaviour val2 in array) { if ((Object)(object)val2 == (Object)null) { continue; } string[] array2 = new string[4] { "players", "_players", "playerList", "_playerList" }; foreach (string text in array2) { try { List value2 = Traverse.Create((object)val2).Field(text).GetValue>(); if (value2 == null || value2.Count == 0) { continue; } foreach (PlayerReferences item2 in value2) { if (item2 != null) { NetworkIdentity identity2 = item2.identity; if ((identity2 == null || !identity2.isLocalPlayer) && !((Object)(object)item2.profile == (Object)null)) { list.Add(new PlayerInfo(item2)); } } } if (list.Count <= 0) { continue; } return list; } catch { } } } } catch { } return list; } private NetworkBehaviour[] GetNBCache() { if (_nbCache == null || Time.realtimeSinceStartup - _nbCacheAge > 5f) { try { _nbCache = Object.FindObjectsOfType(); } catch { _nbCache = (NetworkBehaviour[])(object)new NetworkBehaviour[0]; } _nbCacheAge = Time.realtimeSinceStartup; } return _nbCache; } private void ToggleMenu(bool open) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) _open = open; if (!open) { Cursor.lockState = _savedLock; Cursor.visible = _savedCursorVisible; } } private static void Separator() { //IL_0030: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(5f); Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(1f), GUILayout.ExpandWidth(true) }); if ((int)Event.current.type == 7) { GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); } GUILayout.Space(5f); } private void EnsureStyles() { //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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007a: Expected O, but got Unknown //IL_0085: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_0140: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown //IL_019a: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0204: 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) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_023c: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Expected O, but got Unknown //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Expected O, but got Unknown //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0387: 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_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Expected O, but got Unknown if (_stylesReady) { return; } try { GUIStyle val = new GUIStyle(GUI.skin.window); val.normal.background = MakeTex(new Color(0.07f, 0.07f, 0.11f, 0.97f)); val.normal.textColor = Color.white; val.fontSize = 13; val.fontStyle = (FontStyle)1; val.padding = new RectOffset(10, 10, 26, 10); _sWin = val; GUIStyle val2 = new GUIStyle(GUI.skin.label); val2.normal.textColor = new Color(1f, 0.72f, 0.15f); val2.fontSize = 12; val2.fontStyle = (FontStyle)1; _sHeader = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label); val3.normal.textColor = new Color(0.92f, 0.92f, 0.92f); val3.fontSize = 11; _sLabel = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label); val4.normal.textColor = new Color(0.48f, 0.48f, 0.48f); val4.fontSize = 10; _sDim = val4; GUIStyle val5 = new GUIStyle(GUI.skin.textField); val5.normal.textColor = Color.white; val5.normal.background = MakeTex(new Color(0.18f, 0.18f, 0.26f, 1f)); val5.fontSize = 11; val5.padding = new RectOffset(4, 4, 2, 2); _sInput = val5; Texture2D background = MakeTex(new Color(0.22f, 0.22f, 0.3f, 1f)); Texture2D background2 = MakeTex(new Color(0.3f, 0.3f, 0.44f, 1f)); GUIStyle val6 = new GUIStyle(GUI.skin.button); val6.normal.background = background; val6.normal.textColor = Color.white; val6.hover.background = background2; val6.hover.textColor = Color.white; val6.fontSize = 10; val6.padding = new RectOffset(6, 6, 3, 3); _sBtn = val6; GUIStyle val7 = new GUIStyle(_sBtn); val7.normal.background = MakeTex(new Color(0.52f, 0.1f, 0.1f, 1f)); val7.normal.textColor = Color.white; val7.hover.background = MakeTex(new Color(0.72f, 0.14f, 0.14f, 1f)); val7.hover.textColor = Color.white; _sDanger = val7; GUIStyle val8 = new GUIStyle(_sBtn); val8.normal.background = MakeTex(new Color(0.1f, 0.42f, 0.1f, 1f)); val8.normal.textColor = Color.white; val8.hover.background = MakeTex(new Color(0.14f, 0.58f, 0.14f, 1f)); val8.hover.textColor = Color.white; _sGreen = val8; GUIStyle val9 = new GUIStyle(_sBtn); val9.normal.background = MakeTex(new Color(0.42f, 0.24f, 0.04f, 1f)); val9.normal.textColor = Color.white; val9.hover.background = MakeTex(new Color(0.58f, 0.34f, 0.06f, 1f)); val9.hover.textColor = Color.white; _sOrange = val9; _stylesReady = true; } catch { } } private static Texture2D MakeTex(Color c) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, c); val.Apply(); return val; } } [BepInPlugin("com.galix.gambleadminmenu", "Gamble Admin Menu", "1.0.0")] public class GambleAdminPlugin : BaseUnityPlugin { private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown GameObject val = new GameObject("GambleAdminMenu"); Object.DontDestroyOnLoad((Object)val); val.AddComponent(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Gamble Admin Menu loaded — press F9 to open."); } } }