Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LoadAllLobby v1.1.7
BepInEx/plugins/LoadAllLobby.dll
Decompiled 6 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Steamworks; using Steamworks.Data; using TMPro; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LoadAllLobby")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LoadAllLobby")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a7c74411-41ca-42e6-a8ec-96aaaecf50f4")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace LoadAllLobby; [BepInPlugin("LoadAllLobby", "LoadAllLobby", "1.1.6")] public class LoadAllLobbyPlugin : BaseUnityPlugin { public const string Version = "1.1.6"; public static ConfigEntry<string> Versions { get; set; } public static ConfigEntry<bool> ShowModLobby { get; set; } public static ConfigEntry<string> CustomHide { get; set; } private void Awake() { Versions = ((BaseUnityPlugin)this).Config.Bind<string>("LoadVersion", "Versions", "9999,[MoreCompany1.8]", "',' split version number and version name ';'split different versions"); ShowModLobby = ((BaseUnityPlugin)this).Config.Bind<bool>("LobbyFilter", "ShowModLobby", false, "显示带有[MOD]的大厅,如果本机安装了LobbyCompatibility模组,无需配置该项,将总是为true"); CustomHide = ((BaseUnityPlugin)this).Config.Bind<string>("LobbyFilter", "CustomHide", "这是测试~~~这是测试2", "自定义隐藏房间,支持正则,使用~~~分割"); Harmony.CreateAndPatchAll(typeof(SteamLobbyPatch), (string)null); } } public static class SteamLobbyPatch { public class LobbyData { public int Version { get; set; } public string Name { get; set; } } [CompilerGenerated] private sealed class <Fix>d__15 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SteamLobbyManager __instance; private Coroutine <coroutine>5__1; private LobbySlot[] <ls>5__2; private LobbySlot[] <>s__3; private int <>s__4; private LobbySlot <item>5__5; private LobbyData <data>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Fix>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <coroutine>5__1 = null; <ls>5__2 = null; <>s__3 = null; <item>5__5 = null; <data>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_00d0: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <coroutine>5__1 = __instance.GetField<SteamLobbyManager, Coroutine>("loadLobbyListCoroutine"); break; case 1: <>1__state = -1; <coroutine>5__1 = __instance.GetField<SteamLobbyManager, Coroutine>("loadLobbyListCoroutine"); break; } if (<coroutine>5__1 != null) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } <ls>5__2 = Object.FindObjectsOfType<LobbySlot>(); <>s__3 = <ls>5__2; for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++) { <item>5__5 = <>s__3[<>s__4]; ((Component)<item>5__5).GetComponent<RectTransform>().sizeDelta = new Vector2(712.88f, ((Component)<item>5__5).GetComponent<RectTransform>().sizeDelta.y); ((Component)<item>5__5.LobbyName).GetComponent<RectTransform>().sizeDelta = new Vector2(712.88f, ((Component)<item>5__5.LobbyName).GetComponent<RectTransform>().sizeDelta.y); if (lobbyDatas.TryGetValue(<item>5__5.lobbyId.Value, out <data>5__6)) { ((TMP_Text)<item>5__5.LobbyName).text = <data>5__6.Name; } <data>5__6 = null; <item>5__5 = null; } <>s__3 = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly Dictionary<int, string> vers = new Dictionary<int, string>(); private static int version = 72; public static readonly Regex ModdedLobbyIdentifierRegex = new Regex("(\\bmod(s|ded)?\\b)", RegexOptions.IgnoreCase); private static Dictionary<ulong, LobbyData> lobbyDatas = new Dictionary<ulong, LobbyData>(); private static int originVersion = 0; public static bool LobbyCompatibility { get; set; } [HarmonyPatch(typeof(GameNetworkManager), "Awake")] [HarmonyPostfix] [HarmonyWrapSafe] [HarmonyPriority(800)] public static void Awake() { LobbyCompatibility = Harmony.HasAnyPatches("BMX.LobbyCompatibility"); version = GameNetworkManager.Instance.gameVersionNum; try { string[] array = LoadAllLobbyPlugin.Versions.Value.Split(new char[1] { ';' }); foreach (string text in array) { string[] array2 = text.Split(new char[1] { ',' }); vers.Add(int.Parse(array2[0]), array2[1]); } } catch (Exception ex) { Debug.LogError((object)ex); } vers.Add(GameNetworkManager.Instance.gameVersionNum, $"[v{GameNetworkManager.Instance.gameVersionNum}]"); vers.Add(GameNetworkManager.Instance.gameVersionNum + 9950, $"[v{GameNetworkManager.Instance.gameVersionNum}|MC1.9]"); } [HarmonyPatch(typeof(GameNetworkManager), "LeaveCurrentSteamLobby")] [HarmonyPostfix] [HarmonyWrapSafe] public static void LeaveCurrentSteamLobby() { if (originVersion != 0) { GameNetworkManager.Instance.gameVersionNum = originVersion; ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().NetworkConfig.ProtocolVersion = (ushort)originVersion; } } [HarmonyPatch(typeof(GameNetworkManager), "LobbyDataIsJoinable")] [HarmonyPrefix] [HarmonyWrapSafe] public static void LobbyDataIsJoinable(Lobby lobby) { if (originVersion == 0) { originVersion = GameNetworkManager.Instance.gameVersionNum; } if (originVersion >= 9999) { string data = ((Lobby)(ref lobby)).GetData("vers"); if (int.TryParse(data, out var result) && ((result != originVersion && originVersion - 9950 == result) || result == 9999)) { Debug.Log((object)$"AutoChangeVersion -> {result}"); GameNetworkManager.Instance.gameVersionNum = result; ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().NetworkConfig.ProtocolVersion = (ushort)result; } } } [HarmonyPatch(typeof(SteamLobbyManager), "LoadServerList")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool LoadServerList(SteamLobbyManager __instance) { LoadAllLobby(__instance); return false; } public static async void LoadAllLobby(SteamLobbyManager __instance) { __instance.censorOffensiveLobbyNames = false; if (originVersion != 0) { GameNetworkManager.Instance.gameVersionNum = originVersion; } Debug.Log((object)GameNetworkManager.Instance.gameVersionNum); lobbyDatas = new Dictionary<ulong, LobbyData>(); __instance.SetField<SteamLobbyManager>("refreshServerListTimer", 0f); ((TMP_Text)__instance.serverListBlankText).text = "Loading server list..."; __instance.SetField<SteamLobbyManager>("currentLobbyList", null); LobbySlot[] array = Object.FindObjectsOfType<LobbySlot>(); for (int i = 0; i < array.Length; i++) { Object.Destroy((Object)(object)((Component)array[i]).gameObject); } List<Lobby> lobbies = new List<Lobby>(); int hidecsnum = 0; string[] lines = LoadAllLobbyPlugin.CustomHide.Value.Split(new string[1] { "~~~" }, StringSplitOptions.None); foreach (KeyValuePair<int, string> item in vers.OrderBy((KeyValuePair<int, string> x) => (GameNetworkManager.Instance.gameVersionNum != x.Key) ? x.Key : 0)) { ((TMP_Text)__instance.serverListBlankText).text = "Loading " + item.Value + " server list..."; int sortByDistanceSetting = __instance.sortByDistanceSetting; LobbyQuery lobbyQuery = default(LobbyQuery); LobbyQuery val; switch (sortByDistanceSetting) { case 0: val = SteamMatchmaking.LobbyList; ((LobbyQuery)(ref val)).FilterDistanceClose(); val = SteamMatchmaking.LobbyList; val = ((LobbyQuery)(ref val)).FilterDistanceClose(); val = ((LobbyQuery)(ref val)).WithSlotsAvailable(1); lobbyQuery = ((LobbyQuery)(ref val)).WithKeyValue("vers", item.Key.ToString()); break; case 1: val = SteamMatchmaking.LobbyList; ((LobbyQuery)(ref val)).FilterDistanceFar(); val = SteamMatchmaking.LobbyList; val = ((LobbyQuery)(ref val)).FilterDistanceFar(); val = ((LobbyQuery)(ref val)).WithSlotsAvailable(1); lobbyQuery = ((LobbyQuery)(ref val)).WithKeyValue("vers", item.Key.ToString()); break; default: val = SteamMatchmaking.LobbyList; ((LobbyQuery)(ref val)).FilterDistanceWorldwide(); val = SteamMatchmaking.LobbyList; val = ((LobbyQuery)(ref val)).FilterDistanceWorldwide(); val = ((LobbyQuery)(ref val)).WithSlotsAvailable(1); lobbyQuery = ((LobbyQuery)(ref val)).WithKeyValue("vers", item.Key.ToString()); break; } if (!((Behaviour)__instance.sortWithChallengeMoonsCheckbox).enabled) { lobbyQuery = ((LobbyQuery)(ref lobbyQuery)).WithKeyValue("chal", "f"); } if (__instance.serverTagInputField.text != string.Empty) { lobbyQuery = ((LobbyQuery)(ref lobbyQuery)).WithKeyValue("tag", __instance.serverTagInputField.text.Substring(0, Mathf.Min(19, __instance.serverTagInputField.text.Length)).ToLower()); } lobbyQuery = ((LobbyQuery)(ref lobbyQuery)).WithMaxResults(int.MaxValue); Lobby[] lobby = await ((LobbyQuery)(ref lobbyQuery)).RequestAsync(); if (lobby != null) { Lobby[] array2 = lobby; for (int j = 0; j < array2.Length; j++) { Lobby item2 = array2[j]; string name = ((Lobby)(ref item2)).GetData("name"); if (!ModdedLobbyIdentifierRegex.IsMatch(name) || LoadAllLobbyPlugin.ShowModLobby.Value || LobbyCompatibility) { if (lines.Any() && lines.Any((string x) => !Utility.IsNullOrWhiteSpace(x) && Regex.IsMatch(name, x, RegexOptions.None, TimeSpan.FromSeconds(0.1)))) { hidecsnum++; continue; } lobbyDatas.Add(SteamId.op_Implicit(((Lobby)(ref item2)).Id), new LobbyData { Version = item.Key, Name = item.Value + name }); lobbies.Add(item2); } } } lobbyQuery = default(LobbyQuery); } if (lines.Any()) { Debug.Log((object)$"自定义规则已过滤 {hidecsnum} 个房间"); } __instance.SetField<SteamLobbyManager>("currentLobbyList", lobbies.ToArray()); if (lobbies.Count == 0) { ((TMP_Text)__instance.serverListBlankText).text = "No available servers to join."; } else { ((TMP_Text)__instance.serverListBlankText).text = ""; } __instance.SetField<SteamLobbyManager>("lobbySlotPositionOffset", 0f); __instance.SetField<SteamLobbyManager>("loadLobbyListCoroutine", ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)typeof(SteamLobbyManager).GetMethod("loadLobbyListAndFilter", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(__instance, new object[1] { lobbies.ToArray() }))); ((MonoBehaviour)__instance).StartCoroutine(Fix(__instance)); } [IteratorStateMachine(typeof(<Fix>d__15))] public static IEnumerator Fix(SteamLobbyManager __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Fix>d__15(0) { __instance = __instance }; } public static T2 GetField<T, T2>(this T obj, string name) { return (T2)obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField).GetValue(obj); } public static void SetField<T>(this T obj, string name, object value) { obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField).SetValue(obj, value); } }
LoadAllLobby.dll
Decompiled 6 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Steamworks; using Steamworks.Data; using TMPro; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LoadAllLobby")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LoadAllLobby")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a7c74411-41ca-42e6-a8ec-96aaaecf50f4")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace LoadAllLobby; [BepInPlugin("LoadAllLobby", "LoadAllLobby", "1.1.7")] public class LoadAllLobbyPlugin : BaseUnityPlugin { public const string Version = "1.1.7"; public static ConfigEntry<string> Versions { get; set; } public static ConfigEntry<bool> ShowModLobby { get; set; } public static ConfigEntry<string> CustomHide { get; set; } private void Awake() { Versions = ((BaseUnityPlugin)this).Config.Bind<string>("LoadVersion", "Versions", "9999,[MoreCompany1.8]", "',' split version number and version name ';'split different versions"); ShowModLobby = ((BaseUnityPlugin)this).Config.Bind<bool>("LobbyFilter", "ShowModLobby", false, "显示带有[MOD]的大厅,如果本机安装了LobbyCompatibility模组,无需配置该项,将总是为true"); CustomHide = ((BaseUnityPlugin)this).Config.Bind<string>("LobbyFilter", "CustomHide", "这是测试~~~这是测试2", "自定义隐藏房间,支持正则,使用~~~分割"); Harmony.CreateAndPatchAll(typeof(SteamLobbyPatch), (string)null); } } public static class SteamLobbyPatch { public class LobbyData { public int Version { get; set; } public string Name { get; set; } } [CompilerGenerated] private sealed class <Fix>d__15 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SteamLobbyManager __instance; private Coroutine <coroutine>5__1; private LobbySlot[] <ls>5__2; private LobbySlot[] <>s__3; private int <>s__4; private LobbySlot <item>5__5; private LobbyData <data>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Fix>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <coroutine>5__1 = null; <ls>5__2 = null; <>s__3 = null; <item>5__5 = null; <data>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_00d0: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <coroutine>5__1 = __instance.GetField<SteamLobbyManager, Coroutine>("loadLobbyListCoroutine"); break; case 1: <>1__state = -1; <coroutine>5__1 = __instance.GetField<SteamLobbyManager, Coroutine>("loadLobbyListCoroutine"); break; } if (<coroutine>5__1 != null) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } <ls>5__2 = Object.FindObjectsOfType<LobbySlot>(); <>s__3 = <ls>5__2; for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++) { <item>5__5 = <>s__3[<>s__4]; ((Component)<item>5__5).GetComponent<RectTransform>().sizeDelta = new Vector2(712.88f, ((Component)<item>5__5).GetComponent<RectTransform>().sizeDelta.y); ((Component)<item>5__5.LobbyName).GetComponent<RectTransform>().sizeDelta = new Vector2(712.88f, ((Component)<item>5__5.LobbyName).GetComponent<RectTransform>().sizeDelta.y); if (lobbyDatas.TryGetValue(<item>5__5.lobbyId.Value, out <data>5__6)) { ((TMP_Text)<item>5__5.LobbyName).text = <data>5__6.Name; } <data>5__6 = null; <item>5__5 = null; } <>s__3 = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly Dictionary<int, string> vers = new Dictionary<int, string>(); private static int version = 73; public static readonly Regex ModdedLobbyIdentifierRegex = new Regex("(\\bmod(s|ded)?\\b)", RegexOptions.IgnoreCase); private static Dictionary<ulong, LobbyData> lobbyDatas = new Dictionary<ulong, LobbyData>(); private static int originVersion = 0; public static bool LobbyCompatibility { get; set; } [HarmonyPatch(typeof(GameNetworkManager), "Awake")] [HarmonyPostfix] [HarmonyWrapSafe] [HarmonyPriority(800)] public static void Awake() { if (GameNetworkManager.Instance.disableSteam) { return; } LobbyCompatibility = Harmony.HasAnyPatches("BMX.LobbyCompatibility"); version = GameNetworkManager.Instance.gameVersionNum; try { string[] array = LoadAllLobbyPlugin.Versions.Value.Split(new char[1] { ';' }); foreach (string text in array) { if (text == "9999|[MoreCompany1.8]") { vers.Add(9999, "[MoreCompany1.8]"); continue; } string[] array2 = text.Split(new char[1] { ',' }); vers.Add(int.Parse(array2[0]), array2[1]); } } catch (Exception ex) { Debug.LogError((object)ex); } vers.Add(GameNetworkManager.Instance.gameVersionNum, $"[v{GameNetworkManager.Instance.gameVersionNum}]"); vers.Add(GameNetworkManager.Instance.gameVersionNum + 9950, $"[v{GameNetworkManager.Instance.gameVersionNum}|MC1.9]"); } [HarmonyPatch(typeof(GameNetworkManager), "LeaveCurrentSteamLobby")] [HarmonyPostfix] [HarmonyWrapSafe] public static void LeaveCurrentSteamLobby() { if (!GameNetworkManager.Instance.disableSteam && originVersion != 0) { GameNetworkManager.Instance.gameVersionNum = originVersion; ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().NetworkConfig.ProtocolVersion = (ushort)originVersion; } } [HarmonyPatch(typeof(GameNetworkManager), "LobbyDataIsJoinable")] [HarmonyPrefix] [HarmonyWrapSafe] public static void LobbyDataIsJoinable(Lobby lobby) { if (GameNetworkManager.Instance.disableSteam) { return; } if (originVersion == 0) { originVersion = GameNetworkManager.Instance.gameVersionNum; } if (originVersion >= 9999) { string data = ((Lobby)(ref lobby)).GetData("vers"); if (int.TryParse(data, out var result) && ((result != originVersion && originVersion - 9950 == result) || result == 9999)) { Debug.Log((object)$"AutoChangeVersion -> {result}"); GameNetworkManager.Instance.gameVersionNum = result; ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().NetworkConfig.ProtocolVersion = (ushort)result; } } } [HarmonyPatch(typeof(SteamLobbyManager), "LoadServerList")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool LoadServerList(SteamLobbyManager __instance) { if (GameNetworkManager.Instance.disableSteam) { return true; } LoadAllLobby(__instance); return false; } public static async void LoadAllLobby(SteamLobbyManager __instance) { __instance.censorOffensiveLobbyNames = false; if (originVersion != 0) { GameNetworkManager.Instance.gameVersionNum = originVersion; } Debug.Log((object)GameNetworkManager.Instance.gameVersionNum); lobbyDatas = new Dictionary<ulong, LobbyData>(); __instance.SetField<SteamLobbyManager>("refreshServerListTimer", 0f); ((TMP_Text)__instance.serverListBlankText).text = "Loading server list..."; __instance.SetField<SteamLobbyManager>("currentLobbyList", null); LobbySlot[] array = Object.FindObjectsOfType<LobbySlot>(); for (int i = 0; i < array.Length; i++) { Object.Destroy((Object)(object)((Component)array[i]).gameObject); } List<Lobby> lobbies = new List<Lobby>(); int hidecsnum = 0; string[] lines = new string[0]; if (!string.IsNullOrWhiteSpace(LoadAllLobbyPlugin.CustomHide.Value)) { lines = LoadAllLobbyPlugin.CustomHide.Value.Split(new string[1] { "~~~" }, StringSplitOptions.None); } foreach (KeyValuePair<int, string> item in vers.OrderBy((KeyValuePair<int, string> x) => (GameNetworkManager.Instance.gameVersionNum != x.Key) ? x.Key : 0)) { ((TMP_Text)__instance.serverListBlankText).text = "Loading " + item.Value + " server list..."; int sortByDistanceSetting = __instance.sortByDistanceSetting; LobbyQuery lobbyQuery = default(LobbyQuery); LobbyQuery val; switch (sortByDistanceSetting) { case 0: val = SteamMatchmaking.LobbyList; ((LobbyQuery)(ref val)).FilterDistanceClose(); val = SteamMatchmaking.LobbyList; val = ((LobbyQuery)(ref val)).FilterDistanceClose(); val = ((LobbyQuery)(ref val)).WithSlotsAvailable(1); lobbyQuery = ((LobbyQuery)(ref val)).WithKeyValue("vers", item.Key.ToString()); break; case 1: val = SteamMatchmaking.LobbyList; ((LobbyQuery)(ref val)).FilterDistanceFar(); val = SteamMatchmaking.LobbyList; val = ((LobbyQuery)(ref val)).FilterDistanceFar(); val = ((LobbyQuery)(ref val)).WithSlotsAvailable(1); lobbyQuery = ((LobbyQuery)(ref val)).WithKeyValue("vers", item.Key.ToString()); break; default: val = SteamMatchmaking.LobbyList; ((LobbyQuery)(ref val)).FilterDistanceWorldwide(); val = SteamMatchmaking.LobbyList; val = ((LobbyQuery)(ref val)).FilterDistanceWorldwide(); val = ((LobbyQuery)(ref val)).WithSlotsAvailable(1); lobbyQuery = ((LobbyQuery)(ref val)).WithKeyValue("vers", item.Key.ToString()); break; } if (!((Behaviour)__instance.sortWithChallengeMoonsCheckbox).enabled) { lobbyQuery = ((LobbyQuery)(ref lobbyQuery)).WithKeyValue("chal", "f"); } if (__instance.serverTagInputField.text != string.Empty) { lobbyQuery = ((LobbyQuery)(ref lobbyQuery)).WithKeyValue("tag", __instance.serverTagInputField.text.Substring(0, Mathf.Min(19, __instance.serverTagInputField.text.Length)).ToLower()); } lobbyQuery = ((LobbyQuery)(ref lobbyQuery)).WithMaxResults(int.MaxValue); Lobby[] lobby = await ((LobbyQuery)(ref lobbyQuery)).RequestAsync(); if (lobby != null) { Lobby[] array2 = lobby; for (int j = 0; j < array2.Length; j++) { Lobby item2 = array2[j]; string name = ((Lobby)(ref item2)).GetData("name"); if (!ModdedLobbyIdentifierRegex.IsMatch(name) || LoadAllLobbyPlugin.ShowModLobby.Value || LobbyCompatibility) { if (lines.Any() && lines.Any((string x) => !Utility.IsNullOrWhiteSpace(x) && Regex.IsMatch(name, x, RegexOptions.None, TimeSpan.FromSeconds(0.1)))) { hidecsnum++; continue; } lobbyDatas.Add(SteamId.op_Implicit(((Lobby)(ref item2)).Id), new LobbyData { Version = item.Key, Name = item.Value + name }); lobbies.Add(item2); } } } lobbyQuery = default(LobbyQuery); } if (lines.Any()) { Debug.Log((object)$"自定义规则已过滤 {hidecsnum} 个房间"); } __instance.SetField<SteamLobbyManager>("currentLobbyList", lobbies.ToArray()); if (lobbies.Count == 0) { ((TMP_Text)__instance.serverListBlankText).text = "No available servers to join."; } else { ((TMP_Text)__instance.serverListBlankText).text = ""; } __instance.SetField<SteamLobbyManager>("lobbySlotPositionOffset", 0f); __instance.SetField<SteamLobbyManager>("loadLobbyListCoroutine", ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)typeof(SteamLobbyManager).GetMethod("loadLobbyListAndFilter", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(__instance, new object[1] { lobbies.ToArray() }))); ((MonoBehaviour)__instance).StartCoroutine(Fix(__instance)); } [IteratorStateMachine(typeof(<Fix>d__15))] public static IEnumerator Fix(SteamLobbyManager __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Fix>d__15(0) { __instance = __instance }; } public static T2 GetField<T, T2>(this T obj, string name) { return (T2)obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField).GetValue(obj); } public static void SetField<T>(this T obj, string name, object value) { obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField).SetValue(obj, value); } }