using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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 BepInEx.Logging;
using Gameplay.MissionDifficulty;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Steamworks;
using UI.Settings;
using UnityEngine.UIElements;
using VoidManager;
using VoidManager.MPModChecks;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("1.1.0.9974")]
[assembly: AssemblyInformationalVersion("1.1.0+26f6e711a0")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HobosInSpace")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyDescription("This mod increases the player max to 8 per lobby.")]
[assembly: AssemblyProduct("Voider_Crew")]
[assembly: AssemblyTitle("Voider_Crew")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/bls220/Voider_Crew")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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;
}
}
}
[GeneratedCode("Nerdbank.GitVersioning.Tasks", "3.6.141.978")]
[ExcludeFromCodeCoverage]
internal static class ThisAssembly
{
internal const string AssemblyConfiguration = "Release";
internal const string AssemblyFileVersion = "1.1.0.9974";
internal const string AssemblyInformationalVersion = "1.1.0+26f6e711a0";
internal const string AssemblyName = "Voider_Crew";
internal const string AssemblyTitle = "Voider_Crew";
internal const string AssemblyVersion = "1.1.0.0";
internal static readonly DateTime GitCommitDate = new DateTime(638611701050000000L, DateTimeKind.Utc);
internal const string GitCommitId = "26f6e711a02f60f10fe1f042debb1e04d354f1ca";
internal const bool IsPrerelease = false;
internal const bool IsPublicRelease = true;
internal const string PluginAuthors = "SubHobo";
internal const string PluginDescription = "This mod increases the player max to 8 per lobby.";
internal const string PluginGUID = "Voider_Crew";
internal const string PluginTitle = "Voider Crew";
internal const string RootNamespace = "Voider_Crew";
}
namespace Voider_Crew
{
[BepInPlugin("Voider_Crew", "Voider Crew", "1.1.0.9974")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(DifficultyPlayerCountTable))]
private static class DifficultyPlayerCountTablePatch
{
[HarmonyFinalizer]
[HarmonyPatch("GetConfig")]
private static Exception? GetConfig_Finalizer(int playerCount, Exception? __exception, DifficultyPlayerCountTable __instance, ref DifficultyConfig __result)
{
if (__exception == null || playerCount <= 4)
{
ManualLogSource? staticLogger = StaticLogger;
if (staticLogger != null)
{
staticLogger.LogDebug((object)$"Found Difficulty config for {playerCount:D} players. Config = {__result}");
}
return __exception;
}
ManualLogSource? staticLogger2 = StaticLogger;
if (staticLogger2 != null)
{
staticLogger2.LogDebug((object)$"Did NOT find Difficulty config for {playerCount:D} players. Config = {__result}");
}
try
{
__result = __instance.GetConfig(4);
return null;
}
catch (Exception)
{
return __exception;
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static class MatchmakingRoomSetupPatch
{
private static IntSetting Patch()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
IntSetting setting = new IntSetting(NewMaxPlayers, 1, NewMaxPlayers);
((Setting<int>)(object)setting).OnValueChanged = (Action<int>)Delegate.Combine(((Setting<int>)(object)setting).OnValueChanged, (Action<int>)delegate(int newVal)
{
OnPlayerLimitChanged(setting, newVal);
});
return setting;
}
private static void OnPlayerLimitChanged(IntSetting setting, int newValue)
{
if (PhotonNetwork.IsMasterClient)
{
((Setting<int>)(object)setting).SetValue(Instance.CurrentMaxPlayer, true);
}
ManualLogSource? staticLogger = StaticLogger;
if (staticLogger != null)
{
staticLogger.LogDebug((object)$"Player limit changed to: {newValue}, setting = {setting.Value}");
}
}
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> Constructor_Transpiler(IEnumerable<CodeInstruction> codeInstructionsEnumerable)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
List<CodeInstruction> list = codeInstructionsEnumerable.ToList();
for (int i = 0; i < list.Count; i++)
{
CodeInstruction val = list[i];
if (val.opcode == OpCodes.Stfld && val.operand == AccessTools.Field(typeof(MatchmakingRoomSetup), "playerLimit"))
{
list.Insert(i, new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MatchmakingRoomSetupPatch), "Patch", (Type[])null, (Type[])null)));
list.Insert(i, new CodeInstruction(OpCodes.Pop, (object)null));
break;
}
}
return list;
}
[HarmonyPostfix]
private static void Constructor_Postfix(VisualElement root)
{
SliderIntSettingEntryVE val = UQueryExtensions.Q<SliderIntSettingEntryVE>(root, "PlayerSlider", new string[2]);
if (val == null)
{
ManualLogSource? staticLogger = StaticLogger;
if (staticLogger != null)
{
staticLogger.LogError((object)"Unable to find the PlayerSlider");
}
return;
}
object? value = AccessTools.Field(typeof(SliderIntSettingEntryVE), "slider").GetValue(val);
SliderInt val2 = (SliderInt)((value is SliderInt) ? value : null);
if (val2 == null)
{
ManualLogSource? staticLogger2 = StaticLogger;
if (staticLogger2 != null)
{
staticLogger2.LogError((object)"Unable to find the PlayerSlider.slider");
}
return;
}
((BaseSlider<int>)(object)val2).highValue = NewMaxPlayers;
INotifyValueChangedExtensions.RegisterValueChangedCallback<int>((INotifyValueChanged<int>)(object)val2, (EventCallback<ChangeEvent<int>>)delegate(ChangeEvent<int> evt)
{
ManualLogSource? staticLogger3 = StaticLogger;
if (staticLogger3 != null)
{
staticLogger3.LogDebug((object)$"Player limit slider changed to {evt.newValue}");
}
Instance.CurrentMaxPlayer = evt.newValue;
});
}
}
[HarmonyPatch(typeof(SteamMatchmaking))]
private static class SteamMatchmakingPatch
{
[HarmonyPrefix]
[HarmonyPatch("CreateLobby")]
private static void CreateLobby_Prefix(ELobbyType eLobbyType, ref int cMaxMembers)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource? staticLogger = StaticLogger;
if (staticLogger != null)
{
staticLogger.LogDebug((object)$"Intercepted CreateLobby with LobbyType: {eLobbyType}, MaxMembers: {cMaxMembers}. Changing to {NewMaxPlayers}");
}
cMaxMembers = NewMaxPlayers;
}
}
private static readonly Harmony _harmony = new Harmony("Voider_Crew");
public static ManualLogSource? StaticLogger { get; private set; }
public static Plugin Instance { get; private set; } = null;
protected static int NewMaxPlayers { get; private set; } = 8;
private int CurrentMaxPlayer { get; set; } = 4;
protected Plugin()
{
Instance = this;
}
private void Awake()
{
//IL_0028: Expected O, but got Unknown
StaticLogger = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogDebug((object)"Plugin Voider_Crew is loading!");
try
{
_harmony.PatchAll();
}
catch (HarmonyException val)
{
HarmonyException val2 = val;
((BaseUnityPlugin)this).Logger.LogError((object)((Exception)(object)val2).Message);
((BaseUnityPlugin)this).Logger.LogError((object)"Plugin Voider_Crew failed to patch!");
return;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Voider_Crew is loaded!");
}
}
public class VoidManagerPlugin : VoidPlugin
{
public override MultiplayerType MPType => (MultiplayerType)30;
public override string Author => "SubHobo";
public override string Description => "This mod increases the player max to 8 per lobby.";
}
internal static class VoidManagerInfo
{
public const string PLUGIN_AUTHORS = "SubHobo";
public const string PLUGIN_DESCRIPTION = "This mod increases the player max to 8 per lobby.";
}
}