Decompiled source of MorePlayers v1.1.0

DarkwaterMorePlayers.dll

Decompiled 3 weeks ago
using System;
using System.CodeDom.Compiler;
using System.Configuration;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Fusion;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("DarkwaterMorePlayers")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0f7a3ea004e930e695821042f191e76850c23f32")]
[assembly: AssemblyProduct("DarkwaterMorePlayers")]
[assembly: AssemblyTitle("DarkwaterMorePlayers")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 DarkwaterMorePlayers.Properties
{
	[CompilerGenerated]
	[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
	internal sealed class Settings : ApplicationSettingsBase
	{
		private static Settings defaultInstance = (Settings)(object)SettingsBase.Synchronized((SettingsBase)(object)new Settings());

		public static Settings Default => defaultInstance;
	}
}
namespace MorePlayers
{
	[BepInPlugin("eu.puszkapotato.darkwater.moreplayers", "More Players", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigEntry<int> MaxPlayersConfig;

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			MaxPlayersConfig = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxPlayers", 8, "The maximum number of players allowed in a lobby.");
			new Harmony("eu.puszkapotato.darkwater.moreplayers").PatchAll();
			Log.LogInfo((object)"More Players mod (Fusion Patcher) has been loaded!");
		}
	}
	[HarmonyPatch]
	public static class FusionPatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(NetworkRunner), "StartGame")]
		private static void StartGamePrefix(ref StartGameArgs args)
		{
			Plugin.Log.LogInfo((object)$"Intercepted NetworkRunner.StartGame. Original PlayerCount: {args.PlayerCount}.");
			int value = Plugin.MaxPlayersConfig.Value;
			args.PlayerCount = value;
			Plugin.Log.LogInfo((object)$"Overriding PlayerCount with {value}.");
		}
	}
}