using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using R2API.Utils;
using RoR2;
using RoR2.ConVar;
using RoR2.Networking;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TooManyFriends")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TooManyFriends")]
[assembly: AssemblyTitle("TooManyFriends")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace R2API.Utils
{
[AttributeUsage(AttributeTargets.Assembly)]
public class ManualNetworkRegistrationAttribute : Attribute
{
}
}
namespace TooManyFriends
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("dev.wildbook.toomanyfriends", "TooManyFriends", "1.2.5")]
public class TooManyFriends : BaseUnityPlugin
{
private static (int maxPlayers, int hardMaxPlayers, int maxLocalPlayers) _default;
private static ConfigEntry<int> LobbySizeConfig { get; set; }
public static int LobbySize
{
get
{
return LobbySizeConfig.Value;
}
protected set
{
LobbySizeConfig.Value = value;
}
}
public TooManyFriends()
{
_default = (RoR2Application.maxPlayers, RoR2Application.hardMaxPlayers, RoR2Application.maxLocalPlayers);
LobbySizeConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Game", "LobbySize", 16, "Sets the max size of custom game lobbies");
LobbySizeConfig.SettingChanged += delegate
{
SetLobbySize(LobbySize);
};
}
public void OnEnable()
{
SetLobbySize(LobbySize);
}
public void OnDisable()
{
SetLobbySize(_default.maxPlayers, _default.hardMaxPlayers, _default.maxLocalPlayers);
}
public void SetLobbySize(int maxPlayers, int? hardMaxPlayers = null, int? maxLocalPlayers = null)
{
RoR2Application.maxPlayers = maxPlayers;
RoR2Application.hardMaxPlayers = hardMaxPlayers.GetValueOrDefault(maxPlayers);
RoR2Application.maxLocalPlayers = maxLocalPlayers.GetValueOrDefault(maxPlayers);
((BaseConVar)LobbyManager.cvSteamLobbyMaxMembers).defaultValue = maxPlayers.ToString();
LobbyManager.cvSteamLobbyMaxMembers.value = maxPlayers;
((BaseConVar)SvMaxPlayersConVar.instance).SetString(maxPlayers.ToString());
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void CCSetMaxLobbySize(ConCommandArgs args)
{
((ConCommandArgs)(ref args)).CheckArgumentCount(1);
if (int.TryParse(((ConCommandArgs)(ref args))[0], out var result))
{
LobbySizeConfig.Value = result;
Debug.Log((object)$"Lobby max size set to {LobbySizeConfig.Value}.");
}
else
{
Debug.Log((object)"Invalid argument.");
}
}
}
}