Decompiled source of PickPhaseImprovements v0.4.2

PickPhaseImprovements.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using CardChoiceSpawnUniqueCardPatch;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using DrawNCards;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModdingUtils.Patches;
using ModdingUtils.Utils;
using Photon.Pun;
using PickNCards;
using SoundImplementation;
using TMPro;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("0Harmony")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("BepInEx")]
[assembly: IgnoresAccessChecksTo("CardChoiceSpawnUniqueCardPatch")]
[assembly: IgnoresAccessChecksTo("Microsoft.Win32.Primitives")]
[assembly: IgnoresAccessChecksTo("ModdingUtils")]
[assembly: IgnoresAccessChecksTo("MorePicksPatch")]
[assembly: IgnoresAccessChecksTo("mscorlib")]
[assembly: IgnoresAccessChecksTo("netstandard")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PickNCards")]
[assembly: IgnoresAccessChecksTo("System.AppContext")]
[assembly: IgnoresAccessChecksTo("System.Buffers")]
[assembly: IgnoresAccessChecksTo("System.Collections.Concurrent")]
[assembly: IgnoresAccessChecksTo("System.Collections")]
[assembly: IgnoresAccessChecksTo("System.Collections.NonGeneric")]
[assembly: IgnoresAccessChecksTo("System.Collections.Specialized")]
[assembly: IgnoresAccessChecksTo("System.ComponentModel.Composition")]
[assembly: IgnoresAccessChecksTo("System.ComponentModel")]
[assembly: IgnoresAccessChecksTo("System.ComponentModel.EventBasedAsync")]
[assembly: IgnoresAccessChecksTo("System.ComponentModel.Primitives")]
[assembly: IgnoresAccessChecksTo("System.ComponentModel.TypeConverter")]
[assembly: IgnoresAccessChecksTo("System.Console")]
[assembly: IgnoresAccessChecksTo("System.Core")]
[assembly: IgnoresAccessChecksTo("System.Data.Common")]
[assembly: IgnoresAccessChecksTo("System.Data")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.Contracts")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.Debug")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.FileVersionInfo")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.Process")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.StackTrace")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.TextWriterTraceListener")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.Tools")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.TraceSource")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.Tracing")]
[assembly: IgnoresAccessChecksTo("System")]
[assembly: IgnoresAccessChecksTo("System.Drawing")]
[assembly: IgnoresAccessChecksTo("System.Drawing.Primitives")]
[assembly: IgnoresAccessChecksTo("System.Dynamic.Runtime")]
[assembly: IgnoresAccessChecksTo("System.Globalization.Calendars")]
[assembly: IgnoresAccessChecksTo("System.Globalization")]
[assembly: IgnoresAccessChecksTo("System.Globalization.Extensions")]
[assembly: IgnoresAccessChecksTo("System.IO.Compression")]
[assembly: IgnoresAccessChecksTo("System.IO.Compression.FileSystem")]
[assembly: IgnoresAccessChecksTo("System.IO.Compression.ZipFile")]
[assembly: IgnoresAccessChecksTo("System.IO")]
[assembly: IgnoresAccessChecksTo("System.IO.FileSystem")]
[assembly: IgnoresAccessChecksTo("System.IO.FileSystem.DriveInfo")]
[assembly: IgnoresAccessChecksTo("System.IO.FileSystem.Primitives")]
[assembly: IgnoresAccessChecksTo("System.IO.FileSystem.Watcher")]
[assembly: IgnoresAccessChecksTo("System.IO.IsolatedStorage")]
[assembly: IgnoresAccessChecksTo("System.IO.MemoryMappedFiles")]
[assembly: IgnoresAccessChecksTo("System.IO.Pipes")]
[assembly: IgnoresAccessChecksTo("System.IO.UnmanagedMemoryStream")]
[assembly: IgnoresAccessChecksTo("System.Linq")]
[assembly: IgnoresAccessChecksTo("System.Linq.Expressions")]
[assembly: IgnoresAccessChecksTo("System.Linq.Parallel")]
[assembly: IgnoresAccessChecksTo("System.Linq.Queryable")]
[assembly: IgnoresAccessChecksTo("System.Memory")]
[assembly: IgnoresAccessChecksTo("System.Net")]
[assembly: IgnoresAccessChecksTo("System.Net.Http")]
[assembly: IgnoresAccessChecksTo("System.Net.NameResolution")]
[assembly: IgnoresAccessChecksTo("System.Net.NetworkInformation")]
[assembly: IgnoresAccessChecksTo("System.Net.Ping")]
[assembly: IgnoresAccessChecksTo("System.Net.Primitives")]
[assembly: IgnoresAccessChecksTo("System.Net.Requests")]
[assembly: IgnoresAccessChecksTo("System.Net.Security")]
[assembly: IgnoresAccessChecksTo("System.Net.Sockets")]
[assembly: IgnoresAccessChecksTo("System.Net.WebHeaderCollection")]
[assembly: IgnoresAccessChecksTo("System.Net.WebSockets.Client")]
[assembly: IgnoresAccessChecksTo("System.Net.WebSockets")]
[assembly: IgnoresAccessChecksTo("System.Numerics")]
[assembly: IgnoresAccessChecksTo("System.Numerics.Vectors")]
[assembly: IgnoresAccessChecksTo("System.ObjectModel")]
[assembly: IgnoresAccessChecksTo("System.Reflection.DispatchProxy")]
[assembly: IgnoresAccessChecksTo("System.Reflection")]
[assembly: IgnoresAccessChecksTo("System.Reflection.Emit")]
[assembly: IgnoresAccessChecksTo("System.Reflection.Emit.ILGeneration")]
[assembly: IgnoresAccessChecksTo("System.Reflection.Emit.Lightweight")]
[assembly: IgnoresAccessChecksTo("System.Reflection.Extensions")]
[assembly: IgnoresAccessChecksTo("System.Reflection.Primitives")]
[assembly: IgnoresAccessChecksTo("System.Resources.Reader")]
[assembly: IgnoresAccessChecksTo("System.Resources.ResourceManager")]
[assembly: IgnoresAccessChecksTo("System.Resources.Writer")]
[assembly: IgnoresAccessChecksTo("System.Runtime.CompilerServices.VisualC")]
[assembly: IgnoresAccessChecksTo("System.Runtime")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Extensions")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Handles")]
[assembly: IgnoresAccessChecksTo("System.Runtime.InteropServices")]
[assembly: IgnoresAccessChecksTo("System.Runtime.InteropServices.RuntimeInformation")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Numerics")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Serialization")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Serialization.Formatters")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Serialization.Json")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Serialization.Primitives")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Serialization.Xml")]
[assembly: IgnoresAccessChecksTo("System.Security.Claims")]
[assembly: IgnoresAccessChecksTo("System.Security.Cryptography.Algorithms")]
[assembly: IgnoresAccessChecksTo("System.Security.Cryptography.Csp")]
[assembly: IgnoresAccessChecksTo("System.Security.Cryptography.Encoding")]
[assembly: IgnoresAccessChecksTo("System.Security.Cryptography.Primitives")]
[assembly: IgnoresAccessChecksTo("System.Security.Cryptography.X509Certificates")]
[assembly: IgnoresAccessChecksTo("System.Security.Principal")]
[assembly: IgnoresAccessChecksTo("System.Security.SecureString")]
[assembly: IgnoresAccessChecksTo("System.ServiceModel.Web")]
[assembly: IgnoresAccessChecksTo("System.Text.Encoding")]
[assembly: IgnoresAccessChecksTo("System.Text.Encoding.Extensions")]
[assembly: IgnoresAccessChecksTo("System.Text.RegularExpressions")]
[assembly: IgnoresAccessChecksTo("System.Threading")]
[assembly: IgnoresAccessChecksTo("System.Threading.Overlapped")]
[assembly: IgnoresAccessChecksTo("System.Threading.Tasks")]
[assembly: IgnoresAccessChecksTo("System.Threading.Tasks.Extensions")]
[assembly: IgnoresAccessChecksTo("System.Threading.Tasks.Parallel")]
[assembly: IgnoresAccessChecksTo("System.Threading.Thread")]
[assembly: IgnoresAccessChecksTo("System.Threading.ThreadPool")]
[assembly: IgnoresAccessChecksTo("System.Threading.Timer")]
[assembly: IgnoresAccessChecksTo("System.Transactions")]
[assembly: IgnoresAccessChecksTo("System.ValueTuple")]
[assembly: IgnoresAccessChecksTo("System.Web")]
[assembly: IgnoresAccessChecksTo("System.Windows")]
[assembly: IgnoresAccessChecksTo("System.Xml")]
[assembly: IgnoresAccessChecksTo("System.Xml.Linq")]
[assembly: IgnoresAccessChecksTo("System.Xml.ReaderWriter")]
[assembly: IgnoresAccessChecksTo("System.Xml.Serialization")]
[assembly: IgnoresAccessChecksTo("System.Xml.XDocument")]
[assembly: IgnoresAccessChecksTo("System.Xml.XmlDocument")]
[assembly: IgnoresAccessChecksTo("System.Xml.XmlSerializer")]
[assembly: IgnoresAccessChecksTo("System.Xml.XPath")]
[assembly: IgnoresAccessChecksTo("System.Xml.XPath.XDocument")]
[assembly: IgnoresAccessChecksTo("UnboundLib")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: IgnoresAccessChecksTo("UnityEngine.Physics2DModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("PickPhaseImprovements")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+332cd08206f927c804492ea8fb7401ab7942cdc6")]
[assembly: AssemblyProduct("PickPhaseImprovements")]
[assembly: AssemblyTitle("PickPhaseImprovements")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace PickPhaseImprovements
{
	[HarmonyPatch(typeof(ApplyCardStats), "ApplyStats")]
	public class PatchApplyCardStats
	{
		public static void Prefix(ApplyCardStats __instance)
		{
			if (PickManager.ShuffleCards.ContainsKey(((Component)__instance).GetComponent<CardInfo>()))
			{
				for (int i = 0; i < PickManager.ShuffleCards[((Component)__instance).GetComponent<CardInfo>()].count; i++)
				{
					PickManager.QueueShuffleForPicker(__instance.playerToUpgrade, PickManager.ShuffleCards[((Component)__instance).GetComponent<CardInfo>()]);
				}
			}
		}
	}
	[HarmonyPatch(typeof(CardChoice), "Pick")]
	public class PatchCardChoicePick
	{
		public static void Prefix(CardChoice __instance, GameObject pickedCard)
		{
			if (!((Object)(object)pickedCard == (Object)null))
			{
				PickManager.lastPickedCard = pickedCard.GetComponent<CardInfo>();
				PickManager.ActiveCondition = (CardInfo _) => true;
				PickManager.PickDepth++;
				if (PickManager.StoredHandSize != -1)
				{
					PickManager.SetPickerDraws(__instance.pickrID, PickManager.StoredHandSize);
					PickManager.StoredHandSize = -1;
				}
				PickManager.ActiveCallback?.Invoke();
				PickManager.ActiveCallback = null;
				PickManager.ActiveLimitedDraw = null;
			}
		}
	}
	[HarmonyPatch(typeof(CardChoice), "RPCA_DoEndPick")]
	public class PatchDoEndPick
	{
		public static void Prefix(CardChoice __instance)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Invalid comparison between Unknown and I4
			foreach (Player key in PickManager.ShuffleQueue.Keys)
			{
				if (!(((int)__instance.pickerType == 1) ? (key.playerID == __instance.pickrID) : (key.teamID == __instance.pickrID)) || PickManager.ShuffleQueue[key].Count <= 0)
				{
					continue;
				}
				__instance.picks++;
				if (key.data.view.IsMine)
				{
					Func<CardInfo, bool> condition = PickManager.ShuffleQueue[key][0].Condition;
					ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)Unbound.Instance, 0.25f, (Action)delegate
					{
						PickManager.ActiveCondition = condition ?? PickManager.ActiveCondition;
					});
				}
				if (PickManager.ShuffleQueue[key][0].HandSize != 0)
				{
					PickManager.StoredHandSize = DrawNCards.GetPickerDraws(__instance.pickrID);
					PickManager.SetPickerDraws(__instance.pickrID, PickManager.ShuffleQueue[key][0].Relative ? (PickManager.StoredHandSize + PickManager.ShuffleQueue[key][0].HandSize) : PickManager.ShuffleQueue[key][0].HandSize);
				}
				PickManager.ShuffleQueue[key][0].pickStartCallback?.Invoke();
				PickManager.ActiveCallback = PickManager.ShuffleQueue[key][0].pickEndCallback;
				PickManager.ShuffleQueue[key].RemoveAt(0);
				return;
			}
			foreach (Player key2 in PickManager.LimitedDrawQueue.Keys)
			{
				if ((((int)__instance.pickerType == 1) ? (key2.playerID == __instance.pickrID) : (key2.teamID == __instance.pickrID)) && PickManager.LimitedDrawQueue[key2].Count((PickManager.LimitedDraw ld) => ld.isShuffle) > 0)
				{
					__instance.picks++;
					PickManager.LimitedDraw limitedDraw = PickManager.LimitedDrawQueue[key2].First((PickManager.LimitedDraw ld) => ld.isShuffle);
					PickManager.LimitedDrawQueue[key2].Remove(limitedDraw);
					if (key2.data.view.IsMine)
					{
						PickManager.ActiveLimitedDraw = limitedDraw;
					}
					if (limitedDraw.data.HandSize != 0)
					{
						PickManager.StoredHandSize = DrawNCards.GetPickerDraws(__instance.pickrID);
						PickManager.SetPickerDraws(__instance.pickrID, limitedDraw.data.Relative ? (PickManager.StoredHandSize + limitedDraw.data.HandSize) : limitedDraw.data.HandSize);
					}
					limitedDraw.data.pickStartCallback?.Invoke();
					PickManager.ActiveCallback = limitedDraw.data.pickEndCallback;
					break;
				}
			}
		}
	}
	[HarmonyPatch(typeof(PickNCards), "ExtraPicks")]
	public class PatchPickNCards
	{
		public static void Prefix()
		{
			if (Plugin.PickNModeSetting == Plugin.PickNMode.Uncollated)
			{
				PickNCards.extraPicksInPorgress = true;
			}
		}
	}
	[HarmonyPatch(typeof(CardChoice), "StartPick")]
	public class PatchPickStart
	{
		public static void Prefix(CardChoice __instance, ref int picksToSet, int pickerIDToSet)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Invalid comparison between Unknown and I4
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Invalid comparison between Unknown and I4
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Invalid comparison between Unknown and I4
			if (Plugin.PickNModeSetting == Plugin.PickNMode.FirstOnly)
			{
				if (PickManager.PickedThisRound[PlayerManager.instance.GetPlayerWithID(pickerIDToSet)])
				{
					return;
				}
				PickManager.PickedThisRound[PlayerManager.instance.GetPlayerWithID(pickerIDToSet)] = true;
			}
			PickManager.PickDepth = 0;
			if (Plugin.PickNModeSetting == Plugin.PickNMode.Uncollated)
			{
				picksToSet = PickNCards.picks;
			}
			foreach (Player key in PickManager.AdditionalPicks.Keys)
			{
				if (((int)__instance.pickerType == 1) ? (key.playerID == pickerIDToSet) : (key.teamID == pickerIDToSet))
				{
					picksToSet += PickManager.AdditionalPicks[key];
				}
			}
			foreach (Player key2 in PickManager.ConditionalPicks.Keys)
			{
				if (!(((int)__instance.pickerType == 1) ? (key2.playerID == pickerIDToSet) : (key2.teamID == pickerIDToSet)))
				{
					continue;
				}
				foreach (PickManager.ShuffleData item in PickManager.ConditionalPicks[key2])
				{
					PickManager.QueueShuffleForPicker(key2, item);
				}
			}
			foreach (Player key3 in PickManager.LimitedDrawQueue.Keys)
			{
				if ((((int)__instance.pickerType == 1) ? (key3.playerID == __instance.pickrID) : (key3.teamID == __instance.pickrID)) && PickManager.LimitedDrawQueue[key3].Count((PickManager.LimitedDraw ld) => !ld.isShuffle) > 0)
				{
					__instance.picks++;
					PickManager.LimitedDraw limitedDraw = PickManager.LimitedDrawQueue[key3].First((PickManager.LimitedDraw ld) => !ld.isShuffle);
					PickManager.LimitedDrawQueue[key3].Remove(limitedDraw);
					if (key3.data.view.IsMine)
					{
						PickManager.ActiveLimitedDraw = limitedDraw;
					}
					if (limitedDraw.data.HandSize != 0)
					{
						PickManager.StoredHandSize = DrawNCards.GetPickerDraws(__instance.pickrID);
						PickManager.SetPickerDraws(__instance.pickrID, limitedDraw.data.Relative ? (PickManager.StoredHandSize + limitedDraw.data.HandSize) : limitedDraw.data.HandSize);
					}
					limitedDraw.data.pickStartCallback?.Invoke();
					PickManager.ActiveCallback = limitedDraw.data.pickEndCallback;
					break;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CardChoice), "ReplaceCards")]
	public class PatchReplaceCards
	{
		internal static List<CardInfo> GeneratedCards = new List<CardInfo>();

		internal static int GeneratingCard;

		public static bool Prefix(CardChoice __instance, GameObject pickedCard, bool clear, ref IEnumerator __result)
		{
			NetworkingManager.RPC(typeof(PatchReplaceCards), "FixHandSize", new object[1] { __instance.pickrID });
			__result = ReplaceCards(pickedCard, clear);
			return false;
		}

		[UnboundRPC]
		public static void FixHandSize(int pickrID)
		{
			CardChoicePatchStartPick.Prefix(CardChoice.instance, pickrID);
		}

		public static IEnumerator ReplaceCards(GameObject pickedCard = null, bool clear = false)
		{
			CardChoice cardChoice = CardChoice.instance;
			Player player = (((int)cardChoice.pickerType != 0) ? PlayerManager.instance.players[cardChoice.pickrID] : PlayerManager.instance.GetPlayersInTeam(cardChoice.pickrID)[0]);
			if (cardChoice.picks > 0)
			{
				SoundPlayerStatic.Instance.PlayPlayerBallAppear();
			}
			cardChoice.isPlaying = true;
			if (clear && cardChoice.spawnedCards != null)
			{
				int i = 0;
				while (i < cardChoice.spawnedCards.Count)
				{
					if ((Object)(object)pickedCard != (Object)(object)cardChoice.spawnedCards[i])
					{
						cardChoice.spawnedCards[i].GetComponentInChildren<CardVisuals>().Leave();
						yield return (object)new WaitForSecondsRealtime(0.1f);
					}
					int num = i + 1;
					i = num;
				}
				yield return (object)new WaitForSecondsRealtime(0.2f);
				if (Object.op_Implicit((Object)(object)pickedCard))
				{
					pickedCard.GetComponentInChildren<CardVisuals>().Pick();
				}
				cardChoice.spawnedCards.Clear();
			}
			yield return (object)new WaitForSecondsRealtime(0.2f);
			GeneratedCards.Clear();
			if (cardChoice.picks > 0)
			{
				PickManager.LimitedDraw? activeLimitedDraw = PickManager.ActiveLimitedDraw;
				PickManager.LimitedDraw limitedDraw = default(PickManager.LimitedDraw);
				int num2;
				if (activeLimitedDraw.HasValue)
				{
					limitedDraw = activeLimitedDraw.GetValueOrDefault();
					num2 = 1;
				}
				else
				{
					num2 = 0;
				}
				List<CardInfo> ValidCards;
				if (num2 != 0)
				{
					ValidCards = limitedDraw.deck;
					if (!limitedDraw.ignoreRestrictions)
					{
						ValidCards = Cards.instance.GetAllCardsWithCondition(ValidCards.ToArray(), player, (Func<CardInfo, Player, bool>)((CardInfo p, Player c) => Cards.instance.PlayerIsAllowedCard(c, p))).ToList();
					}
				}
				else
				{
					ValidCards = Cards.instance.GetAllCardsWithCondition(cardChoice, player, (Func<CardInfo, Player, bool>)((CardInfo p, Player c) => Cards.instance.PlayerIsAllowedCard(c, p))).ToList();
				}
				List<CardInfo> TemperarilyRemoved = new List<CardInfo>();
				while (GeneratedCards.Count < cardChoice.children.Length)
				{
					CardInfo randomCard;
					if (ValidCards.Count > 0)
					{
						randomCard = CardChoicePatchGetRanomCard.OrignialGetRanomCard(ValidCards.ToArray()).GetComponent<CardInfo>();
						if (GeneratedCards.Count > 0)
						{
							bool valid = true;
							foreach (Func<CardInfo[], CardInfo, PickManager.ValidationResult> func in PickManager.DrawValidationFunctions)
							{
								PickManager.ValidationResult result = func(GeneratedCards.ToArray(), randomCard);
								if (result == PickManager.ValidationResult.Valid)
								{
									continue;
								}
								if (result == PickManager.ValidationResult.CurrentlyInvalid)
								{
									TemperarilyRemoved.Add(randomCard);
								}
								ValidCards.Remove(randomCard);
								valid = false;
								break;
							}
							if (!valid)
							{
								continue;
							}
						}
					}
					else
					{
						randomCard = CardChoiceSpawnUniqueCardPatch.NullCard;
					}
					GeneratedCards.Add(randomCard);
					ValidCards.AddRange(TemperarilyRemoved);
					TemperarilyRemoved.Clear();
					if (!randomCard.categories.Contains(CustomCardCategories.CanDrawMultipleCategory))
					{
						ValidCards.Remove(randomCard);
					}
				}
				foreach (PickManager.HandModification handModification in PickManager.HandModifications)
				{
					GeneratedCards = handModification.Func(GeneratedCards.ToArray()).ToList();
				}
				for (GeneratingCard = 0; GeneratingCard < cardChoice.children.Length; GeneratingCard++)
				{
					cardChoice.spawnedCards.Add(cardChoice.SpawnUniqueCard(((Component)cardChoice.children[GeneratingCard]).transform.position, ((Component)cardChoice.children[GeneratingCard]).transform.rotation));
					cardChoice.spawnedCards[GeneratingCard].AddComponent<PublicInt>().theInt = GeneratingCard;
					PickManager.CardSpawnCallbacks.ForEach(delegate(Action<GameObject> callback)
					{
						callback(cardChoice.spawnedCards[GeneratingCard]);
					});
					yield return (object)new WaitForSecondsRealtime(PickNCards.delay);
				}
				foreach (Action<CardInfo[]> finalizationAction in PickManager.FinalizationActions)
				{
					finalizationAction(GeneratedCards.ToArray());
				}
			}
			else
			{
				((Component)cardChoice).GetComponent<PhotonView>().RPC("RPCA_DonePicking", (RpcTarget)0, Array.Empty<object>());
			}
			CardChoice obj = cardChoice;
			obj.picks--;
			cardChoice.isPlaying = false;
		}
	}
	[HarmonyPatch(typeof(CardChoice), "SpawnUniqueCard")]
	[HarmonyPriority(800)]
	public class PatchSpawnUniqueCard
	{
		public static bool Prefix(CardChoice __instance, Vector3 pos, Quaternion rot, ref GameObject __result)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			CardInfo val = PatchReplaceCards.GeneratedCards[PatchReplaceCards.GeneratingCard];
			string text = (PickManager.AlternetSpawnName.ContainsKey(val) ? PickManager.AlternetSpawnName[val] : ((Object)val).name);
			if (PickManager.Synchronous)
			{
				__result = PhotonNetwork.prefabPool.Instantiate(text, pos, rot);
				__result.GetComponent<PhotonView>().instantiationDataField = ExtensionMethods.GetValueOrDefault<CardInfo, object[]>((IDictionary<CardInfo, object[]>)PickManager.CustomPhotonData, val);
				__result.GetComponent<IPunInstantiateMagicCallback>().OnPhotonInstantiate(new PhotonMessageInfo(PhotonNetwork.LocalPlayer, PhotonNetwork.ServerTimestamp, __result.GetComponent<PhotonView>()));
				__result.transform.localScale = DrawNCards.GetScale(DrawNCards.numDraws);
				__instance.spawnedCards.Add(__result);
			}
			else
			{
				__result = PhotonNetwork.Instantiate(text, pos, rot, (byte)0, ExtensionMethods.GetValueOrDefault<CardInfo, object[]>((IDictionary<CardInfo, object[]>)PickManager.CustomPhotonData, val));
				__result.GetComponent<CardInfo>().sourceCard = ((Component)val).GetComponent<CardInfo>();
				((Behaviour)((Component)__result.GetComponentInChildren<DamagableEvent>()).GetComponent<Collider2D>()).enabled = false;
				CardChoicePatchSpawn.Postfix(ref __result);
			}
			return false;
		}
	}
	public static class PickManager
	{
		internal struct LimitedDraw : IEquatable<LimitedDraw>
		{
			internal List<CardInfo> deck;

			internal bool isShuffle;

			internal bool ignoreRestrictions;

			internal ShuffleData data;

			public bool Equals(LimitedDraw other)
			{
				return deck.Equals(other.deck) && isShuffle == other.isShuffle && ignoreRestrictions == other.ignoreRestrictions;
			}

			public override bool Equals(object? obj)
			{
				return obj is LimitedDraw other && Equals(other);
			}

			public override int GetHashCode()
			{
				return HashCode.Combine(deck, isShuffle, ignoreRestrictions);
			}

			public static bool operator ==(LimitedDraw left, LimitedDraw right)
			{
				return left.Equals(right);
			}

			public static bool operator !=(LimitedDraw left, LimitedDraw right)
			{
				return !left.Equals(right);
			}
		}

		public struct ShuffleData : IEquatable<ShuffleData>
		{
			public int HandSize;

			public bool Relative;

			public Func<CardInfo, bool> Condition;

			public Action pickStartCallback;

			public Action pickEndCallback;

			internal int count;

			public bool Equals(ShuffleData other)
			{
				return HandSize == other.HandSize && Relative == other.Relative && Condition.Equals(other.Condition);
			}

			public override bool Equals(object? obj)
			{
				return obj is ShuffleData other && Equals(other);
			}

			public override int GetHashCode()
			{
				return HashCode.Combine(HandSize, Relative, Condition);
			}
		}

		internal struct HandModification
		{
			internal Func<CardInfo[], CardInfo[]> Func;

			internal int Priority;
		}

		public enum ValidationResult
		{
			Valid,
			Invalid,
			CurrentlyInvalid
		}

		internal static Dictionary<CardInfo, ShuffleData> ShuffleCards = new Dictionary<CardInfo, ShuffleData>();

		internal static Dictionary<Player, List<ShuffleData>> ShuffleQueue = new Dictionary<Player, List<ShuffleData>>();

		internal static Dictionary<Player, List<ShuffleData>> ConditionalPicks = new Dictionary<Player, List<ShuffleData>>();

		internal static Dictionary<Player, int> AdditionalPicks = new Dictionary<Player, int>();

		internal static Dictionary<Player, bool> PickedThisRound = new Dictionary<Player, bool>();

		internal static Func<CardInfo, bool> ActiveCondition = (CardInfo _) => true;

		internal static Action ActiveCallback = null;

		internal static Dictionary<Player, List<LimitedDraw>> LimitedDrawQueue = new Dictionary<Player, List<LimitedDraw>>();

		internal static LimitedDraw? ActiveLimitedDraw = null;

		public static int PickDepth = 0;

		public static CardInfo lastPickedCard;

		internal static int StoredHandSize = -1;

		public static bool Synchronous = false;

		internal static List<Func<CardInfo[], CardInfo, ValidationResult>> DrawValidationFunctions = new List<Func<CardInfo[], CardInfo, ValidationResult>>();

		internal static List<HandModification> HandModifications = new List<HandModification>();

		internal static List<Action<GameObject>> CardSpawnCallbacks = new List<Action<GameObject>>();

		internal static List<Action<CardInfo[]>> FinalizationActions = new List<Action<CardInfo[]>>();

		internal static Dictionary<CardInfo, object[]> CustomPhotonData = new Dictionary<CardInfo, object[]>();

		internal static Dictionary<CardInfo, string> AlternetSpawnName = new Dictionary<CardInfo, string>();

		public static bool IsShuffleCard(CardInfo cardInfo)
		{
			return ShuffleCards.ContainsKey(cardInfo);
		}

		public static void RegisterShuffleCard(CardInfo cardInfo, int handSize = 0, bool isRelative = false, Func<CardInfo, bool> condition = null, int count = 1, Action pickStartCallback = null, Action pickEndCallback = null)
		{
			RegisterShuffleCard(cardInfo, new ShuffleData
			{
				HandSize = handSize,
				Relative = isRelative,
				Condition = condition,
				count = count,
				pickStartCallback = pickStartCallback,
				pickEndCallback = pickEndCallback
			});
		}

		public static void RegisterShuffleCard(CardInfo cardInfo, ShuffleData data)
		{
			ShuffleCards.TryAdd(cardInfo, data);
		}

		public static void QueueShuffleForPicker(Player picker, int handSize = 0, bool isRelative = false, Func<CardInfo, bool> condition = null)
		{
			QueueShuffleForPicker(picker, new ShuffleData
			{
				HandSize = handSize,
				Relative = isRelative,
				Condition = condition
			});
		}

		public static void QueueLimitedDraw(Player picker, List<CardInfo> deck, bool isShuffle = true, bool ignoreRestrictions = false, int handSize = 0, bool isRelative = false, Action pickStartCallback = null, Action pickEndCallback = null)
		{
			if (!LimitedDrawQueue.ContainsKey(picker))
			{
				LimitedDrawQueue[picker] = new List<LimitedDraw>();
			}
			LimitedDrawQueue[picker].Add(new LimitedDraw
			{
				deck = deck,
				isShuffle = isShuffle,
				ignoreRestrictions = ignoreRestrictions,
				data = new ShuffleData
				{
					HandSize = handSize,
					Relative = isRelative,
					pickStartCallback = pickStartCallback,
					pickEndCallback = pickEndCallback
				}
			});
		}

		public static void QueueShuffleForPicker(Player picker, ShuffleData data)
		{
			if (!ShuffleQueue.ContainsKey(picker))
			{
				ShuffleQueue.Add(picker, new List<ShuffleData>());
			}
			ShuffleQueue[picker].Add(data);
		}

		public static void GiveAdditionalPicks(this Player picker, int picks = 1)
		{
			if (!AdditionalPicks.TryAdd(picker, picks))
			{
				AdditionalPicks[picker] += picks;
			}
		}

		public static ShuffleData GiveConditionalPick(this Player picker, int handSize = 0, bool isRelative = false, Func<CardInfo, bool> condition = null, Action pickStartCallback = null, Action pickEndCallback = null)
		{
			return picker.GiveConditionalPick(new ShuffleData
			{
				HandSize = handSize,
				Relative = isRelative,
				Condition = condition,
				pickStartCallback = pickStartCallback,
				pickEndCallback = pickEndCallback
			});
		}

		public static ShuffleData GiveConditionalPick(this Player picker, ShuffleData data)
		{
			if (!ConditionalPicks.ContainsKey(picker))
			{
				ConditionalPicks.Add(picker, new List<ShuffleData>());
			}
			ConditionalPicks[picker].Add(data);
			return data;
		}

		public static bool RemoveConditionalPick(this Player picker, int handSize = 0, bool isRelative = false, Func<CardInfo, bool> condition = null, Action pickStartCallback = null, Action pickEndCallback = null)
		{
			return picker.RemoveConditionalPick(new ShuffleData
			{
				HandSize = handSize,
				Relative = isRelative,
				Condition = condition,
				pickStartCallback = pickStartCallback,
				pickEndCallback = pickEndCallback
			});
		}

		public static bool RemoveConditionalPick(this Player picker, ShuffleData data)
		{
			return ConditionalPicks.ContainsKey(picker) && ConditionalPicks[picker].Remove(data);
		}

		public static int GetPlayerPickCount(this Player picker)
		{
			return ConditionalPicks.ContainsKey(picker) ? (ConditionalPicks[picker].Count + AdditionalPicks.GetValueOrDefault(picker)) : AdditionalPicks.GetValueOrDefault(picker);
		}

		public static void RegisterDrawValidationFunction(Func<CardInfo[], CardInfo, ValidationResult> func)
		{
			DrawValidationFunctions.Add(func);
		}

		public static void RegisterHandModificationFunction(Func<CardInfo[], CardInfo[]> func, int priority = 400)
		{
			HandModifications.Add(new HandModification
			{
				Func = func,
				Priority = priority
			});
			HandModifications.Sort((HandModification a, HandModification b) => b.Priority - a.Priority);
		}

		public static void RegisterCardSpawnCallbacks(Action<GameObject> func)
		{
			CardSpawnCallbacks.Add(func);
		}

		public static void RegisterHandFinalizationAction(Action<CardInfo[]> func)
		{
			FinalizationActions.Add(func);
		}

		public static void RegisterCustomPhotonData(CardInfo card, params object[] data)
		{
			CustomPhotonData[card] = data;
		}

		public static void RegisterAlternetSpawnName(CardInfo card, string name)
		{
			AlternetSpawnName[card] = name;
		}

		internal static void SetPickerDraws(int pickerIDToSet, int drawCountToSet)
		{
			drawCountToSet = Mathf.Clamp(drawCountToSet, 1, 30);
			NetworkingManager.RPC(typeof(DrawNCards), "RPCA_SetPickerDraws", new object[2] { pickerIDToSet, drawCountToSet });
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Systems.R00t.PickPhaseImprovements", "Pick Phase Improvments", "0.4.2")]
	[BepInProcess("Rounds.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public enum PickNMode
		{
			Normal,
			Uncollated,
			FirstOnly
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__10_0;

			public static Action <>9__10_1;

			public static Func<CardInfo, bool> <>9__15_0;

			public static UnityAction<float> <>9__17_1;

			public static UnityAction<float> <>9__17_0;

			internal void <Awake>b__10_0()
			{
			}

			internal void <Awake>b__10_1()
			{
				if (PhotonNetwork.IsMasterClient)
				{
					NetworkingManager.RPC_Others(typeof(Plugin), "SyncSettings", new object[2]
					{
						(int)PickNModeSetting,
						BonusStartingPicks
					});
				}
			}

			internal bool <ResetData>b__15_0(CardInfo _)
			{
				return true;
			}

			internal void <ModGUI>b__17_1(float val)
			{
				BonusStartingPicksConfig.Value = (int)val;
				BonusStartingPicks = (int)val;
			}

			internal void <ModGUI>b__17_0(float val)
			{
				PickNModeConfig.Value = (int)val;
				PickNModeSetting = (PickNMode)PickNModeConfig.Value;
				((TMP_Text)((Component)((Component)slider).transform.parent.GetChild(((Component)slider).transform.parent.childCount - 1)).GetComponent<TextMeshProUGUI>()).text = PickNModeSetting.ToString();
			}
		}

		private const string ModId = "Systems.R00t.PickPhaseImprovements";

		private const string ModName = "Pick Phase Improvments";

		public const string Version = "0.4.2";

		public static ConfigEntry<int> PickNModeConfig;

		public static PickNMode PickNModeSetting;

		public static int BonusStartingPicks;

		public static ConfigEntry<int> BonusStartingPicksConfig;

		private static Slider slider;

		private static Harmony harmony;

		private void Awake()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			PickNModeConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Systems.R00t.PickPhaseImprovements", "PickNModeSetting", 0, (ConfigDescription)null);
			PickNModeSetting = (PickNMode)PickNModeConfig.Value;
			BonusStartingPicksConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Systems.R00t.PickPhaseImprovements", "BonusStartingPicksSetting", 0, (ConfigDescription)null);
			BonusStartingPicks = BonusStartingPicksConfig.Value;
			harmony = new Harmony("Systems.R00t.PickPhaseImprovements");
			harmony.PatchAll();
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)ResetData, 800);
			GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)NewRound);
			Cards.instance.AddCardValidationFunction((Func<Player, CardInfo, bool>)CheckCondition);
			Cards.instance.AddCardValidationFunction((Func<Player, CardInfo, bool>)LockGunToDefualtCheck);
			object obj = <>c.<>9__10_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
				};
				<>c.<>9__10_0 = val;
				obj = (object)val;
			}
			Unbound.RegisterMenu("Pick Phase Improvments", (UnityAction)obj, (Action<GameObject>)ModGUI, (GameObject)null, false);
			Unbound.RegisterHandshake("Systems.R00t.PickPhaseImprovements", (Action)delegate
			{
				if (PhotonNetwork.IsMasterClient)
				{
					NetworkingManager.RPC_Others(typeof(Plugin), "SyncSettings", new object[2]
					{
						(int)PickNModeSetting,
						BonusStartingPicks
					});
				}
			});
		}

		private IEnumerator Start()
		{
			for (int _ = 0; _ < 5; _++)
			{
				yield return null;
			}
			MethodInfo SpawnUniqueCard = typeof(CardChoice).GetMethod("SpawnUniqueCard", BindingFlags.Instance | BindingFlags.NonPublic);
			harmony.Unpatch((MethodBase)SpawnUniqueCard, (HarmonyPatchType)1, "pykess.rounds.plugins.cardchoicespawnuniquecardpatch");
		}

		private bool CheckCondition(Player _, CardInfo cardInfo)
		{
			return PickManager.ActiveCondition(cardInfo);
		}

		private bool LockGunToDefualtCheck(Player player, CardInfo card)
		{
			Holdable holdable = ((Component)player.data).GetComponent<Holding>().holdable;
			if (Object.op_Implicit((Object)(object)holdable))
			{
				Gun component = ((Component)holdable).GetComponent<Gun>();
				Gun component2 = ((Component)card).GetComponent<Gun>();
				if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component) && component2.lockGunToDefault && component.lockGunToDefault)
				{
					return false;
				}
			}
			return true;
		}

		private IEnumerator NewRound(IGameModeHandler _)
		{
			foreach (Player player in PlayerManager.instance.players)
			{
				PickManager.PickedThisRound[player] = false;
			}
			yield break;
		}

		private IEnumerator ResetData(IGameModeHandler _)
		{
			PickNCards.extraPicksInPorgress = false;
			PickManager.ShuffleQueue.Clear();
			foreach (Player player in PlayerManager.instance.players)
			{
				for (int i = 0; i < BonusStartingPicks; i++)
				{
					PickManager.QueueShuffleForPicker(player);
				}
			}
			PickManager.ConditionalPicks.Clear();
			PickManager.AdditionalPicks.Clear();
			PickManager.ActiveCondition = (CardInfo _) => true;
			PickManager.StoredHandSize = -1;
			PickManager.LimitedDrawQueue.Clear();
			yield return NewRound(_);
		}

		[UnboundRPC]
		private static void SyncSettings(int pickNMode, int bonusStatingPicks)
		{
			PickNModeSetting = (PickNMode)pickNMode;
			BonusStartingPicks = bonusStatingPicks;
		}

		public void ModGUI(GameObject menu)
		{
			TextAlignmentOptions? val2 = (TextAlignmentOptions)514;
			TextMeshProUGUI val3 = default(TextMeshProUGUI);
			MenuHandler.CreateText("Pick Phase Improvments Settings:", menu, ref val3, 80, true, (Color?)null, (TMP_FontAsset)null, (Material)null, val2);
			Slider val4 = default(Slider);
			MenuHandler.CreateSlider("Bonus Starting Picks", menu, 30, 0f, 10f, (float)BonusStartingPicks, (UnityAction<float>)delegate(float val)
			{
				BonusStartingPicksConfig.Value = (int)val;
				BonusStartingPicks = (int)val;
			}, ref val4, true, (Color?)null, (Direction)0, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			val2 = (TextAlignmentOptions)514;
			MenuHandler.CreateText("Pick N Compatibility Mode", menu, ref val3, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, val2);
			MenuHandler.CreateSlider(PickNModeSetting.ToString(), menu, 30, 0f, 2f, (float)PickNModeSetting, (UnityAction<float>)delegate(float val)
			{
				PickNModeConfig.Value = (int)val;
				PickNModeSetting = (PickNMode)PickNModeConfig.Value;
				((TMP_Text)((Component)((Component)slider).transform.parent.GetChild(((Component)slider).transform.parent.childCount - 1)).GetComponent<TextMeshProUGUI>()).text = PickNModeSetting.ToString();
			}, ref slider, true, (Color?)null, (Direction)0, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			Object.Destroy((Object)(object)((Component)((Component)slider).transform.parent.GetChild(1)).gameObject);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

PickTimerCompat.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PickTimer;
using PickTimer.Util;
using UnboundLib;
using UnboundLib.GameModes;
using UnityEngine;

[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("0Harmony")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("BepInEx")]
[assembly: IgnoresAccessChecksTo("Microsoft.Win32.Primitives")]
[assembly: IgnoresAccessChecksTo("mscorlib")]
[assembly: IgnoresAccessChecksTo("netstandard")]
[assembly: IgnoresAccessChecksTo("PickPhaseImprovements")]
[assembly: IgnoresAccessChecksTo("PickTimer")]
[assembly: IgnoresAccessChecksTo("System.AppContext")]
[assembly: IgnoresAccessChecksTo("System.Buffers")]
[assembly: IgnoresAccessChecksTo("System.Collections.Concurrent")]
[assembly: IgnoresAccessChecksTo("System.Collections")]
[assembly: IgnoresAccessChecksTo("System.Collections.NonGeneric")]
[assembly: IgnoresAccessChecksTo("System.Collections.Specialized")]
[assembly: IgnoresAccessChecksTo("System.ComponentModel.Composition")]
[assembly: IgnoresAccessChecksTo("System.ComponentModel")]
[assembly: IgnoresAccessChecksTo("System.ComponentModel.EventBasedAsync")]
[assembly: IgnoresAccessChecksTo("System.ComponentModel.Primitives")]
[assembly: IgnoresAccessChecksTo("System.ComponentModel.TypeConverter")]
[assembly: IgnoresAccessChecksTo("System.Console")]
[assembly: IgnoresAccessChecksTo("System.Core")]
[assembly: IgnoresAccessChecksTo("System.Data.Common")]
[assembly: IgnoresAccessChecksTo("System.Data")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.Contracts")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.Debug")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.FileVersionInfo")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.Process")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.StackTrace")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.TextWriterTraceListener")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.Tools")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.TraceSource")]
[assembly: IgnoresAccessChecksTo("System.Diagnostics.Tracing")]
[assembly: IgnoresAccessChecksTo("System")]
[assembly: IgnoresAccessChecksTo("System.Drawing")]
[assembly: IgnoresAccessChecksTo("System.Drawing.Primitives")]
[assembly: IgnoresAccessChecksTo("System.Dynamic.Runtime")]
[assembly: IgnoresAccessChecksTo("System.Globalization.Calendars")]
[assembly: IgnoresAccessChecksTo("System.Globalization")]
[assembly: IgnoresAccessChecksTo("System.Globalization.Extensions")]
[assembly: IgnoresAccessChecksTo("System.IO.Compression")]
[assembly: IgnoresAccessChecksTo("System.IO.Compression.FileSystem")]
[assembly: IgnoresAccessChecksTo("System.IO.Compression.ZipFile")]
[assembly: IgnoresAccessChecksTo("System.IO")]
[assembly: IgnoresAccessChecksTo("System.IO.FileSystem")]
[assembly: IgnoresAccessChecksTo("System.IO.FileSystem.DriveInfo")]
[assembly: IgnoresAccessChecksTo("System.IO.FileSystem.Primitives")]
[assembly: IgnoresAccessChecksTo("System.IO.FileSystem.Watcher")]
[assembly: IgnoresAccessChecksTo("System.IO.IsolatedStorage")]
[assembly: IgnoresAccessChecksTo("System.IO.MemoryMappedFiles")]
[assembly: IgnoresAccessChecksTo("System.IO.Pipes")]
[assembly: IgnoresAccessChecksTo("System.IO.UnmanagedMemoryStream")]
[assembly: IgnoresAccessChecksTo("System.Linq")]
[assembly: IgnoresAccessChecksTo("System.Linq.Expressions")]
[assembly: IgnoresAccessChecksTo("System.Linq.Parallel")]
[assembly: IgnoresAccessChecksTo("System.Linq.Queryable")]
[assembly: IgnoresAccessChecksTo("System.Memory")]
[assembly: IgnoresAccessChecksTo("System.Net")]
[assembly: IgnoresAccessChecksTo("System.Net.Http")]
[assembly: IgnoresAccessChecksTo("System.Net.NameResolution")]
[assembly: IgnoresAccessChecksTo("System.Net.NetworkInformation")]
[assembly: IgnoresAccessChecksTo("System.Net.Ping")]
[assembly: IgnoresAccessChecksTo("System.Net.Primitives")]
[assembly: IgnoresAccessChecksTo("System.Net.Requests")]
[assembly: IgnoresAccessChecksTo("System.Net.Security")]
[assembly: IgnoresAccessChecksTo("System.Net.Sockets")]
[assembly: IgnoresAccessChecksTo("System.Net.WebHeaderCollection")]
[assembly: IgnoresAccessChecksTo("System.Net.WebSockets.Client")]
[assembly: IgnoresAccessChecksTo("System.Net.WebSockets")]
[assembly: IgnoresAccessChecksTo("System.Numerics")]
[assembly: IgnoresAccessChecksTo("System.Numerics.Vectors")]
[assembly: IgnoresAccessChecksTo("System.ObjectModel")]
[assembly: IgnoresAccessChecksTo("System.Reflection.DispatchProxy")]
[assembly: IgnoresAccessChecksTo("System.Reflection")]
[assembly: IgnoresAccessChecksTo("System.Reflection.Emit")]
[assembly: IgnoresAccessChecksTo("System.Reflection.Emit.ILGeneration")]
[assembly: IgnoresAccessChecksTo("System.Reflection.Emit.Lightweight")]
[assembly: IgnoresAccessChecksTo("System.Reflection.Extensions")]
[assembly: IgnoresAccessChecksTo("System.Reflection.Primitives")]
[assembly: IgnoresAccessChecksTo("System.Resources.Reader")]
[assembly: IgnoresAccessChecksTo("System.Resources.ResourceManager")]
[assembly: IgnoresAccessChecksTo("System.Resources.Writer")]
[assembly: IgnoresAccessChecksTo("System.Runtime.CompilerServices.VisualC")]
[assembly: IgnoresAccessChecksTo("System.Runtime")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Extensions")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Handles")]
[assembly: IgnoresAccessChecksTo("System.Runtime.InteropServices")]
[assembly: IgnoresAccessChecksTo("System.Runtime.InteropServices.RuntimeInformation")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Numerics")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Serialization")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Serialization.Formatters")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Serialization.Json")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Serialization.Primitives")]
[assembly: IgnoresAccessChecksTo("System.Runtime.Serialization.Xml")]
[assembly: IgnoresAccessChecksTo("System.Security.Claims")]
[assembly: IgnoresAccessChecksTo("System.Security.Cryptography.Algorithms")]
[assembly: IgnoresAccessChecksTo("System.Security.Cryptography.Csp")]
[assembly: IgnoresAccessChecksTo("System.Security.Cryptography.Encoding")]
[assembly: IgnoresAccessChecksTo("System.Security.Cryptography.Primitives")]
[assembly: IgnoresAccessChecksTo("System.Security.Cryptography.X509Certificates")]
[assembly: IgnoresAccessChecksTo("System.Security.Principal")]
[assembly: IgnoresAccessChecksTo("System.Security.SecureString")]
[assembly: IgnoresAccessChecksTo("System.ServiceModel.Web")]
[assembly: IgnoresAccessChecksTo("System.Text.Encoding")]
[assembly: IgnoresAccessChecksTo("System.Text.Encoding.Extensions")]
[assembly: IgnoresAccessChecksTo("System.Text.RegularExpressions")]
[assembly: IgnoresAccessChecksTo("System.Threading")]
[assembly: IgnoresAccessChecksTo("System.Threading.Overlapped")]
[assembly: IgnoresAccessChecksTo("System.Threading.Tasks")]
[assembly: IgnoresAccessChecksTo("System.Threading.Tasks.Extensions")]
[assembly: IgnoresAccessChecksTo("System.Threading.Tasks.Parallel")]
[assembly: IgnoresAccessChecksTo("System.Threading.Thread")]
[assembly: IgnoresAccessChecksTo("System.Threading.ThreadPool")]
[assembly: IgnoresAccessChecksTo("System.Threading.Timer")]
[assembly: IgnoresAccessChecksTo("System.Transactions")]
[assembly: IgnoresAccessChecksTo("System.ValueTuple")]
[assembly: IgnoresAccessChecksTo("System.Web")]
[assembly: IgnoresAccessChecksTo("System.Windows")]
[assembly: IgnoresAccessChecksTo("System.Xml")]
[assembly: IgnoresAccessChecksTo("System.Xml.Linq")]
[assembly: IgnoresAccessChecksTo("System.Xml.ReaderWriter")]
[assembly: IgnoresAccessChecksTo("System.Xml.Serialization")]
[assembly: IgnoresAccessChecksTo("System.Xml.XDocument")]
[assembly: IgnoresAccessChecksTo("System.Xml.XmlDocument")]
[assembly: IgnoresAccessChecksTo("System.Xml.XmlSerializer")]
[assembly: IgnoresAccessChecksTo("System.Xml.XPath")]
[assembly: IgnoresAccessChecksTo("System.Xml.XPath.XDocument")]
[assembly: IgnoresAccessChecksTo("UnboundLib")]
[assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: AssemblyCompany("PickTimerCompat")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+470cf00a981fe76ad8146a67c7315e29ff87326f")]
[assembly: AssemblyProduct("PickTimerCompat")]
[assembly: AssemblyTitle("PickTimerCompat")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace PickTimerCompat
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Systems.R00t.PickPhaseImprovements.PickTimerCompat", "PickTimerCompat", "0.1.0")]
	[BepInProcess("Rounds.exe")]
	[HarmonyPatch]
	public class Plugin : BaseUnityPlugin
	{
		private const string ModId = "Systems.R00t.PickPhaseImprovements.PickTimerCompat";

		private const string ModName = "PickTimerCompat";

		public const string Version = "0.1.0";

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("Systems.R00t.PickPhaseImprovements.PickTimerCompat").PatchAll();
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CardChoice), "ReplaceCards")]
		public static void RetriggerTimer(CardChoice __instance)
		{
			if (__instance.picks > 0)
			{
				((MonoBehaviour)__instance).StartCoroutine(TimerHandler.Start((IGameModeHandler)null));
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PickTimerController), "StartPickTimer")]
		public static bool FixTimerSoftlock(CardChoice instance, ref IEnumerator __result)
		{
			__result = FixedStartPickTimer(instance);
			return false;
		}

		public static IEnumerator FixedStartPickTimer(CardChoice instance)
		{
			if (PickTimer.PickTimerEnabled)
			{
				if (PickTimerController.TimerCr != null)
				{
					((MonoBehaviour)Unbound.Instance).StopCoroutine(PickTimerController.TimerCr);
				}
				PickTimerController.TimerCr = ((MonoBehaviour)Unbound.Instance).StartCoroutine(PickTimerController.Timer((float)PickTimer.PickTimerTime));
				yield return (object)new WaitForSecondsRealtime((float)PickTimer.PickTimerTime);
				Traverse traverse = Traverse.Create((object)instance);
				List<GameObject> spawnedCards = (List<GameObject>)traverse.Field("spawnedCards").GetValue();
				instance.Pick(spawnedCards[PickTimerController.Random.Next(0, spawnedCards.Count)], false);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}