Please disclose if any significant portion of your mod was created 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 MorePlayersSimple v1.0.12
plugins/MorePlayersSimple.dll
Decompiled 4 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using Photon.Realtime; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MorePlayersSimple")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MorePlayersSimple")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e414bffa-f261-43ba-b6c5-3c2f5941d3af")] [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 MorePlayersSimple; [BepInPlugin("dyxc666.MorePlayersSimple", "More Players Simple", "1.0.11")] public class MorePlayersSimplePlugin : BaseUnityPlugin { internal static ManualLogSource Log; public static ConfigEntry<int> MaxPlayers; internal static string SelfCreatedRoomName = string.Empty; private readonly Harmony harmony = new Harmony("dyxc666.MorePlayersSimple"); private void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; MaxPlayers = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxPlayers", 10, new ConfigDescription("Maximum number of players allowed in a room.\n修改后需重新开房生效。", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); harmony.PatchAll(); Log.LogInfo((object)$"More Players Simple loaded! MaxPlayers = {MaxPlayers.Value}"); } } [HarmonyPatch(typeof(LoadBalancingClient), "OpCreateRoom")] public static class OpCreateRoomPatch { [HarmonyPrefix] public static bool Prefix(EnterRoomParams enterRoomParams) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (enterRoomParams.RoomOptions == null) { enterRoomParams.RoomOptions = new RoomOptions(); } byte b = (byte)MorePlayersSimplePlugin.MaxPlayers.Value; enterRoomParams.RoomOptions.MaxPlayers = b; enterRoomParams.RoomOptions.PlayerTtl = 0; enterRoomParams.RoomOptions.EmptyRoomTtl = 0; if (!string.IsNullOrEmpty(enterRoomParams.RoomName)) { MorePlayersSimplePlugin.SelfCreatedRoomName = enterRoomParams.RoomName; } MorePlayersSimplePlugin.Log.LogInfo((object)$"RoomOptions.MaxPlayers set to {b}"); return true; } } [HarmonyPatch(typeof(LoadBalancingClient), "OpJoinOrCreateRoom")] public static class OpJoinOrCreateRoomPatch { [HarmonyPrefix] public static bool Prefix(EnterRoomParams enterRoomParams) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (enterRoomParams.RoomOptions == null) { enterRoomParams.RoomOptions = new RoomOptions(); } byte b = (byte)MorePlayersSimplePlugin.MaxPlayers.Value; enterRoomParams.RoomOptions.MaxPlayers = b; enterRoomParams.RoomOptions.PlayerTtl = 0; enterRoomParams.RoomOptions.EmptyRoomTtl = 0; if (!string.IsNullOrEmpty(enterRoomParams.RoomName)) { MorePlayersSimplePlugin.SelfCreatedRoomName = enterRoomParams.RoomName; } MorePlayersSimplePlugin.Log.LogInfo((object)$"[JoinOrCreate] RoomOptions.MaxPlayers set to {b}"); return true; } } [HarmonyPatch(typeof(SteamManager), "HostLobby")] public static class HostLobbyPatch { [HarmonyPostfix] public static void Postfix(SteamManager __instance) { try { FieldInfo fieldInfo = AccessTools.Field(typeof(SteamManager), "currentLobby"); if (fieldInfo == null) { return; } object value = fieldInfo.GetValue(__instance); if (value != null) { Type type = value.GetType(); MethodInfo method = type.GetMethod("SetLobbyMemberLimit"); if (method != null) { method.Invoke(value, new object[1] { MorePlayersSimplePlugin.MaxPlayers.Value }); MorePlayersSimplePlugin.Log.LogInfo((object)$"Steam Lobby member limit set to {MorePlayersSimplePlugin.MaxPlayers.Value}"); } } } catch { MorePlayersSimplePlugin.Log.LogWarning((object)"Failed to set Steam lobby member limit."); } } } [HarmonyPatch(typeof(MenuPageServerList), "CreateServerElement")] public static class CreateServerElementPatch { [HarmonyPrefix] public static bool Prefix(object _room) { if (_room == null) { return true; } FieldInfo field = _room.GetType().GetField("roomName", BindingFlags.Instance | BindingFlags.Public); if (field == null) { return true; } string text = field.GetValue(_room) as string; if (string.IsNullOrEmpty(text)) { return true; } bool flag = text == MorePlayersSimplePlugin.SelfCreatedRoomName; if (!flag && PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { flag = text == PhotonNetwork.CurrentRoom.Name; } if (flag) { FieldInfo field2 = _room.GetType().GetField("maxPlayers", BindingFlags.Instance | BindingFlags.Public); if (field2 != null) { field2.SetValue(_room, MorePlayersSimplePlugin.MaxPlayers.Value); } } return true; } }