Decompiled source of Even More Players v9.2.5

EvenMorePlayersMod/MorePlayersMod.dll

Decompiled 5 months ago
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 System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using GameEvent;
using HarmonyLib;
using I2.Loc;
using InControl;
using Moserware.Skills;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyInformationalVersion("0.9.0.2.5")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.9.0.2")]
[module: UnverifiableCode]
namespace MorePlayers;

[BepInPlugin("EvenMorePlayers", "EvenMorePlayers", "0.9.0.2")]
public class MorePlayersMod : BaseUnityPlugin
{
	public static ConfigEntry<int> newPlayerLimit;

	public static ConfigEntry<bool> fullDebug;

	public static ConfigEntry<bool> shuffleScoreBalancer;

	public static string og_version;

	public static string mod_version = "0.9.0.2";

	public static string mod_version_full = " [EvenMorePlayers: " + mod_version + "]";

	private void Awake()
	{
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		newPlayerLimit = ((BaseUnityPlugin)this).Config.Bind<int>("General", "newPlayerLimit", 100, "Maximum number of Players");
		fullDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "fullDebug", false, "Enable more lines in debug output");
		shuffleScoreBalancer = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "shuffleScoreBalancer", true, "On the Score Balancer in the Treehouse show the Player that last change it on top");
		og_version = GameSettings.GetInstance().versionNumber;
		PlayerManager.maxPlayers = newPlayerLimit.Value;
		new Harmony("EvenMorePlayers.PlayerNumPatch").PatchAll();
		MenuPatch.PatchMenu();
		Debug.Log((object)"[MorePlayersMod] started.");
	}
}
[HarmonyPatch]
internal static class Switch4ForMaxNumPatch
{
	private static IEnumerable<MethodBase> TargetMethods()
	{
		yield return AccessTools.Method(typeof(BeeSwarm), "Awake", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(ChallengeScoreboard), "CollectPlayerIds", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(Controller), "AddPlayer", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(Controller), "AssociateCharacter", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(ControllerDisconnect), "SetPromptForPlayer", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(GraphScoreBoard), "SetPlayerCount", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(InventoryBook), "AddPlayer", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(InventoryBook), "GetCursor", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(InventoryBook), "HasCursor", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(KeyboardInput), "Reset", (Type[])null, (Type[])null);
		yield return AccessTools.Constructor(typeof(KickTracker), (Type[])null, false);
		yield return AccessTools.Method(typeof(KickTracker), "ClearPlayer", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(KickTracker), "CountVotes", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(KickTracker), "VotesFromNetworkNumber", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(LobbyPointCounter), "handleEvent", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(PartyBox), "SetPlayerCount", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(PickableNetworkButton), "OnAccept", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(PlayerStatusDisplay), "SetSlotCount", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(StatTracker), "GetSaveFileDataForLocalPlayer", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(StatTracker), "OnLocalPlayerAdded", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(StatTracker), "SaveGameForAnimal", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(SteamLobbySearchList), "checkForListUpdates", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(SteamMatchmaker), "createSocialLobby", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(SwitchController), "Reset", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(TurnIndicator), "SetPlayerCount", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(UnityMatchmaker), "CheckHostConnectivity", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(VersusControl), "get_playersLeftToPlace", (Type[])null, (Type[])null);
	}

	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> e)
	{
		foreach (CodeInstruction inst in e)
		{
			if (inst.opcode == OpCodes.Ldc_I4_4)
			{
				inst.opcode = OpCodes.Ldc_I4;
				inst.operand = PlayerManager.maxPlayers;
			}
			yield return inst;
		}
	}
}
[HarmonyPatch]
internal static class SwitchFirst4ForMaxNumPatch
{
	private static IEnumerable<MethodBase> TargetMethods()
	{
		yield return AccessTools.Method(typeof(PartyBox), "AddPlayer", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(LobbySkillTracker), "RecalculateScores", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(PickableNetworkButton), "Update", (Type[])null, (Type[])null);
	}

	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> e)
	{
		int count = 0;
		foreach (CodeInstruction inst in e)
		{
			if (inst.opcode == OpCodes.Ldc_I4_4 && count == 0)
			{
				inst.opcode = OpCodes.Ldc_I4;
				inst.operand = PlayerManager.maxPlayers;
				count++;
			}
			yield return inst;
		}
	}
}
[HarmonyPatch]
internal static class SwitchSecond4ForMaxNumPatch
{
	private static IEnumerable<MethodBase> TargetMethods()
	{
		yield return AccessTools.Method(typeof(LobbySkillTracker), "UpdateLobbyInfo", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(UnityMatchmaker), "onLobbyJoined", (Type[])null, (Type[])null);
	}

	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> e)
	{
		int count = 0;
		foreach (CodeInstruction inst in e)
		{
			if (inst.opcode == OpCodes.Ldc_I4_4)
			{
				if (count == 1)
				{
					inst.opcode = OpCodes.Ldc_I4;
					inst.operand = PlayerManager.maxPlayers;
				}
				count++;
			}
			yield return inst;
		}
	}
}
[HarmonyPatch]
internal static class Switch5ForNumPlusOnePatch
{
	private static IEnumerable<MethodBase> TargetMethods()
	{
		yield return AccessTools.Method(typeof(SteamMatchmaker), "OnSteamLobbyJoinRequested", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(LobbyManager), "OnLobbyClientAddPlayerFailed", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(Matchmaker), "CleanUpPlayers", (Type[])null, (Type[])null);
	}

	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> e)
	{
		foreach (CodeInstruction inst in e)
		{
			if (inst.opcode == OpCodes.Ldc_I4_4)
			{
				inst.opcode = OpCodes.Ldc_I4;
				inst.operand = PlayerManager.maxPlayers + 1;
			}
			yield return inst;
		}
	}
}
[HarmonyPatch]
internal static class Switch3ForNumMinusOnePatch
{
	private static IEnumerable<MethodBase> TargetMethods()
	{
		yield return AccessTools.Method(typeof(Controller), "GetLastPlayerNumber", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(Controller), "GetLastPlayerNumberAfter", (Type[])null, (Type[])null);
		yield return AccessTools.Method(typeof(GraphScoreBoard), "SetPlayerCharacter", (Type[])null, (Type[])null);
	}

	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> e)
	{
		foreach (CodeInstruction inst in e)
		{
			if (inst.opcode == OpCodes.Ldc_I4_3)
			{
				inst.opcode = OpCodes.Ldc_I4;
				inst.operand = PlayerManager.maxPlayers - 1;
			}
			yield return inst;
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal static class ChallengeScoreboardCtorPatch
{
	private static void Postfix(ChallengeScoreboard __instance)
	{
		__instance.players = (ChallengePlayer[])(object)new ChallengePlayer[PlayerManager.maxPlayers];
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal static class TabletCtorPatch
{
	private static void Postfix(Tablet __instance)
	{
		__instance.untrackedCursors = new List<PickCursor>(PlayerManager.maxPlayers);
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal static class ControllerCtorPatch
{
	private static void Postfix(Controller __instance)
	{
		__instance.associatedChars = (Animals[])(object)new Animals[PlayerManager.maxPlayers];
	}
}
[HarmonyPatch(typeof(Controller), "ClearPlayers")]
internal static class ControllerClearPlayersPatch
{
	private static void Postfix(Controller __instance)
	{
		__instance.associatedChars = (Animals[])(object)new Animals[PlayerManager.maxPlayers];
	}
}
[HarmonyPatch(typeof(Controller), "RemovePlayer")]
internal static class ControllerRemovePlayerPatch
{
	private static bool Prefix(Controller __instance, int player)
	{
		int num = ~(1 << player - 1);
		__instance.Player &= num;
		__instance.associatedChars[player - 1] = (Animals)0;
		if (__instance.Player == 0)
		{
			__instance.PossibleNetWorkNumber = 0;
		}
		return false;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal static class GameStateCtorPatch
{
	private static void Postfix(GameState __instance)
	{
		__instance.PlayerScores = new int[PlayerManager.maxPlayers];
	}
}
[HarmonyPatch(typeof(GraphScoreBoard), "SetPlayerCount")]
internal static class GraphScoreBoardCtorPatch
{
	private static bool Prefix(GraphScoreBoard __instance, int numberPlayers)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		Array.Resize(ref __instance.ScorePositions, PlayerManager.maxPlayers);
		__instance.playerScoreLines = (ScoreLine[])(object)new ScoreLine[numberPlayers];
		Debug.Log((object)"GraphScoreBoard.SetPlayerCount");
		Vector3 val = ((Transform)__instance.ScorePositions[0]).position + new Vector3(0f, 1.25f, 0f);
		for (int i = 0; i != numberPlayers; i++)
		{
			GameObject val2 = Object.Instantiate<GameObject>(((Component)__instance.scoreLinePrefab).gameObject, val - new Vector3(0f, (float)i * 1.25f, 0f), Quaternion.identity);
			val2.transform.SetParent((Transform)(object)__instance.mainParent);
			val2.transform.localScale = new Vector3(1f, 0.5f, 1f);
			__instance.playerScoreLines[i] = val2.GetComponent<ScoreLine>();
			__instance.playerScoreLines[i].scoreBoardParent = __instance;
		}
		return false;
	}
}
[HarmonyPatch(typeof(LevelSelectController), "Awake")]
internal static class LevelSelectControllerCtorPatch
{
	private static void Postfix(LevelSelectController __instance)
	{
		Debug.Log((object)"fixed LevelSelectController");
		__instance.JoinedPlayers = (LobbyPlayer[])(object)new LobbyPlayer[PlayerManager.maxPlayers];
		if (__instance.PlayerJoinIndicators.Length < PlayerManager.maxPlayers)
		{
			int num = __instance.PlayerJoinIndicators.Length;
			Array.Resize(ref __instance.PlayerJoinIndicators, PlayerManager.maxPlayers);
			for (int i = num; i < __instance.PlayerJoinIndicators.Length; i++)
			{
				__instance.PlayerJoinIndicators[i] = __instance.PlayerJoinIndicators[i % num];
			}
		}
		Debug.Log((object)("CursorSpawnPoint.Length " + __instance.CursorSpawnPoint.Length));
		if (__instance.CursorSpawnPoint.Length < PlayerManager.maxPlayers)
		{
			int num2 = __instance.CursorSpawnPoint.Length;
			Array.Resize(ref __instance.CursorSpawnPoint, PlayerManager.maxPlayers);
			for (int j = num2; j < __instance.CursorSpawnPoint.Length; j++)
			{
				__instance.CursorSpawnPoint[j] = __instance.CursorSpawnPoint[j % num2];
			}
		}
		Debug.Log((object)("UndergroundCharacterPosition.Length " + __instance.UndergroundCharacterPosition.Length));
		if (__instance.UndergroundCharacterPosition.Length < PlayerManager.maxPlayers)
		{
			int num3 = __instance.UndergroundCharacterPosition.Length;
			Array.Resize(ref __instance.UndergroundCharacterPosition, PlayerManager.maxPlayers);
			for (int k = num3; k < __instance.UndergroundCharacterPosition.Length; k++)
			{
				__instance.UndergroundCharacterPosition[k] = __instance.UndergroundCharacterPosition[k % num3];
			}
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal static class LobbyPointCounterCtorPatch
{
	private static void Postfix(LobbyPointCounter __instance)
	{
		__instance.playerJoinedGame = new bool[PlayerManager.maxPlayers];
		__instance.playerPlayedGame = new bool[PlayerManager.maxPlayers];
		__instance.playerAFK = new bool[PlayerManager.maxPlayers];
	}
}
[HarmonyPatch(typeof(LobbyPointCounter), "Reset")]
internal static class LobbyPointCounterResetCtorPatch
{
	private static void Postfix(LobbyPointCounter __instance)
	{
		__instance.playerPlayedGame = new bool[PlayerManager.maxPlayers];
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal static class NetworkLobbyManagerCtorPatch
{
	private static void Postfix(NetworkLobbyManager __instance)
	{
		__instance.maxPlayers = PlayerManager.maxPlayers;
	}
}
[HarmonyPatch(typeof(LobbySkillTracker), "Start")]
internal static class LobbySkillTrackerCtorPatch
{
	private static void Postfix(LobbySkillTracker __instance)
	{
		Debug.Log((object)("LobbySkillTracker patch " + __instance.ratings.Length));
		__instance.ratings = (Rating[])(object)new Rating[PlayerManager.maxPlayers];
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal static class VersusControlCtorPatch
{
	private static void Postfix(VersusControl __instance)
	{
		Debug.Log((object)("patch VersusControl " + PlayerManager.maxPlayers));
		__instance.winOrder = (GamePlayer[])(object)new GamePlayer[PlayerManager.maxPlayers];
		__instance.RemainingPlacements = new int[PlayerManager.maxPlayers];
	}
}
[HarmonyPatch(typeof(VersusControl), "ShuffleStartPosition")]
public class VersusControlShuffleStartPositionCtorPatch
{
	private static bool Prefix(VersusControl __instance)
	{
		List<int> list = new List<int>();
		for (int i = 0; i < ((GameControl)__instance).PlayerQueue.Count; i++)
		{
			list.Add(i % 4 + 1);
		}
		string text = "";
		for (int j = 0; j < ((GameControl)__instance).PlayerQueue.Count; j++)
		{
			int index = Random.Range(0, list.Count);
			text += list[index];
			list.RemoveAt(index);
		}
		__instance.NetworkRandomStartPositionString = text;
		return false;
	}
}
[HarmonyPatch(typeof(LobbyManager), "Awake")]
internal static class LobbyManagerCtorPatch
{
	private static void Postfix(LobbyManager __instance)
	{
		Debug.Log((object)("LobbyManager.instance.lobbySlots " + ((NetworkLobbyManager)__instance).lobbySlots.Length));
		((NetworkLobbyManager)__instance).maxPlayers = PlayerManager.maxPlayers;
		((NetworkLobbyManager)__instance).maxPlayersPerConnection = PlayerManager.maxPlayers;
		if (((NetworkLobbyManager)__instance).lobbySlots.Length < PlayerManager.maxPlayers)
		{
			Array.Resize(ref ((NetworkLobbyManager)__instance).lobbySlots, PlayerManager.maxPlayers);
		}
	}
}
[HarmonyPatch(typeof(GameSettings), "GetInstance")]
internal static class GameSettingsCtorPatch
{
	private static void Postfix(GameSettings __result)
	{
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		__result.MaxPlayers = PlayerManager.maxPlayers;
		if (__result.PlayerColors.Length < PlayerManager.maxPlayers)
		{
			int num = __result.PlayerColors.Length;
			Array.Resize(ref __result.PlayerColors, PlayerManager.maxPlayers);
			Color[] playerColors = __result.PlayerColors;
			for (int i = num; i < playerColors.Length; i++)
			{
				__result.PlayerColors[i] = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f));
			}
		}
	}
}
[HarmonyPatch(typeof(InventoryBook), "AddPlayer")]
internal static class InventoryBookCtorPatch
{
	private static void Prefix(InventoryBook __instance)
	{
		if (__instance.cursorSpawnLocation.Length < PlayerManager.maxPlayers)
		{
			int num = __instance.cursorSpawnLocation.Length;
			Array.Resize(ref __instance.cursorSpawnLocation, PlayerManager.maxPlayers);
			for (int i = num; i < __instance.cursorSpawnLocation.Length; i++)
			{
				__instance.cursorSpawnLocation[i] = __instance.cursorSpawnLocation[0];
			}
		}
		Debug.Log((object)"InventoryBook cursorSpawnLocation patched");
	}
}
[HarmonyPatch(typeof(ControllerDisconnect), "Start")]
internal static class ControllerDisconnectCtorPatch
{
	private static void Prefix(ControllerDisconnect __instance)
	{
		int num = __instance.ConnectPrompts.Length;
		Array.Resize(ref __instance.ConnectPrompts, PlayerManager.maxPlayers);
		for (int i = num; i < PlayerManager.maxPlayers; i++)
		{
			__instance.ConnectPrompts[i] = __instance.ConnectPrompts[0];
		}
		if (__instance.orphanedReceivers.Length != PlayerManager.maxPlayers)
		{
			int num2 = __instance.orphanedReceivers.Length;
			Array.Resize(ref __instance.orphanedReceivers, PlayerManager.maxPlayers);
			for (int j = num2; j < __instance.orphanedReceivers.Length; j++)
			{
				__instance.orphanedReceivers[j] = new List<InputReceiver>();
			}
		}
		ControllerDisconnect.showingPrompts = new bool[PlayerManager.maxPlayers];
		__instance.orphanedCharacters = new Animals[PlayerManager.maxPlayers][];
		Debug.Log((object)"ControllerDisconnect patched");
	}
}
[HarmonyPatch(typeof(InputManager), "get_EnableNativeInput")]
internal static class InputManagerCtorPatch
{
	private static void Postfix(ref bool __result)
	{
		Debug.Log((object)"InputManager.EnableNativeInput");
		__result = true;
	}
}
[HarmonyPatch(typeof(InputManager), "get_NativeInputEnableXInput")]
internal static class NativeInputEnableXInputInputManagerCtorPatch
{
	private static void Postfix(ref bool __result)
	{
		Debug.Log((object)"InputManager.NativeInputEnableXInput");
		__result = false;
	}
}
[HarmonyPatch(typeof(LevelPortal), "Awake")]
internal static class LevelPortalCtorPatch
{
	private static void Prefix(LevelPortal __instance)
	{
		VoteArrow[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<VoteArrow>();
		Debug.Log((object)("VoteArrows " + componentsInChildren.Length));
		if (componentsInChildren.Length == PlayerManager.maxPlayers)
		{
			return;
		}
		int num = componentsInChildren.Length;
		for (int i = num; i < PlayerManager.maxPlayers; i++)
		{
			Type type = ((object)componentsInChildren[3]).GetType();
			Component obj = ((Component)componentsInChildren[3]).gameObject.AddComponent(type);
			VoteArrow obj2 = (VoteArrow)(object)((obj is VoteArrow) ? obj : null);
			FieldInfo[] fields = type.GetFields();
			foreach (FieldInfo fieldInfo in fields)
			{
				fieldInfo.SetValue(obj2, fieldInfo.GetValue(componentsInChildren[3]));
			}
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal static class StatTrackerCtorPatch
{
	private static void Postfix(StatTracker __instance)
	{
		Debug.Log((object)("patch StatTracker " + PlayerManager.maxPlayers));
		__instance.saveFiles = (SaveFileData[])(object)new SaveFileData[PlayerManager.maxPlayers];
		__instance.saveStatuses = (SaveFileStatus[])(object)new SaveFileStatus[PlayerManager.maxPlayers];
	}
}
[HarmonyPatch(typeof(GameSparksQuery), "DoGetLobbyData")]
internal static class GameSparksQueryLobbyCtorPatch
{
	private static void Prefix(ref bool reserveSlot)
	{
		Debug.Log((object)("reserveSlot " + reserveSlot));
		reserveSlot = false;
	}
}
[HarmonyPatch(typeof(LivesDisplayController), "Initialize")]
internal static class LivesDisplayControllerCtorPatch
{
	private static void Prefix(LivesDisplayController __instance)
	{
		Debug.Log((object)("LivesDisplayController patch " + __instance.livesDisplayBoxes.Count));
		if (__instance.livesDisplayBoxes.Count < PlayerManager.maxPlayers)
		{
			int count = __instance.livesDisplayBoxes.Count;
			for (int i = count; i <= PlayerManager.maxPlayers; i++)
			{
				__instance.livesDisplayBoxes.Add(__instance.livesDisplayBoxes[0]);
			}
		}
	}
}
[HarmonyPatch(typeof(PlayerStatusDisplay), "SetupSlot")]
[HarmonyPatch(typeof(PlayerStatusDisplay), "SetSlot")]
[HarmonyPatch(typeof(PlayerStatusDisplay), "SetSlotCount")]
internal static class PlayerStatusDisplaySetSlotCountCtorPatch
{
	private static void Prefix(PlayerStatusDisplay __instance)
	{
		Debug.Log((object)("PlayerStatusDisplay patch " + __instance.Slots.Length));
		if (__instance.Slots.Length < PlayerManager.maxPlayers)
		{
			int num = __instance.Slots.Length;
			Array.Resize(ref __instance.Slots, PlayerManager.maxPlayers);
			for (int i = num; i < PlayerManager.maxPlayers; i++)
			{
				__instance.Slots[i] = __instance.Slots[0];
			}
		}
	}
}
[HarmonyPatch(typeof(NetworkManager), "StartServer", new Type[]
{
	typeof(ConnectionConfig),
	typeof(int)
})]
internal static class NetworkManagerCtorPatch
{
	private static void Prefix(NetworkManager __instance, int maxConnections)
	{
		Debug.Log((object)("NetworkManager StartServer " + __instance.maxConnections + " param maxConnections " + maxConnections));
		__instance.maxConnections = PlayerManager.maxPlayers;
	}
}
[HarmonyPatch(typeof(PickableNetworkButton), "SetSearchResultInfo")]
internal static class PickableNetworkButtonCtorPatch
{
	private static void Postfix(PickableNetworkButton __instance, LobbyListInfo lobbyInfo)
	{
		__instance.NumPlayersText.text = lobbyInfo.Players + "/?";
	}
}
[HarmonyPatch(typeof(GameControl), "Awake")]
internal static class GameControlCtorPatch
{
	private static void Postfix(GameControl __instance)
	{
		if (__instance.showScoreButtons.Length < PlayerManager.maxPlayers)
		{
			Array.Resize(ref __instance.showScoreButtons, PlayerManager.maxPlayers);
		}
	}
}
[HarmonyPatch(typeof(GameControl), "ReceiveEvent")]
internal static class GameControlReceiveEventCtorPatch
{
	private static void Prefix(GameControl __instance, InputEvent e)
	{
		__instance.inputPlayerNumber = 0;
		for (int i = 0; i < PlayerManager.maxPlayers && i < 95; i++)
		{
			if ((e.PlayerBitMask & (1 << i)) == 1 << i)
			{
				__instance.inputPlayerNumber = i + 1;
				break;
			}
		}
	}
}
[HarmonyPatch]
internal static class GameControlReceiveEventDropInputPlayerNumber0Patch
{
	private static IEnumerable<MethodBase> TargetMethods()
	{
		yield return AccessTools.Method(typeof(GameControl), "ReceiveEvent", (Type[])null, (Type[])null);
	}

	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> e)
	{
		bool done = false;
		foreach (CodeInstruction inst in e)
		{
			if (!done && inst.opcode != OpCodes.Ldarg_1)
			{
				inst.opcode = OpCodes.Nop;
			}
			else
			{
				done = true;
			}
			yield return inst;
		}
	}
}
[HarmonyPatch(typeof(LevelSelectController), "SetupLobbyAfterWait")]
[HarmonyPatch(typeof(StartGameState), "Awake")]
internal static class StartGameStateCtorPatch
{
	private static void Postfix()
	{
		if (MorePlayersMod.fullDebug.Value)
		{
			LogFilter.currentLogLevel = 0;
			Debug.logger.logEnabled = true;
			Debug.Log((object)"StartGameStateCtorPatch");
			Application.SetStackTraceLogType((LogType)0, (StackTraceLogType)2);
			Application.SetStackTraceLogType((LogType)1, (StackTraceLogType)2);
			Application.SetStackTraceLogType((LogType)2, (StackTraceLogType)2);
			Application.SetStackTraceLogType((LogType)3, (StackTraceLogType)2);
			Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)2);
		}
	}
}
internal static class HandiShuffle
{
	public static void ShowLine(HandicapLine line, bool show)
	{
		line.ScorelineStretcher.SetActive(show);
		((Component)line.AnimalName).gameObject.SetActive(show);
		((Component)line.HandicapNumber).gameObject.SetActive(show);
	}

	public static void reCap()
	{
		if (MorePlayersMod.shuffleScoreBalancer.Value)
		{
			GameObject val = GameObject.Find("Handicapper");
			handicap handicap = ((val != null) ? val.GetComponent<handicap>() : null);
			pushHandicaps(handicap, -1);
		}
	}

	public static void pushHandicaps(handicap handicap, int networkPlayerNumber)
	{
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Invalid comparison between Unknown and I4
		if (!MorePlayersMod.shuffleScoreBalancer.Value)
		{
			return;
		}
		HandicapLine componentInChildren = ((Component)handicap.HandicapLineSlots[0]).GetComponentInChildren<HandicapLine>();
		HandicapLine componentInChildren2 = ((Component)handicap.HandicapLineSlots[1]).GetComponentInChildren<HandicapLine>();
		HandicapLine componentInChildren3 = ((Component)handicap.HandicapLineSlots[2]).GetComponentInChildren<HandicapLine>();
		HandicapLine componentInChildren4 = ((Component)handicap.HandicapLineSlots[3]).GetComponentInChildren<HandicapLine>();
		HandicapLine[] array = (HandicapLine[])(object)new HandicapLine[4] { componentInChildren, componentInChildren2, componentInChildren3, componentInChildren4 };
		int[] source = new int[4] { componentInChildren.PlayerNetworkNumber, componentInChildren2.PlayerNetworkNumber, componentInChildren3.PlayerNetworkNumber, componentInChildren4.PlayerNetworkNumber };
		source = source.Where(delegate(int c)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			LobbyPlayer lobbyPlayer = LobbyManager.instance.GetLobbyPlayer(c);
			return c != networkPlayerNumber && c != -1 && (lobbyPlayer == null || (int)lobbyPlayer.PickedAnimal > 0);
		}).ToArray();
		if (source.Length < 4)
		{
			foreach (LobbyPlayer lobbyPlayer2 in LobbyManager.instance.GetLobbyPlayers())
			{
				if ((lobbyPlayer2 == null || (int)lobbyPlayer2.PickedAnimal > 0) && lobbyPlayer2.handicap != 100 && lobbyPlayer2.networkNumber != networkPlayerNumber && !source.Contains(lobbyPlayer2.networkNumber))
				{
					source = source.Append(lobbyPlayer2.networkNumber).ToArray();
				}
			}
		}
		if (source.Length < 4)
		{
			int[] array2 = new int[4] { -1, -1, -1, -1 };
			for (int i = 0; i < source.Length; i++)
			{
				array2[i] = source[i];
			}
			source = array2;
		}
		Dictionary<int, float> dictionary = new Dictionary<int, float>();
		HandicapLine[] array3 = array;
		foreach (HandicapLine val in array3)
		{
			if (!dictionary.ContainsKey(val.PlayerNetworkNumber) && val.PlayerNetworkNumber != -1)
			{
				dictionary.Add(val.PlayerNetworkNumber, val.currentHandicapFloat);
			}
			val.PlayerNetworkNumber = -1;
		}
		int[] array4 = new int[4]
		{
			networkPlayerNumber,
			source[0],
			source[1],
			source[2]
		};
		if (networkPlayerNumber == -1)
		{
			array4 = source;
		}
		int num = 0;
		int[] array5 = array4;
		foreach (int num2 in array5)
		{
			bool flag = num2 == -1;
			array[num].PlayerNetworkNumber = num2;
			ShowLine(array[num], !flag);
			if (!flag)
			{
				bool skipTransition = num2 != networkPlayerNumber || networkPlayerNumber == -1;
				updateHandicapLine(array[num], num2, skipTransition, dictionary);
			}
			num++;
		}
	}

	private static void updateHandicapLine(HandicapLine line, int networkPlayerNumber, bool skipTransition, Dictionary<int, float> ogNums)
	{
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		LobbyPlayer lobbyPlayer = LobbyManager.instance.GetLobbyPlayer(networkPlayerNumber);
		if (!Object.op_Implicit((Object)(object)lobbyPlayer))
		{
			line.PlayerNetworkNumber = -1;
			ShowLine(line, show: false);
			return;
		}
		line.AnimalName.text = lobbyPlayer.playerName;
		line.targetHandicap = lobbyPlayer.handicap;
		line.HandicapNumber.text = line.targetHandicap + "%";
		if (skipTransition)
		{
			line.currentHandicapFloat = (float)line.targetHandicap / 100f;
			line.ScorelineStretcher.transform.localScale = new Vector3(line.initialScale.x * line.currentHandicapFloat, line.initialScale.y, line.initialScale.y);
		}
		else if (ogNums.ContainsKey(networkPlayerNumber))
		{
			line.currentHandicapFloat = GeneralExtensions.GetValueSafe<int, float>(ogNums, networkPlayerNumber);
		}
	}
}
[HarmonyPatch(typeof(handicap), "handleEvent")]
internal static class HandicapHandleEventCtorPatch
{
	private static void Postfix(handicap __instance, GameEvent e)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		if (((object)e).GetType() == typeof(NetworkMessageReceivedEvent))
		{
			NetworkMessageReceivedEvent val = (NetworkMessageReceivedEvent)(object)((e is NetworkMessageReceivedEvent) ? e : null);
			short msgType = val.Message.msgType;
			if (msgType == NetMsgTypes.PlayerHandicapSet)
			{
				MsgPlayerHandicapSet val2 = (MsgPlayerHandicapSet)val.ReadMessage;
				HandiShuffle.pushHandicaps(__instance, val2.NetworkPlayerNumber);
			}
			if (msgType == NetMsgTypes.SetCustomPortalInfo || msgType == NetMsgTypes.CommunicateCharacterOutfits)
			{
				HandiShuffle.pushHandicaps(__instance, -1);
			}
		}
		else
		{
			HandiShuffle.pushHandicaps(__instance, -1);
		}
	}
}
[HarmonyPatch(typeof(handicap), "Start")]
internal static class HandicapStartCtorPatch
{
	private static void Postfix(handicap __instance)
	{
		if (!MorePlayersMod.shuffleScoreBalancer.Value)
		{
			return;
		}
		GameObject val = GameObject.Find("Handicapper/Canvas/Title");
		Text component = val.GetComponent<Text>();
		component.text = "modded Score Balancer";
		Transform[] handicapLineSlots = __instance.HandicapLineSlots;
		foreach (Transform val2 in handicapLineSlots)
		{
			HandicapLine componentInChildren = ((Component)val2).GetComponentInChildren<HandicapLine>();
			if (!componentInChildren.currentlyShown || componentInChildren.targetHandicap == -999)
			{
				componentInChildren.PlayerNetworkNumber = -1;
				HandiShuffle.ShowLine(componentInChildren, show: false);
			}
		}
		GameEventManager.ChangeListener<CharacterPickedEvent>((IGameEventListener)(object)__instance, true);
		GameEventManager.ChangeListener<LobbyPlayerRemovedEvent>((IGameEventListener)(object)__instance, true);
		GameEventManager.ChangeListener<LobbyPlayerCreatedEvent>((IGameEventListener)(object)__instance, true);
		GameEventManager.ChangeListener<LocalPlayerAddedEvent>((IGameEventListener)(object)__instance, true);
		GameEventManager.ChangeListener<CharacterVoteEvent>((IGameEventListener)(object)__instance, true);
		GameEventManager.ChangeListener<GameEndEvent>((IGameEventListener)(object)__instance, true);
	}
}
[HarmonyPatch(typeof(HandicapLine), "SetName")]
internal static class HandicapLineSetNameCtorPatch
{
	private static bool Prefix(HandicapLine __instance, Animals animal, bool altSkin)
	{
		if (!MorePlayersMod.shuffleScoreBalancer.Value)
		{
			return true;
		}
		LobbyPlayer lobbyPlayer = LobbyManager.instance.GetLobbyPlayer(__instance.PlayerNetworkNumber);
		__instance.AnimalName.text = lobbyPlayer.playerName;
		return false;
	}
}
[HarmonyPatch(typeof(LobbyPlayer), "CmdSetPlayerHandicap")]
internal static class LobbyPlayerHandleEventCtorPatch
{
	private static void Postfix(LobbyPlayer __instance, int newHandicap)
	{
		HandiShuffle.reCap();
	}
}
[HarmonyPatch(typeof(LobbyPlayer), "DoCharacterPickedEvent")]
internal static class LobbyPlayerDoCharacterPickedEventCtorPatch4Handicap
{
	private static void Postfix(ref bool clearOutfit)
	{
		HandiShuffle.reCap();
	}
}
[HarmonyPatch(typeof(LobbyPlayer), "RpcRequestPickResponse")]
internal static class LobbyPlayerRpcRequestPickResponseCtorPatch4Handicap
{
	private static void Postfix()
	{
		HandiShuffle.reCap();
	}
}
internal static class MoreCode
{
	public const char Marker = 'M';

	public const string Stars = "*****";

	public static float lastCodeInputFocus;

	public static bool IsValid(string code)
	{
		return code.Length == 5 && (code[0] == 'M' || code[0] == char.ToLower('M'));
	}

	public static string Fudge(string code)
	{
		return "M" + code;
	}

	public static string UnFudge(string code)
	{
		return code.Substring(1);
	}

	public static void FudgeJoin(PickableNetworkButton __instance, string text)
	{
		if (Util_String.NullOrEmpty(text))
		{
			return;
		}
		__instance.inputField.text = text;
		GameSettings.GetInstance().StartAsHost = false;
		GameSettings.GetInstance().StartLocal = false;
		Matchmaker.Instance.JoinLobby(UnFudge(__instance.inputField.text), true, (UnityAction<bool>)delegate(bool success)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (success)
			{
				AnalyticEvent.JoinMatchEvent(Matchmaker.CurrentMatchmakingLobby.GetLobbyGuid(), (JoinMethod)1, Matchmaker.CurrentMatchmakingLobby.LobbyIsCrossplay(Application.platform));
			}
		});
	}

	public static string CleanCode(string code)
	{
		if (Util_String.NullOrEmpty(code))
		{
			return null;
		}
		string text = Regex.Replace(code.ToUpper(), "[^A-Za-z]", "");
		if (!IsValid(text))
		{
			return null;
		}
		return text;
	}

	public static void CleanGUI()
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("CodeInputField");
		InputField val2 = ((val != null) ? val.GetComponent<InputField>() : null);
		if (Object.op_Implicit((Object)(object)val2))
		{
			val2.characterLimit = 4;
			((Text)val2.placeholder).text = "ABCD";
		}
	}
}
[HarmonyPatch(typeof(PickableNetworkButton), "Update")]
internal static class PickableNetworkButtonUpdateCtorPatch
{
	private static bool Prefix(PickableNetworkButton __instance)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected I4, but got Unknown
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		NetworkButtonJobs job = __instance.job;
		NetworkButtonJobs val = job;
		switch (val - 38)
		{
		case 1:
			if (__instance.inputField.isFocused)
			{
				MoreCode.lastCodeInputFocus = 0.15f;
			}
			else if (MoreCode.lastCodeInputFocus > 0f)
			{
				MoreCode.lastCodeInputFocus -= Time.deltaTime;
			}
			__instance.inputField.characterLimit = 5;
			((Text)__instance.inputField.placeholder).text = MoreCode.Fudge("ABCD");
			if (Input.GetKeyDown((KeyCode)13) && MoreCode.IsValid(__instance.inputField.text) && MoreCode.lastCodeInputFocus > 0f)
			{
				UserMessageManager.Instance.UserMessage("trying to join: " + __instance.inputField.text, 2f, (UserMsgPriority)0, true);
				MoreCode.FudgeJoin(__instance, __instance.inputField.text);
			}
			__instance.Show(true);
			return false;
		case 0:
			__instance.Show(MoreCode.IsValid(__instance.inputField.text));
			return false;
		case 4:
			__instance.Show(GameSettings.GetInstance().UseUnityRelay);
			if (PickableNetworkButton.showCode && Matchmaker.CurrentMatchmakingLobby != null)
			{
				if ((Object)(object)((PickableButton)__instance).buttonText != (Object)null)
				{
					((PickableButton)__instance).buttonText.text = MoreCode.Fudge(Matchmaker.CurrentMatchmakingLobby.GetLobbyCode());
					return false;
				}
			}
			else if ((Object)(object)((PickableButton)__instance).buttonText != (Object)null)
			{
				((PickableButton)__instance).buttonText.text = "*****";
				return false;
			}
			return false;
		default:
			return true;
		}
	}
}
[HarmonyPatch(typeof(PickableNetworkButton), "OnAccept")]
internal static class PickableNetworkOnAcceptCtorPatch
{
	private static bool Prefix(PickableNetworkButton __instance)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Invalid comparison between Unknown and I4
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Invalid comparison between Unknown and I4
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Invalid comparison between Unknown and I4
		NetworkButtonJobs job = __instance.job;
		NetworkButtonJobs val = job;
		if ((int)val != 38)
		{
			if ((int)val != 42)
			{
				if ((int)val == 50)
				{
					string text = MoreCode.CleanCode(GUIUtility.systemCopyBuffer);
					MoreCode.FudgeJoin(__instance, text);
					return false;
				}
				return true;
			}
			if (Matchmaker.CurrentMatchmakingLobby != null)
			{
				GUIUtility.systemCopyBuffer = MoreCode.Fudge(Matchmaker.CurrentMatchmakingLobby.GetLobbyCode());
				UserMessageManager.Instance.UserMessage(Snapshot.ShareableCodeClipboard, 2f, (UserMsgPriority)0, true);
			}
			return false;
		}
		MoreCode.FudgeJoin(__instance, __instance.inputField.text);
		return false;
	}
}
[HarmonyPatch(typeof(TabletLobbyOptionsScreen), "OnClickShowToggle")]
internal static class TabletLobbyOptionsScreenCtorPatch
{
	private static bool Prefix(TabletLobbyOptionsScreen __instance)
	{
		__instance.lobbyCodeShown = !__instance.lobbyCodeShown;
		if (__instance.lobbyCodeShown)
		{
			__instance.lobbyCodeText.text = MoreCode.Fudge(Matchmaker.CurrentMatchmakingLobby.GetLobbyCode());
			return false;
		}
		__instance.lobbyCodeText.text = "*****";
		return false;
	}
}
[HarmonyPatch(typeof(TabletLobbyOptionsScreen), "OnClickCopyLobbyCode")]
internal static class TabletLobbyOptionsScreenOnClickCopyLobbyCodeCtorPatch
{
	private static bool Prefix()
	{
		QuickSaver.CopyStringToClipboard(MoreCode.Fudge(Matchmaker.CurrentMatchmakingLobby.GetLobbyCode()));
		UserMessageManager.Instance.UserMessage(Snapshot.ShareableCodeClipboard, 2f, (UserMsgPriority)0, true);
		return false;
	}
}
[HarmonyPatch(typeof(TabletLobbyOptionsScreen), "Awake")]
internal static class TabletLobbyOptionsScreenAwakeCtorPatch
{
	private static void Prefix(TabletLobbyOptionsScreen __instance)
	{
		__instance.lobbyCodeText.text = "*****";
	}
}
internal static class MenuPatch
{
	public static void PatchMenu()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Expected O, but got Unknown
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Expected O, but got Unknown
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Expected O, but got Unknown
		Harmony val = new Harmony("EvenMorePlayers.MenuPatch");
		MethodInfo method = typeof(TabletMainMenuHome).GetMethod("Initialize");
		MethodInfo method2 = typeof(TabletMainMenuHomeCtorPatch).GetMethod("Postfix");
		val.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		MethodInfo method3 = typeof(TabletMainMenuHome).GetMethod("Update", BindingFlags.Instance | BindingFlags.NonPublic);
		MethodInfo method4 = typeof(TabletMainMenuHomeScoochButtonsCtorPatch).GetMethod("Postfix");
		val.Patch((MethodBase)method3, (HarmonyMethod)null, new HarmonyMethod(method4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		MethodInfo method5 = typeof(TabletButton).GetMethod("OnAccept");
		MethodInfo method6 = typeof(TabletButtonOnAcceptCtorPatch).GetMethod("Prefix");
		val.Patch((MethodBase)method5, new HarmonyMethod(method6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		MethodInfo method7 = typeof(TabletMainMenuOnlineIndicator).GetMethod("SetPlayOnlineButtonState", BindingFlags.Instance | BindingFlags.NonPublic);
		MethodInfo method8 = typeof(TabletMainMenuOnlineIndicatorCtorPatch).GetMethod("Prefix");
		val.Patch((MethodBase)method7, new HarmonyMethod(method8), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		MethodInfo method9 = typeof(GameSettings).GetMethod("get_VersionNumber");
		MethodInfo method10 = typeof(GameSettingsVersionCtorPatch).GetMethod("Prefix");
		val.Patch((MethodBase)method9, new HarmonyMethod(method10), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
	}
}
internal static class TabletButtonOnAcceptCtorPatch
{
	public static void Prefix(TabletButton __instance)
	{
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)("Pressed da button: " + ((Object)((Component)__instance).gameObject).name));
		if (((Object)((Component)__instance).gameObject).name == "Play More")
		{
			if (!GameSettings.GetInstance().versionNumber.Contains(MorePlayersMod.mod_version_full))
			{
				GameSettings.GetInstance().versionNumber = GameSettings.GetInstance().VersionNumber + MorePlayersMod.mod_version_full;
				if (PlayerManager.maxPlayers != MorePlayersMod.newPlayerLimit.Value)
				{
					PlayerManager.maxPlayers = MorePlayersMod.newPlayerLimit.Value;
					new Harmony("EvenMorePlayers.PlayerNumPatch").PatchAll();
				}
			}
		}
		else if (((Object)((Component)__instance).gameObject).name == "Play Online")
		{
			GameSettings.GetInstance().versionNumber = MorePlayersMod.og_version;
			PlayerManager.maxPlayers = 4;
			Harmony.UnpatchID("EvenMorePlayers.PlayerNumPatch");
			MoreCode.CleanGUI();
		}
	}
}
internal static class TabletMainMenuHomeCtorPatch
{
	public static void Postfix(ChallengeScoreboard __instance)
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		//IL_035c: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0383: Unknown result type (might be due to invalid IL or missing references)
		//IL_0388: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
		__instance.players = (ChallengePlayer[])(object)new ChallengePlayer[PlayerManager.maxPlayers];
		GameObject val = GameObject.Find("main Buttons/Play More");
		if ((Object)(object)val == (Object)null)
		{
			GameObject val2 = GameObject.Find("main Buttons/Play");
			TabletTextLabel component = ((Component)val2.transform.Find("Text Label")).GetComponent<TabletTextLabel>();
			component.text = "Local";
			Transform transform = ((Component)component).transform;
			transform.position -= new Vector3(0.65f, 0f, 0f);
			Transform val3 = val2.transform.Find("Image");
			((Component)val3).transform.localScale = new Vector3(0.7073f, 0.7073f, 1f);
			Transform transform2 = ((Component)val3).transform;
			transform2.position -= new Vector3(0.04f, 0f, 0f);
			GameObject val4 = GameObject.Find("main Buttons/Play Online");
			TabletTextLabel component2 = ((Component)val4.transform.Find("Text Label")).GetComponent<TabletTextLabel>();
			component2.text = "Online";
			Transform transform3 = ((Component)component2).transform;
			transform3.position -= new Vector3(0.7f, 0f, 0f);
			Transform val5 = val4.transform.Find("Image");
			((Component)val5).transform.localScale = new Vector3(0.8073f, 0.8073f, 1f);
			Transform transform4 = ((Component)val5).transform;
			transform4.position -= new Vector3(0.11f, 0f, 0f);
			val = Object.Instantiate<GameObject>(val4);
			((Object)val).name = "Play More";
			val.transform.SetParent(val4.transform.parent);
			val.transform.localScale = new Vector3(1f, 1f, 1f);
			TabletTextLabel component3 = ((Component)val.transform.Find("Text Label")).GetComponent<TabletTextLabel>();
			component3.text = "More";
			Transform transform5 = ((Component)component3).transform;
			transform5.position -= new Vector3(0.6655f, 0f, 0f);
			Transform val6 = val.transform.Find("Image");
			((Component)val6).transform.localScale = new Vector3(-0.5073f, 0.5073f, 1f);
			Transform transform6 = ((Component)val6).transform;
			transform6.position += new Vector3(-0.06f, 0.5073f, 0f);
			GameObject val7 = Object.Instantiate<GameObject>(((Component)val6).gameObject, ((Component)val6).transform.parent);
			((Object)val7).name = "Image1";
			val7.transform.position = ((Component)val6).transform.position;
			Transform transform7 = val7.transform;
			transform7.position -= new Vector3(0.6f, 1.2f, 0f);
			val7.transform.localScale = new Vector3(-0.5073f, 0.5073f, 1f);
			GameObject val8 = Object.Instantiate<GameObject>(((Component)val6).gameObject, ((Component)val6).transform.parent);
			((Object)val8).name = "Image2";
			val8.transform.position = ((Component)val6).transform.position;
			Transform transform8 = val8.transform;
			transform8.position -= new Vector3(-0.6f, 1.2f, 0f);
			val8.transform.localScale = new Vector3(-0.5073f, 0.5073f, 1f);
		}
	}
}
internal static class TabletMainMenuHomeScoochButtonsCtorPatch
{
	public static void Postfix(PickableMainMenuButton __instance)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("main Buttons/Play More");
		if (Object.op_Implicit((Object)(object)val))
		{
			GameObject val2 = GameObject.Find("main Buttons/Play");
			val2.transform.localPosition = Vector2.op_Implicit(new Vector2(-320f, val2.transform.localPosition.y));
			val2.transform.localScale = new Vector3(1.015f, 1f, 1f);
			TabletTextLabel component = ((Component)val2.transform.Find("Text Label")).GetComponent<TabletTextLabel>();
			component.text = "Local";
			GameObject val3 = GameObject.Find("main Buttons/Play Online");
			val3.transform.localScale = new Vector3(1.015f, 1f, 1f);
			TabletTextLabel component2 = ((Component)val3.transform.Find("Text Label")).GetComponent<TabletTextLabel>();
			component2.text = "Online";
			val.transform.localScale = new Vector3(1.015f, 1f, 1f);
			val.transform.localPosition = Vector2.op_Implicit(new Vector2(320f, val.transform.localPosition.y));
			TabletTextLabel component3 = ((Component)val.transform.Find("Text Label")).GetComponent<TabletTextLabel>();
			component3.text = "More";
		}
	}
}
internal static class TabletMainMenuOnlineIndicatorCtorPatch
{
	public static void Prefix(bool spinnerActive, bool buttonActive)
	{
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("main Buttons/Play More");
		if (Object.op_Implicit((Object)(object)val))
		{
			Transform obj = val.transform.Find("LoadingSpinner");
			if (obj != null)
			{
				((Component)obj).gameObject.SetActive(spinnerActive);
			}
			TabletDisableGroup component = val.GetComponent<TabletDisableGroup>();
			if ((Object)(object)component != (Object)null && ((TabletStyledObject)val.GetComponent<TabletDisableGroup>()).Disabled != !buttonActive)
			{
				((TabletStyledObject)val.GetComponent<TabletDisableGroup>()).SetDisabled(!buttonActive);
				TabletButton component2 = val.GetComponent<TabletButton>();
				((Graphic)((Component)val.transform.Find("Image1")).GetComponent<Image>()).color = ((Graphic)component2.labelImage).color;
				((Graphic)((Component)val.transform.Find("Image2")).GetComponent<Image>()).color = ((Graphic)component2.labelImage).color;
			}
		}
	}
}
internal static class GameSettingsVersionCtorPatch
{
	public static bool Prefix(GameSettings __instance, ref string __result)
	{
		if (GameSettings.GetInstance().versionNumber.Contains(MorePlayersMod.mod_version_full))
		{
			__result = GameSettings.GetInstance().versionNumber;
			return false;
		}
		return true;
	}
}
internal static class MultiPick
{
	public const int multiMagicNumber = 10000;

	public static Character SpawnCharacter(Character to_clone, Vector3 position)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		Character val = Object.Instantiate<Character>(to_clone, position, Quaternion.identity);
		((Component)val).GetComponent<NetworkIdentity>().ForceSceneId(0);
		Object.Destroy((Object)(object)((Component)val).GetComponent<OGProtection>());
		val.picked = true;
		val.FindPlayerOnSpawn = true;
		((Component)val).gameObject.transform.parent = null;
		ArtMatcher[] componentsInChildren = ((Component)val).GetComponentsInChildren<ArtMatcher>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Object.Destroy((Object)(object)((Component)componentsInChildren[i]).gameObject);
		}
		NetworkServer.Spawn(((Component)val).gameObject);
		return val;
	}
}
public class OGProtection : MonoBehaviour
{
}
[HarmonyPatch(typeof(LevelSelectController), "RpcResetCharacter")]
internal static class LevelSelectControllerRpcResetCharacterCtorPatch
{
	private static void Prefix(LevelSelectController __instance, GameObject characterObj)
	{
		Character component = characterObj.GetComponent<Character>();
		if (Object.op_Implicit((Object)(object)component))
		{
			__instance.MainCamera.RemoveTarget(component);
		}
	}

	private static void Postfix(GameObject characterObj)
	{
		NetworkServer.Destroy(characterObj);
	}
}
[HarmonyPatch(typeof(Character), "Awake")]
internal static class CharacterCtorPatch
{
	private static void Prefix(Character __instance)
	{
		BoxCollider2D[] components = ((Component)__instance).gameObject.GetComponents<BoxCollider2D>();
		foreach (BoxCollider2D val in components)
		{
			((Behaviour)val).enabled = true;
		}
		__instance.RefreshScale();
	}
}
[HarmonyPatch(typeof(OutfitManager), "RebuildDatabase")]
internal static class OutfitManagerRebuildDatabaseTakenCtorPatch
{
	private static bool Prefix(OutfitManager __instance)
	{
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Invalid comparison between Unknown and I4
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Invalid comparison between Unknown and I4
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"OutfitManager.RebuildDatabase: fix");
		__instance.characterOutfitsUnlocked.Clear();
		__instance.characterOutfitsAll.Clear();
		__instance.characterArtMatchers = Object.FindObjectsOfType<ArtMatcher>();
		ArtMatcher[] characterArtMatchers = __instance.characterArtMatchers;
		foreach (ArtMatcher val in characterArtMatchers)
		{
			if (((Object)val.character).name.Contains("Clone") && !((Object)val.character).name.Contains("moep") && Object.op_Implicit((Object)(object)((Component)val.character).GetComponent<NetworkIdentity>()))
			{
				Character character = val.character;
				string name = ((Object)character).name;
				NetworkInstanceId netId = ((Component)val.character).GetComponent<NetworkIdentity>().netId;
				((Object)character).name = name + " moep " + ((object)(NetworkInstanceId)(ref netId)).ToString();
			}
			if (!__instance.characterOutfitsUnlocked.ContainsKey(val.character))
			{
				__instance.characterOutfitsUnlocked.Add(val.character, new List<Outfit>[Outfit.NumOutfitTypes]);
			}
			if (!__instance.characterOutfitsAll.ContainsKey(val.character))
			{
				__instance.characterOutfitsAll.Add(val.character, new List<Outfit>[Outfit.NumOutfitTypes]);
			}
			for (int j = 0; j < Outfit.NumOutfitTypes; j++)
			{
				__instance.characterOutfitsUnlocked[val.character][j] = new List<Outfit>();
				__instance.characterOutfitsAll[val.character][j] = new List<Outfit>();
			}
			Outfit[] outfits = val.outfits;
			foreach (Outfit val2 in outfits)
			{
				if ((int)val2.outfitType != 4 && (int)val2.outfitType != 5)
				{
					__instance.characterOutfitsAll[val.character][val2.outfitType].Add(val2);
					bool flag = val2.Unlocked;
					if (!flag && (Object)(object)val.GetDefaultForcedOutfit(val2.outfitType) == (Object)(object)val2)
					{
						val2.TempUnlocked = true;
						flag = true;
					}
					if (flag)
					{
						__instance.characterOutfitsUnlocked[val.character][val2.outfitType].Add(val2);
					}
				}
			}
			if (Object.op_Implicit((Object)(object)val.character) && Object.op_Implicit((Object)(object)val.character.associatedLobbyPlayer))
			{
				val.character.SetOutfitsFromArray(val.character.associatedLobbyPlayer.characterOutfitsList);
			}
		}
		return false;
	}
}
[HarmonyPatch(typeof(OutfitController), "Show")]
internal static class OutfitControllerupdateImagesCtorPatch
{
	private static void Prefix(OutfitController __instance)
	{
		__instance.OutfitManager.RebuildDatabase();
	}
}
[HarmonyPatch(typeof(Character), "GetOutfitsAsArray")]
internal static class GetOutfitsAsArrayCtorPatch
{
	private static void Postfix(Character __instance, ref int[] __result)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		NetworkIdentity component = ((Component)__instance).GetComponent<NetworkIdentity>();
		uint? obj;
		if (component == null)
		{
			obj = null;
		}
		else
		{
			NetworkInstanceId netId = component.netId;
			obj = ((NetworkInstanceId)(ref netId)).Value;
		}
		uint? num = obj;
		int value = (int)num.Value;
		if (value != 0)
		{
			Array.Resize(ref __result, __result.Length + 1);
			__result[__result.Length - 1] = value;
		}
	}
}
[HarmonyPatch(typeof(Character), "SetOutfitsFromArray", new Type[] { typeof(SyncListInt) })]
internal static class SetOutfitsFromArraySyncListIntCtorPatch
{
	private static bool Prefix(Character __instance, SyncListInt outfitsSyncList)
	{
		Debug.Log((object)("Character.SetOutfitsFromArray " + ((SyncList<int>)(object)outfitsSyncList).Count));
		int[] array = new int[(((SyncList<int>)(object)outfitsSyncList).Count == 7) ? 7 : 6];
		for (int i = 0; i < array.Length; i++)
		{
			if (((SyncList<int>)(object)outfitsSyncList).Count > i)
			{
				array[i] = ((SyncList<int>)(object)outfitsSyncList)[i];
			}
			else
			{
				array[i] = -1;
			}
		}
		__instance.SetOutfitsFromArray(array);
		return false;
	}
}
[HarmonyPatch(typeof(Character), "SetOutfitsFromArray", new Type[] { typeof(int[]) })]
internal static class SetOutfitsFromArrayCtorPatch
{
	private static bool Prefix(Character __instance, ref int[] outfitsArray)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		if (outfitsArray.Length == 7)
		{
			GameObject val = ClientScene.FindLocalObject(new NetworkInstanceId((uint)outfitsArray[6]));
			Character val2 = ((val != null) ? val.GetComponent<Character>() : null);
			Array.Resize(ref outfitsArray, outfitsArray.Length - 1);
			if (Object.op_Implicit((Object)(object)val2))
			{
				val2.SetOutfitsFromArray(outfitsArray);
				return false;
			}
		}
		return true;
	}
}
[HarmonyPatch(typeof(LevelSelectController), "IsCharacterTaken")]
internal static class LevelSelectControllerIsCharacterTakenCtorPatch
{
	private static void Postfix(ref bool __result, LevelSelectController __instance)
	{
		Debug.Log((object)"LevelSelectController.IsCharacterTaken false");
		__result = false;
	}
}
[HarmonyPatch(typeof(Modifiers), "OnModifiersDynamicChange")]
internal static class ModifiersCtorPatch
{
	private static bool Prefix(Modifiers __instance)
	{
		Debug.Log((object)("Modifiers.OnModifiersDynamicChange: fix size modifier " + __instance.CharacterScale + " " + Modifiers.GetInstance().CharacterScaleAudioStateString));
		if ((Object)(object)LobbyManager.instance != (Object)null && Object.op_Implicit((Object)(object)LobbyManager.instance.CurrentLevelSelectController))
		{
			__instance.modsApplied = __instance.modsPreview;
			LobbyManager.instance.CurrentLevelSelectController.RefreshCharacterPosition();
		}
		if ((Object)(object)LobbyManager.instance != (Object)null && ((Object)(object)LobbyManager.instance.CurrentGameController != (Object)null || (Object)(object)LobbyManager.instance.CurrentLevelSelectController != (Object)null))
		{
			Character[] array = Object.FindObjectsOfType<Character>();
			for (int i = 0; i < array.Length; i++)
			{
				array[i].RefreshScale();
			}
			Time.timeScale = __instance.GameSpeed;
		}
		return false;
	}
}
[HarmonyPatch(typeof(LevelSelectController), "setupController")]
internal static class LevelSelectControllerSetupControllerCtorPatch
{
	private static bool Prefix(LevelSelectController __instance, LobbyPlayer lobbyPl)
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Invalid comparison between Unknown and I4
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Invalid comparison between I4 and Unknown
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Expected O, but got Unknown
		Player localPlayer = lobbyPl.LocalPlayer;
		Animals[] associatedCharacters = localPlayer.UseController.GetAssociatedCharacters();
		if (!localPlayer.UseController.ControlsPlayer(localPlayer.Number))
		{
			localPlayer.UseController.AddPlayer(localPlayer.Number);
		}
		for (int num = associatedCharacters.Length - 1; num >= 0; num--)
		{
			if (associatedCharacters[num] && (int)lobbyPl.PickedAnimal == (int)associatedCharacters[num])
			{
				Debug.Log((object)("Setting up " + ((object)(Animals)(ref associatedCharacters[num])).ToString()));
				__instance.MainCamera.SetFrameSizes(__instance.CameraHeight);
				lobbyPl.PlayerStatus = (Status)2;
				Character[] array = Object.FindObjectsOfType<Character>();
				Character[] array2 = array;
				foreach (Character val in array2)
				{
					if ((int)associatedCharacters[num] == (int)val.CharacterSprite && !val.picked)
					{
						Debug.Log((object)("Requesting AssociatedCharacter " + ((object)(Animals)(ref associatedCharacters[num])).ToString()));
						LobbyCursor val2 = (LobbyCursor)localPlayer.AssociatedLobbyPlayer.CursorInstance;
						if ((Object)(object)val2 != (Object)null)
						{
							localPlayer.AssociatedLobbyPlayer.requestedCharacterInstance = null;
							((Cursor)val2).UseCamera = ((Component)__instance.MainCamera).GetComponent<Camera>();
							localPlayer.UseController.AddReceiver((InputReceiver)(object)val2);
						}
						localPlayer.AssociatedLobbyPlayer.RequestPickCharacter(val);
					}
				}
			}
		}
		return false;
	}
}
[HarmonyPatch(typeof(LobbyPlayer), "CmdRequestPickCharacter")]
internal static class LobbyPlayerCmdRequestPickCharacterCtorPatch
{
	private static bool Prefix(LobbyPlayer __instance, NetworkInstanceId characterInstanceId, Animals animal)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = NetworkServer.FindLocalObject(characterInstanceId);
		if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.GetComponent<Character>()))
		{
			Character component = val.GetComponent<Character>();
			if (component.picked || (Object)(object)((Component)component).gameObject.GetComponent<OGProtection>() != (Object)null)
			{
				Vector3 position = ((Component)component).transform.position;
				if ((int)__instance.playerStatus == 2 && (!Util_String.NullOrEmpty(GameState.GetInstance().currentSnapshotInfo.snapshotName) || GameState.GetInstance().lastLevelPlayed == GameState.GetLevelSceneName((LevelName)10)))
				{
					position = LobbyManager.instance.CurrentLevelSelectController.UndergroundCharacterPosition[__instance.networkNumber - 1].position;
				}
				Character val2 = MultiPick.SpawnCharacter(component, position);
				NetworkInstanceId netId = ((Component)val2).gameObject.GetComponent<NetworkIdentity>().netId;
				uint value = ((NetworkInstanceId)(ref netId)).Value;
				__instance.CallCmdAssignCharacter(value, __instance.networkNumber, __instance.localNumber, false);
				__instance.CallRpcRequestPickResponse((int)(value * 10000) + __instance.networkNumber, false);
			}
			else
			{
				__instance.CallCmdAssignCharacter(((NetworkInstanceId)(ref characterInstanceId)).Value, __instance.networkNumber, __instance.localNumber, false);
				__instance.CallRpcRequestPickResponse(__instance.networkNumber, true);
			}
		}
		else
		{
			__instance.CallRpcRequestPickResponse(__instance.networkNumber, false);
		}
		return false;
	}
}
[HarmonyPatch(typeof(LobbyPlayer), "RpcRequestPickResponse")]
internal static class LobbyPlayerRpcRequestPickResponseCtorPatch
{
	private static bool Prefix(LobbyPlayer __instance, ref int playerNetworkNumber, ref bool response)
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)("LobbyPlayer.RpcRequestPickResponse Prefix  " + playerNetworkNumber + " response " + response));
		if (!response && playerNetworkNumber > 10000)
		{
			int num = playerNetworkNumber / 10000;
			playerNetworkNumber %= 10000;
			GameObject val = ClientScene.FindLocalObject(new NetworkInstanceId((uint)num));
			if (Object.op_Implicit((Object)(object)val))
			{
				Character component = val.GetComponent<Character>();
				Debug.Log((object)("Got reassign Character comp " + (object)component));
				if (Object.op_Implicit((Object)(object)component))
				{
					__instance.requestedCharacterInstance = component;
					response = true;
				}
			}
		}
		return true;
	}

	private static void Postfix(LobbyPlayer __instance, ref int playerNetworkNumber, ref bool response)
	{
		Debug.Log((object)("LobbyPlayer.RpcRequestPickResponse Postfix " + playerNetworkNumber + " response " + response));
	}
}
[HarmonyPatch(typeof(LevelSelectController), "Start")]
internal static class LevelSelectControllerStartCtorPatch
{
	private static void Prefix(LevelSelectController __instance)
	{
		Character[] array = Object.FindObjectsOfType<Character>();
		Debug.Log((object)("Found " + array.Length + " chars"));
		Character[] array2 = array;
		foreach (Character val in array2)
		{
			((Component)val).gameObject.AddComponent<OGProtection>();
		}
	}
}
[HarmonyPatch(typeof(LevelSelectController), "SetupLobbyAfterWait")]
internal static class LevelSelectControllerSetupLobbyAfterWaitCtorPatch
{
	private static void Prefix(LevelSelectController __instance)
	{
		Character[] array = Object.FindObjectsOfType<Character>();
		int num = 0;
		Character[] array2 = array;
		foreach (Character val in array2)
		{
			if (val.Picked && !val.Sitting)
			{
				__instance.MainCamera.AddTarget(val);
				num++;
				val.SetLobbyCollider(true);
			}
		}
		if (num > 0)
		{
			__instance.MainCamera.SetFrameSizes(__instance.CameraHeight);
		}
	}
}
[HarmonyPatch(typeof(LobbyPlayer), "DoCharacterPickedEvent")]
internal static class LobbyPlayerDoCharacterPickedEventCtorPatch
{
	private static void Prefix(ref bool clearOutfit)
	{
		Debug.Log((object)("DoCharacterPickedEvent " + clearOutfit));
		clearOutfit = false;
	}
}
[HarmonyPatch(typeof(LevelSelectController), "setupLobby")]
internal static class LevelSelectControllerSetupLobbyCtorPatch
{
	private static void Postfix(LevelSelectController __instance)
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		if (!Util_String.NullOrEmpty(GameState.GetInstance().currentSnapshotInfo.snapshotName) || GameState.GetInstance().lastLevelPlayed == GameState.GetLevelSceneName((LevelName)10))
		{
			LobbyStartPoint[] startingPoints = __instance.StartingPoints;
			foreach (LobbyStartPoint val in startingPoints)
			{
				Character componentInChildren = ((Component)val).GetComponentInChildren<Character>();
				componentInChildren.PositionCharacter(((Component)val).transform.position, true);
			}
		}
	}
}
[HarmonyPatch(typeof(GraphScoreBoard), "MarkPlayerDisconnected")]
internal static class GraphScoreBoardMarkPlayerDisconnectedCtorPatch
{
	private static bool Prefix()
	{
		return false;
	}
}
[HarmonyPatch(typeof(VersusControl), "handleEvent")]
internal static class VersusControlHandleEventCtorPatch
{
	private static void Prefix(VersusControl __instance, GameEvent e)
	{
		Type type = ((object)e).GetType();
		if (type == typeof(GamePlayerRemovedEvent))
		{
			GamePlayerRemovedEvent val = (GamePlayerRemovedEvent)(object)((e is GamePlayerRemovedEvent) ? e : null);
			Dictionary<int, ScoreLine> scorelineRelation = __instance.graphScoreBoardInstance.scorelineRelation;
			if (scorelineRelation.ContainsKey(val.PlayerNetworkNumber))
			{
				scorelineRelation[val.PlayerNetworkNumber].SetDisconnected(true);
			}
		}
	}
}
[HarmonyPatch(typeof(TabletMainMenuHome), "Update")]
internal static class TabletMainMenuHomeUpdateCtorPatch
{
	private static void Postfix(TabletMainMenuHome __instance)
	{
		bool active = (__instance.showingPleaseUpdate = !MorePlayersMod.og_version.StartsWith(GameState.GetLocalizationVersionNumber()));
		((Component)__instance.pleaseUpdateButton).gameObject.SetActive(active);
	}
}