using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using Steamworks; using Steamworks.Data; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.UIElements; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Antro.ServerSorter")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Antro.ServerSorter")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0.0")] [assembly: AssemblyProduct("Antro.ServerSorter")] [assembly: AssemblyTitle("Antro.ServerSorter")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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 ServerSorterMod { [BepInPlugin("com.Antro.ServerSorter", "Server Sorter UI Toolkit", "1.7.2")] public class ServerSorterPlugin : BaseUnityPlugin { public static ServerSorterPlugin Instance; public int currentSortMode = 0; public bool sortAscending = false; public bool filterOpenOnly = false; public bool filterThreePlusPlayers = false; private VisualElement uiRootElement; private Button sortDefaultBtn; private Button sortPingBtn; private Button sortPlayersBtn; private Button sortNameBtn; private Button filterOpenBtn; private Button filterThreePlusBtn; private Texture2D stolenBgTexture; private Texture2D stolenBtnTexture; private Texture2D stolenToggleTexture; private Font baseFont; public MenuController currentMenuController; private GameObject cachedServerListPanel; private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Instance = this; Harmony val = new Harmony("com.Antro.ServerSorter"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Server Sorter Mod loaded successfully!"); } private void Update() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (uiRootElement != null) { if ((Object)(object)cachedServerListPanel == (Object)null && (Object)(object)currentMenuController != (Object)null) { ref GameObject reference = ref cachedServerListPanel; object? value = AccessTools.Field(typeof(MenuController), "serverListPanel").GetValue(currentMenuController); reference = (GameObject)((value is GameObject) ? value : null); } if ((Object)(object)cachedServerListPanel != (Object)null) { bool activeInHierarchy = cachedServerListPanel.activeInHierarchy; uiRootElement.style.display = StyleEnum.op_Implicit((DisplayStyle)(!activeInHierarchy)); } } } public void BuildCustomUI() { //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0276: 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_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: 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_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Expected O, but got Unknown //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) DestroyCustomUI(); UIDocument val = Object.FindFirstObjectByType((FindObjectsInactive)1); if ((Object)(object)val == (Object)null) { return; } if ((Object)(object)currentMenuController != (Object)null) { ref GameObject reference = ref cachedServerListPanel; object? value = AccessTools.Field(typeof(MenuController), "serverListPanel").GetValue(currentMenuController); reference = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)cachedServerListPanel != (Object)null) { Image val2 = cachedServerListPanel.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = cachedServerListPanel.GetComponentInChildren(true); } if ((Object)(object)val2 != (Object)null && (Object)(object)val2.sprite != (Object)null) { stolenBgTexture = val2.sprite.texture; } } object? value2 = AccessTools.Field(typeof(MenuController), "serverListRefreshButton").GetValue(currentMenuController); GameObject val3 = (GameObject)((value2 is GameObject) ? value2 : null); if ((Object)(object)val3 != (Object)null) { Image component = val3.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.sprite != (Object)null) { stolenBtnTexture = component.sprite.texture; } } object? value3 = AccessTools.Field(typeof(MenuController), "serverListElementPrefab").GetValue(currentMenuController); GameObject val4 = (GameObject)((value3 is GameObject) ? value3 : null); if ((Object)(object)val4 != (Object)null) { Transform val5 = val4.transform.Find("GameObject/Graphic"); if ((Object)(object)val5 != (Object)null) { Image component2 = ((Component)val5).GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2.sprite != (Object)null) { stolenToggleTexture = component2.sprite.texture; } } } } LoadBaseFont(); uiRootElement = new VisualElement(); uiRootElement.style.position = StyleEnum.op_Implicit((Position)1); uiRootElement.style.left = StyleLength.op_Implicit(1359f); uiRootElement.style.top = StyleLength.op_Implicit(Length.Percent(50f)); uiRootElement.style.translate = new StyleTranslate(new Translate(Length.op_Implicit(0f), new Length(-50f, (LengthUnit)1))); uiRootElement.style.width = StyleLength.op_Implicit(360f); uiRootElement.style.height = StyleLength.op_Implicit(600f); uiRootElement.style.flexDirection = StyleEnum.op_Implicit((FlexDirection)0); uiRootElement.style.alignItems = StyleEnum.op_Implicit((Align)2); uiRootElement.style.justifyContent = StyleEnum.op_Implicit((Justify)0); uiRootElement.style.paddingTop = StyleLength.op_Implicit(60f); uiRootElement.style.paddingBottom = StyleLength.op_Implicit(10f); if ((Object)(object)stolenBgTexture != (Object)null) { uiRootElement.style.backgroundImage = new StyleBackground(stolenBgTexture); uiRootElement.style.unityBackgroundScaleMode = StyleEnum.op_Implicit((ScaleMode)0); } else { uiRootElement.style.backgroundColor = new StyleColor(new Color(0.15f, 0.1f, 0.05f, 0.95f)); } uiRootElement.Add(CreateNonClickableLabel("SORT BY:")); sortDefaultBtn = CreateCustomButton("Default (Clear)", delegate { OnSortClicked(0); }); sortPingBtn = CreateCustomButton("Ping", delegate { OnSortClicked(3); }); sortPlayersBtn = CreateCustomButton("Players", delegate { OnSortClicked(1); }); sortNameBtn = CreateCustomButton("Name", delegate { OnSortClicked(2); }); uiRootElement.Add((VisualElement)(object)sortDefaultBtn); uiRootElement.Add((VisualElement)(object)sortPingBtn); uiRootElement.Add((VisualElement)(object)sortPlayersBtn); uiRootElement.Add((VisualElement)(object)sortNameBtn); VisualElement val6 = new VisualElement(); val6.style.flexGrow = StyleFloat.op_Implicit(0f); uiRootElement.Add(val6); uiRootElement.Add(CreateNonClickableLabel("SHOW ONLY:")); filterOpenBtn = CreateCustomButton("Open (No Password)", delegate { filterOpenOnly = !filterOpenOnly; UpdateFilterButtonsVisuals(); AutoRefresh(); }, stolenToggleTexture, 60); filterThreePlusBtn = CreateCustomButton("3+ Players", delegate { filterThreePlusPlayers = !filterThreePlusPlayers; UpdateFilterButtonsVisuals(); AutoRefresh(); }, stolenToggleTexture, 60); uiRootElement.Add((VisualElement)(object)filterOpenBtn); uiRootElement.Add((VisualElement)(object)filterThreePlusBtn); UpdateSortButtonsVisuals(); UpdateFilterButtonsVisuals(); uiRootElement.style.display = StyleEnum.op_Implicit((DisplayStyle)1); val.rootVisualElement.Add(uiRootElement); } private void LoadBaseFont() { baseFont = Resources.GetBuiltinResource("Arial.ttf"); if ((Object)(object)baseFont == (Object)null) { baseFont = Font.CreateDynamicFontFromOSFont("Arial", 24); } } private VisualElement CreateNonClickableLabel(string text) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) VisualElement val = new VisualElement(); val.style.width = StyleLength.op_Implicit(240f); val.style.height = StyleLength.op_Implicit(40f); val.style.minHeight = StyleLength.op_Implicit(40f); val.style.maxHeight = StyleLength.op_Implicit(40f); val.style.flexShrink = StyleFloat.op_Implicit(0f); val.style.alignItems = StyleEnum.op_Implicit((Align)2); val.style.justifyContent = StyleEnum.op_Implicit((Justify)1); val.style.marginTop = StyleLength.op_Implicit(12f); val.style.marginBottom = StyleLength.op_Implicit(6f); if ((Object)(object)stolenBtnTexture != (Object)null) { val.style.backgroundImage = new StyleBackground(stolenBtnTexture); val.style.unityBackgroundImageTintColor = StyleColor.op_Implicit(new Color(0.5f, 0.5f, 0.5f)); } else { val.style.backgroundColor = new StyleColor(new Color(0.3f, 0.3f, 0.3f)); } Label val2 = new Label(text); ((VisualElement)val2).style.color = StyleColor.op_Implicit(Color.white); ((VisualElement)val2).style.fontSize = StyleLength.op_Implicit(20f); ((VisualElement)val2).style.unityFontStyleAndWeight = StyleEnum.op_Implicit((FontStyle)1); ((VisualElement)val2).style.unityTextAlign = StyleEnum.op_Implicit((TextAnchor)4); ((VisualElement)val2).style.height = StyleLength.op_Implicit(Length.Percent(100f)); ((VisualElement)val2).style.width = StyleLength.op_Implicit(Length.Percent(100f)); if ((Object)(object)baseFont != (Object)null) { ((VisualElement)val2).style.unityFont = StyleFont.op_Implicit(baseFont); ((VisualElement)val2).style.unityFontDefinition = new StyleFontDefinition(baseFont); } val.Add((VisualElement)(object)val2); return val; } private Button CreateCustomButton(string baseText, Action onClick, Texture2D customTexture = null, int customHeight = 50) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_007d: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_028b: 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) Button val = new Button(onClick); ((VisualElement)val).userData = baseText; ((TextElement)val).text = baseText; ((Focusable)val).focusable = false; ((VisualElement)val).style.width = StyleLength.op_Implicit(320f); ((VisualElement)val).style.height = StyleLength.op_Implicit((float)customHeight); ((VisualElement)val).style.minHeight = StyleLength.op_Implicit((float)customHeight); ((VisualElement)val).style.maxHeight = StyleLength.op_Implicit((float)customHeight); ((VisualElement)val).style.flexShrink = StyleFloat.op_Implicit(0f); ((VisualElement)val).style.marginTop = StyleLength.op_Implicit(3f); ((VisualElement)val).style.marginBottom = StyleLength.op_Implicit(3f); ((VisualElement)val).style.fontSize = StyleLength.op_Implicit(20f); ((VisualElement)val).style.unityTextAlign = StyleEnum.op_Implicit((TextAnchor)4); if ((Object)(object)customTexture != (Object)null) { ((VisualElement)val).style.backgroundImage = new StyleBackground(customTexture); ((VisualElement)val).style.unityBackgroundScaleMode = StyleEnum.op_Implicit((ScaleMode)1); ((VisualElement)val).style.backgroundColor = StyleColor.op_Implicit(Color.clear); ((VisualElement)val).style.borderTopWidth = StyleFloat.op_Implicit(-3f); ((VisualElement)val).style.borderBottomWidth = StyleFloat.op_Implicit(-3f); ((VisualElement)val).style.borderLeftWidth = StyleFloat.op_Implicit(0f); ((VisualElement)val).style.borderRightWidth = StyleFloat.op_Implicit(0f); } else if ((Object)(object)stolenBtnTexture != (Object)null) { ((VisualElement)val).style.backgroundImage = new StyleBackground(stolenBtnTexture); ((VisualElement)val).style.unityBackgroundScaleMode = StyleEnum.op_Implicit((ScaleMode)0); ((VisualElement)val).style.backgroundColor = StyleColor.op_Implicit(Color.clear); ((VisualElement)val).style.borderTopWidth = StyleFloat.op_Implicit(0f); ((VisualElement)val).style.borderBottomWidth = StyleFloat.op_Implicit(0f); ((VisualElement)val).style.borderLeftWidth = StyleFloat.op_Implicit(0f); ((VisualElement)val).style.borderRightWidth = StyleFloat.op_Implicit(0f); } else { ((VisualElement)val).style.backgroundColor = new StyleColor(new Color(0.2f, 0.2f, 0.2f)); } ((VisualElement)val).style.color = StyleColor.op_Implicit(Color.white); if ((Object)(object)baseFont != (Object)null) { ((VisualElement)val).style.unityFont = StyleFont.op_Implicit(baseFont); ((VisualElement)val).style.unityFontDefinition = new StyleFontDefinition(baseFont); } return val; } private void OnSortClicked(int sortId) { if (currentSortMode == sortId && sortId != 0) { sortAscending = !sortAscending; } else { currentSortMode = sortId; if (sortId == 1) { sortAscending = false; } if (sortId == 2) { sortAscending = true; } if (sortId == 3) { sortAscending = true; } } UpdateSortButtonsVisuals(); AutoRefresh(); } private void UpdateSortButtonsVisuals() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0030: 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_0056: 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_0057: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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) Color val = default(Color); ((Color)(ref val))..ctor(0.5f, 1f, 0.5f); Color white = Color.white; ((VisualElement)sortDefaultBtn).style.unityBackgroundImageTintColor = StyleColor.op_Implicit((currentSortMode == 0) ? val : white); ((VisualElement)sortPingBtn).style.unityBackgroundImageTintColor = StyleColor.op_Implicit((currentSortMode == 3) ? val : white); ((VisualElement)sortPlayersBtn).style.unityBackgroundImageTintColor = StyleColor.op_Implicit((currentSortMode == 1) ? val : white); ((VisualElement)sortNameBtn).style.unityBackgroundImageTintColor = StyleColor.op_Implicit((currentSortMode == 2) ? val : white); string text = (sortAscending ? " ↑" : " ↓"); ((TextElement)sortDefaultBtn).text = (string)((VisualElement)sortDefaultBtn).userData; ((TextElement)sortPingBtn).text = (string)((VisualElement)sortPingBtn).userData + ((currentSortMode == 3) ? text : ""); ((TextElement)sortPlayersBtn).text = (string)((VisualElement)sortPlayersBtn).userData + ((currentSortMode == 1) ? text : ""); ((TextElement)sortNameBtn).text = (string)((VisualElement)sortNameBtn).userData + ((currentSortMode == 2) ? text : ""); } private void UpdateFilterButtonsVisuals() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0030: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) Color val = default(Color); ((Color)(ref val))..ctor(0.5f, 1f, 0.5f); Color white = Color.white; ((VisualElement)filterOpenBtn).style.unityBackgroundImageTintColor = StyleColor.op_Implicit(filterOpenOnly ? val : white); ((TextElement)filterOpenBtn).text = (filterOpenOnly ? "[ON] " : "[OFF] ") + (string)((VisualElement)filterOpenBtn).userData; ((VisualElement)filterThreePlusBtn).style.unityBackgroundImageTintColor = StyleColor.op_Implicit(filterThreePlusPlayers ? val : white); ((TextElement)filterThreePlusBtn).text = (filterThreePlusPlayers ? "[ON] " : "[OFF] ") + (string)((VisualElement)filterThreePlusBtn).userData; } public void DestroyCustomUI() { if (uiRootElement != null) { uiRootElement.RemoveFromHierarchy(); uiRootElement = null; } } private void AutoRefresh() { if ((Object)(object)currentMenuController != (Object)null) { AccessTools.Method(typeof(MenuController), "RefreshLobbyList", (Type[])null, (Type[])null)?.Invoke(currentMenuController, null); } } public async void DoCustomRefresh(MenuController menuController) { currentMenuController = menuController; try { object? value = AccessTools.Field(typeof(MenuController), "serverListRefreshButton").GetValue(menuController); GameObject refreshBtn = (GameObject)((value is GameObject) ? value : null); object? value2 = AccessTools.Field(typeof(MenuController), "serverListElementParent").GetValue(menuController); Transform listParent = (Transform)((value2 is Transform) ? value2 : null); object? value3 = AccessTools.Field(typeof(MenuController), "serverListElementPrefab").GetValue(menuController); GameObject prefab = (GameObject)((value3 is GameObject) ? value3 : null); LobbyManager lobbyManager = Object.FindAnyObjectByType(); if ((Object)(object)refreshBtn != (Object)null) { refreshBtn.SetActive(false); } Lobby[] result = await lobbyManager.GetLobbyList(); if ((Object)(object)refreshBtn != (Object)null) { refreshBtn.SetActive(true); } foreach (Transform item2 in listParent) { Transform child = item2; Object.Destroy((Object)(object)((Component)child).gameObject); } if (result == null || result.Length == 0) { return; } List processedLobbies = new List(); Lobby[] array = result; for (int i = 0; i < array.Length; i++) { Lobby lobbyRef = array[i]; bool.TryParse(((Lobby)(ref lobbyRef)).GetData("hasPassword"), out var hasPass); int currentPlayers = ((Lobby)(ref lobbyRef)).MemberCount; if (!(filterOpenOnly && hasPass) && (!filterThreePlusPlayers || currentPlayers >= 3)) { processedLobbies.Add(new ServerListItem { steamId = ((Lobby)(ref lobbyRef)).Id, serverName = ((Lobby)(ref lobbyRef)).GetData("gnomeGameLobbyName"), maxPlayers = ((Lobby)(ref lobbyRef)).MaxMembers, currentPlayers = currentPlayers, hasPass = hasPass, lobbyRef = lobbyRef }); } } IEnumerable query = processedLobbies; if (currentSortMode == 1) { query = (sortAscending ? query.OrderBy((ServerListItem l) => l.currentPlayers) : query.OrderByDescending((ServerListItem l) => l.currentPlayers)); } else if (currentSortMode == 2) { query = (sortAscending ? query.OrderBy((ServerListItem l) => l.serverName) : query.OrderByDescending((ServerListItem l) => l.serverName)); } else if (currentSortMode == 3 && !sortAscending) { query = query.Reverse(); } processedLobbies = query.OrderByDescending(delegate(ServerListItem l) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Friend owner2 = ((Lobby)(ref l.lobbyRef)).Owner; return ((Friend)(ref owner2)).IsFriend; }).ToList(); foreach (ServerListItem item in processedLobbies) { GameObject go = Object.Instantiate(prefab, listParent, false); go.GetComponent().SetData(item, menuController); Friend owner = ((Lobby)(ref item.lobbyRef)).Owner; if (((Friend)(ref owner)).IsFriend) { Transform obj = go.transform.Find("GameObject/Graphic"); Image bg = ((obj != null) ? ((Component)obj).GetComponent() : null); if ((Object)(object)bg == (Object)null) { bg = go.GetComponent(); } if ((Object)(object)bg != (Object)null) { ((Graphic)bg).color = new Color(1f, 0.9f, 0.5f, 1f); } } } } catch (Exception ex) { Exception ex2 = ex; ((BaseUnityPlugin)this).Logger.LogError((object)$"Error refreshing server list: {ex2}"); } } } [HarmonyPatch(typeof(MenuController), "Start")] public class MenuController_Start_Patch { private static void Postfix(MenuController __instance) { ServerSorterPlugin.Instance.currentMenuController = __instance; ServerSorterPlugin.Instance.BuildCustomUI(); } } [HarmonyPatch(typeof(MenuController), "ActivatePanel")] public class MenuController_ActivatePanel_Patch { private static void Postfix(MenuController __instance, GameObject panel) { //IL_00bd: 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) //IL_00c6: 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_00da: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01c4: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown object? value = AccessTools.Field(typeof(MenuController), "serverListPanel").GetValue(__instance); GameObject val = (GameObject)((value is GameObject) ? value : null); if (!((Object)(object)panel != (Object)null) || !((Object)(object)panel == (Object)(object)val)) { return; } object? value2 = AccessTools.Field(typeof(MenuController), "serverListRefreshButton").GetValue(__instance); GameObject val2 = (GameObject)((value2 is GameObject) ? value2 : null); if (!((Object)(object)val2 != (Object)null)) { return; } Transform val3 = val2.transform.parent.Find("ModCloseButton"); if (!((Object)(object)val3 == (Object)null)) { return; } RectTransform component = val2.GetComponent(); Vector2 anchoredPosition = component.anchoredPosition; component.anchoredPosition = new Vector2(anchoredPosition.x - 70f, anchoredPosition.y); GameObject val4 = Object.Instantiate(val2, val2.transform.parent); ((Object)val4).name = "ModCloseButton"; RectTransform component2 = val4.GetComponent(); component2.anchoredPosition = anchoredPosition; foreach (Transform item in val4.transform) { Transform val5 = item; Object.Destroy((Object)(object)((Component)val5).gameObject); } Image component3 = val4.GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Graphic)component3).color = Color.white; } GameObject val6 = new GameObject("XText"); val6.SetActive(false); val6.transform.SetParent(val4.transform, false); RectTransform val7 = val6.AddComponent(); val7.anchorMin = Vector2.zero; val7.anchorMax = Vector2.one; val7.sizeDelta = Vector2.zero; TextMeshProUGUI val8 = val6.AddComponent(); ((TMP_Text)val8).text = "X"; ((Graphic)val8).color = Color.red; ((TMP_Text)val8).alignment = (TextAlignmentOptions)514; ((TMP_Text)val8).fontSize = 28f; ((TMP_Text)val8).fontStyle = (FontStyles)1; ((TMP_Text)val8).font = TMP_Settings.defaultFontAsset; val6.SetActive(true); Button component4 = val4.GetComponent