Decompiled source of PEAK LobbyControl v1.0.1

PEAKLobbyControl.dll

Decompiled 2 weeks ago
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 BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Steamworks;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("PEAKLobbyControl")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("PEAKLobbyControl")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 PEAKLobbyControl
{
	[HarmonyPatch(typeof(SteamMatchmaking), "CreateLobby")]
	internal class MainMenuMainPagePatch
	{
		private static void Prefix(ref ELobbyType eLobbyType, ref int cMaxMembers)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected I4, but got Unknown
			eLobbyType = (ELobbyType)(int)Plugin.ELobbyType;
			cMaxMembers = Plugin.intMaxPlayers;
		}
	}
	[BepInPlugin("PEAKLobbyControl", "My first plugin", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private ConfigEntry<bool> privateLobby;

		private ConfigEntry<int> maxPlayerCount;

		internal static ManualLogSource Logger;

		public static ELobbyType ELobbyType = (ELobbyType)1;

		public static int intMaxPlayers = 4;

		private void Awake()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin PEAKLobbyControl is loaded!");
			privateLobby = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PrivateLobby", false, "Determines if players can join without invite. Set true to disable \"Join Game\" button for friends.");
			maxPlayerCount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxPlayerCount", 4, "Change the maximum player count. Default is 4.");
			if (privateLobby.Value)
			{
				ELobbyType = (ELobbyType)0;
				Logger.LogInfo((object)"Lobbies will be private!");
			}
			else
			{
				ELobbyType = (ELobbyType)1;
				Logger.LogInfo((object)"Lobbies will be public to your friends list!");
			}
			intMaxPlayers = maxPlayerCount.Value;
			Logger.LogInfo((object)$"Lobbies created by you will have a max player count of: {intMaxPlayers}.");
			Harmony val = new Harmony("com.iswimfly.peaklobbycontrol");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			val.PatchAll(executingAssembly);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "PEAKLobbyControl";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}