using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Steamworks;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("BigMonoLobby")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.1.2.0")]
[assembly: AssemblyInformationalVersion("2.1.2")]
[assembly: AssemblyProduct("Bigger Lobby Mod")]
[assembly: AssemblyTitle("BigMonoLobby")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BigMonoLobby
{
[BepInPlugin("BigMonoLobby", "Bigger Lobby Mod", "2.1.2")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch]
public static class LobbyPatch
{
private static MethodBase TargetMethod()
{
return AccessTools.Method("Online:CreateLobby", (Type[])null, (Type[])null);
}
private static void Prefix(ref int maxPlayers)
{
maxPlayers = MaxPlayers.Value;
}
}
[HarmonyPatch]
public static class LobbyPatchSetMaxLobbyPlayers
{
private static MethodBase TargetMethod()
{
return AccessTools.Method("Online:SetMaxLobbyPlayers", (Type[])null, (Type[])null);
}
private static void Prefix(ref int count)
{
count = MaxPlayers.Value;
}
}
[HarmonyPatch]
public static class Patch_CreateLobby
{
private static MethodBase TargetMethod()
{
return AccessTools.Method(typeof(SteamMatchmaking), "CreateLobbyAsync", new Type[1] { typeof(int) }, (Type[])null);
}
private static void Prefix([HarmonyArgument(0)] ref int maxMembers)
{
Logger.LogInfo((object)$"Overriding MaxPlayers: {maxMembers} → {MaxPlayers.Value}");
maxMembers = MaxPlayers.Value;
}
}
[HarmonyPatch(typeof(GameManager), "IsJoinable")]
public static class JoinablePatch
{
private static bool Prefix(ref JoinResult __result)
{
if (AllowPermaJoin.Value)
{
__result = (JoinResult)0;
Logger.LogInfo((object)"GameManager.JoinResult.IsJoinable");
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Global), "get_LimitPlayerCount")]
public static class Patch_LimitPlayerCount
{
private static bool Prefix(ref bool __result)
{
__result = false;
return false;
}
}
[HarmonyPatch(typeof(GameManager), "Start")]
public static class Patch_GameManager_Start
{
private static void Postfix()
{
if (GameManager.players != null && GameManager.players.Capacity < MaxPlayers.Value)
{
GameManager.players.Capacity = MaxPlayers.Value;
}
}
}
[HarmonyPatch(typeof(StartMenu), "Start")]
public static class Patch_StartMenu_Start
{
private static void Postfix()
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)lg == (Object)null)
{
LoadEmbeddedAssetBundle();
}
if (!((Object)(object)StartMenu.Instance == (Object)null))
{
Transform obj = Object.Instantiate<Transform>(((Component)StartMenu.Instance).transform.GetChild(1).GetChild(9), ((Component)StartMenu.Instance).transform.GetChild(1).GetChild(9));
((Component)obj.GetChild(0)).gameObject.SetActive(false);
obj.localPosition = new Vector3(686.1016f, -258.7273f, 0f);
obj.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 7.0052f));
obj.localScale = new Vector3(0.225f, 0.225f, 0.225f);
((Component)obj).GetComponent<Image>().sprite = lg;
}
}
}
internal static ManualLogSource Logger;
public static ConfigEntry<int> MaxPlayers;
public static ConfigEntry<bool> AllowPermaJoin;
public static ConfigEntry<string> LobbyName;
public static AssetBundle assets;
public static Sprite lg;
public void Awake()
{
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin BigMonoLobby is loaded!");
MaxPlayers = ((BaseUnityPlugin)this).Config.Bind<int>("BigLobbyMod", "MaxPlayers", 32, "Maximum number of players allowed in a lobby");
AllowPermaJoin = ((BaseUnityPlugin)this).Config.Bind<bool>("BigLobbyMod", "AllowPermaJoin", false, "Make the lobby always joinable");
Logger.LogInfo((object)$"Config loaded. MaxPlayers = {MaxPlayers.Value}");
new Harmony("com.catalyss.biglobby").PatchAll();
}
public static void LoadEmbeddedAssetBundle()
{
Logger.LogInfo((object)"Loading embedded AssetBundle...");
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string text = executingAssembly.GetManifestResourceNames().FirstOrDefault((string name) => name.EndsWith("biglobby"));
if (text == null)
{
Logger.LogError((object)"Embedded resource 'biglobby' not found!");
return;
}
using (Stream stream = executingAssembly.GetManifestResourceStream(text))
{
if (stream == null)
{
Logger.LogError((object)"Failed to get stream for embedded AssetBundle 'biglobby'.");
return;
}
using MemoryStream memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
assets = AssetBundle.LoadFromMemory(memoryStream.ToArray());
}
if ((Object)(object)assets == (Object)null)
{
Logger.LogError((object)"Failed to load AssetBundle from memory.");
return;
}
Logger.LogInfo((object)"AssetBundle 'biglobby' loaded successfully.");
lg = assets.LoadAsset<Sprite>("biglobby_subtext");
if ((Object)(object)lg == (Object)null)
{
Logger.LogError((object)"Failed to load 'biglobby_subtext' prefab from AssetBundle.");
}
else
{
Logger.LogInfo((object)"Prefab 'biglobby_subtext' loaded successfully.");
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "BigMonoLobby";
public const string PLUGIN_NAME = "Bigger Lobby Mod";
public const string PLUGIN_VERSION = "2.1.2";
}
}