using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("WWAG_4Player")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WWAG_4Player")] [assembly: AssemblyTitle("WWAG_4Player")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } } [BepInPlugin("com.NikoTheFox.WWAG_4Player", "More players in Multiplayer", "1.0.2")] public class FourPlayer : BaseUnityPlugin { private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("com.NikoTheFox.WWAG_4Player"); val.PatchAll(Assembly.GetExecutingAssembly()); } } [HarmonyPatch(typeof(NetworkSimpleHostPlayer), "StartClient")] public static class StartClientPatch { [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { List list = new List(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_I4_3) { list[i].operand = 15; list[i].opcode = OpCodes.Ldc_I4_S; break; } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(NetworkBootstrapUI), "Host")] public static class HostPatch { [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { List list = new List(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_I4_3) { list[i].operand = 15; list[i].opcode = OpCodes.Ldc_I4_S; break; } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(NetworkCheckStartBypass), "CheckBootstrap")] public static class CheckBootstrapPatch { [HarmonyTranspiler] public static IEnumerable Transpiler(IEnumerable instructions) { List list = new List(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_I4_3) { list[i].operand = 15; list[i].opcode = OpCodes.Ldc_I4_S; break; } } return list.AsEnumerable(); } } namespace WWAG_4Player { public static class PluginInfo { public const string PLUGIN_GUID = "WWAG_4Player"; public const string PLUGIN_NAME = "WWAG_4Player"; public const string PLUGIN_VERSION = "1.0.0"; } }