using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Steamworks; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BiggerLobbies")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BiggerLobbies")] [assembly: AssemblyTitle("BiggerLobbies")] [assembly: AssemblyVersion("1.0.0.0")] [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; } } } [BepInPlugin("com.adhdcory.biggerlobbies", "How To Fish - Bigger Lobbies", "1.0.3")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; private static ConfigEntry _limit; public static int Limit => _limit.Value; private void Awake() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; _limit = ((BaseUnityPlugin)this).Config.Bind("General", "LobbySize", 32, "Maximum players allowed in a lobby."); new Harmony("com.adhdcory.biggerlobbies").PatchAll(); Log.LogInfo((object)$"Lobby size patch loaded. Limit = {Limit}"); } } [HarmonyPatch(typeof(SteamManager), "CreateLobby")] internal static class CreateLobby_Patch { private static readonly MethodInfo CreateLobbyMethod = AccessTools.Method(typeof(SteamMatchmaking), "CreateLobby", new Type[2] { typeof(ELobbyType), typeof(int) }, (Type[])null); private static readonly MethodInfo LimitGetter = AccessTools.PropertyGetter(typeof(Plugin), "Limit"); private static IEnumerable Transpiler(IEnumerable instructions) { List list = new List(instructions); bool flag = false; for (int i = 1; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], CreateLobbyMethod) && CodeInstructionExtensions.LoadsConstant(list[i - 1])) { list[i - 1].opcode = OpCodes.Call; list[i - 1].operand = LimitGetter; flag = true; Plugin.Log.LogInfo((object)"Rewrote lobby size constant."); break; } } if (!flag) { Plugin.Log.LogError((object)"Could not find the lobby-size constant to patch!"); } return list; } } [HarmonyPatch(typeof(ConnectionManager), "CreateOnlineLobby")] internal static class CreateOnlineLobby_Patch { private static void Prefix(ref int maxPlayers) { maxPlayers = Plugin.Limit; Plugin.Log.LogInfo((object)$"CreateOnlineLobby capped to {Plugin.Limit}"); } }