using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using IL.RoR2.Networking;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using RoR2;
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("DedicatedServerPlayercountFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DedicatedServerPlayercountFix")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("058cc3ba-2e84-4ae8-897d-cab905570021")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DedicatedServerPlayercountFix
{
[BepInPlugin("com.Moffein.DedicatedServerPlayercountFix", "DedicatedServerPlayercountFix", "1.1.1")]
public class DedicatedServerPlayercountFix : BaseUnityPlugin
{
public void Awake()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
NetworkManagerSystemSteam.EnsureDesiredHost += new Manipulator(NetworkManagerSystemSteam_EnsureDesiredHost);
}
private void NetworkManagerSystemSteam_EnsureDesiredHost(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
bool flag = false;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4)
}))
{
val.EmitDelegate<Func<int, int>>((Func<int, int>)((int orig) => RoR2Application.maxPlayers));
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4)
}))
{
val.EmitDelegate<Func<int, int>>((Func<int, int>)((int orig) => RoR2Application.maxPlayers));
flag = true;
}
}
if (!flag)
{
Debug.LogError((object)"DedicatedServerPlayercountFix: IL Hook Failed.");
}
}
}
}
namespace R2API.Utils
{
[AttributeUsage(AttributeTargets.Assembly)]
public class ManualNetworkRegistrationAttribute : Attribute
{
}
}