Decompiled source of ElevenPlayerLobby v1.0.0

GAS_11PlayerMod.dll

Decompiled 3 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Steamworks;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("GAS_11PlayerMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GAS_11PlayerMod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("966bbd93-514e-4ca4-8e91-8010991c6b2c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("sock.11player.mod", "11 Player Lobby Mod", "1.0.3")]
public class ElevenPlayerMod : BaseUnityPlugin
{
	internal static ManualLogSource Log;

	private void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Harmony val = new Harmony("sock.11player.mod");
		val.PatchAll();
		Log.LogInfo((object)"11 Player Lobby Mod Loaded (v1.0.3)");
	}
}
[HarmonyPatch(typeof(SteamLobby), "OnLobbyCreated")]
internal class Patch_SteamLobby_OnLobbyCreated
{
	private static void Postfix(LobbyCreated_t callback)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Invalid comparison between Unknown and I4
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		if ((int)callback.m_eResult == 1)
		{
			CSteamID val = default(CSteamID);
			((CSteamID)(ref val))..ctor(callback.m_ulSteamIDLobby);
			SteamMatchmaking.SetLobbyMemberLimit(val, 11);
			ManualLogSource log = ElevenPlayerMod.Log;
			if (log != null)
			{
				log.LogInfo((object)"Steam lobby member limit forced -> 11");
			}
		}
	}
}
[HarmonyPatch(typeof(LobbyManager), "Awake")]
internal class Patch_LobbyManager_Awake
{
	private static void Postfix(LobbyManager __instance)
	{
		ForceLobbyMax(__instance);
	}

	internal static void ForceLobbyMax(LobbyManager inst)
	{
		typeof(LobbyManager).GetField("maxPlayerCount", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(inst, 11);
		PropertyInfo property = typeof(LobbyManager).GetProperty("NetworkmaxPlayerCount", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (property != null && property.CanWrite)
		{
			property.SetValue(inst, 11, null);
		}
		ManualLogSource log = ElevenPlayerMod.Log;
		if (log != null)
		{
			log.LogInfo((object)"Forced maxPlayerCount / NetworkmaxPlayerCount -> 11");
		}
	}
}
[HarmonyPatch(typeof(LobbyManager), "get_MaxPlayerCount")]
internal class Patch_LobbyManager_GetMaxPlayerCount
{
	private static bool Prefix(ref int __result)
	{
		__result = 11;
		return false;
	}
}
[HarmonyPatch(typeof(LobbyManager), "JoinLobby")]
internal class Patch_LobbyManager_JoinLobby
{
	private static void Prefix(LobbyManager __instance)
	{
		Patch_LobbyManager_Awake.ForceLobbyMax(__instance);
	}
}