Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of PilaDeGente v1.0.0
PilaDeGente.dll
Decompiled a month agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using On.RoR2; using RoR2; using RoR2.ConVar; 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: AssemblyVersion("0.0.0.0")] namespace PilaDeGente; [BepInPlugin("com.ricantar.piladegente", "PilaDeGente", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PilaDeGente : BaseUnityPlugin { private ConfigEntry<int> _lobbySize; private static ConfigEntry<int> LobbySizeConfig { get; set; } public static int LobbySize => LobbySizeConfig?.Value ?? 8; public void Awake() { _lobbySize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "LobbySize", 8, "Número máximo de jugadores permitidos en el lobby (default = 8)."); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[PilaDeGente] Aplicando tamaño máximo del lobby: {_lobbySize.Value}"); ApplyLobbySize(_lobbySize.Value); }); _lobbySize.SettingChanged += delegate { ApplyLobbySize(_lobbySize.Value); }; } private void ApplyLobbySize(int newSize) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown try { typeof(RoR2Application).GetField("[PilaDeGente] maxPlayers", BindingFlags.Static | BindingFlags.NonPublic)?.SetValue(null, newSize); typeof(RoR2Application).GetField("[PilaDeGente] hardMaxPlayers", BindingFlags.Static | BindingFlags.NonPublic)?.SetValue(null, newSize); typeof(RoR2Application).GetField("[PilaDeGente] maxLocalPlayers", BindingFlags.Static | BindingFlags.NonPublic)?.SetValue(null, newSize); SteamworksLobbyManager.CreateLobby += (hook_CreateLobby)delegate(orig_CreateLobby orig, SteamworksLobbyManager self) { orig.Invoke(self); try { int lobbySize = LobbySize; BaseConVar val = Console.instance.FindConVar("steam_lobby_max_members"); if (val != null) { val.SetString(lobbySize.ToString()); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[PilaDeGente] Variable 'steam_lobby_max_members' establecida a {lobbySize} jugadores."); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[PilaDeGente] No se encontró la CVar 'steam_lobby_max_members'."); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[PilaDeGente] Lobby máximo actualizado correctamente."); } catch (Exception arg2) { ((BaseUnityPlugin)this).Logger.LogError((object)$"[PilaDeGente] Error configurando el lobby: {arg2}"); } }; } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"[PilaDeGente] Error aplicando tamaño del lobby: {arg}"); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSetLobbySize(ConCommandArgs args) { ((ConCommandArgs)(ref args)).CheckArgumentCount(1); if (int.TryParse(((ConCommandArgs)(ref args))[0], out var result)) { Chainloader.ManagerObject.GetComponent<PilaDeGente>()._lobbySize.Value = result; Debug.Log((object)$"[PilaDeGente] Lobby máximo establecido en {result} jugadores."); } else { Debug.Log((object)"[PilaDeGente] Argumento inválido, usa un número entero."); } } }