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 System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using ClassesManagerReborn.Cards;
using ClassesManagerReborn.Patchs;
using ClassesManagerReborn.Util;
using HarmonyLib;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Extensions;
using ModdingUtils.Utils;
using Photon.Pun;
using RarityLib.Utils;
using Sirenix.OdinInspector;
using TMPro;
using UnboundLib;
using UnboundLib.Cards;
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(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(/*Could not decode attribute arguments.*/)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ClassesManagerReborn
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("root.classes.manager.reborn", "Classes Manager Reborn", "1.5.5")]
[BepInProcess("Rounds.exe")]
public class ClassesManager : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c : Object
{
public static readonly <>c <>9 = new <>c();
public static Func<BepInDependency, bool> <>9__17_3;
public static Func<PluginInfo, bool> <>9__17_0;
public static Func<Type, bool> <>9__17_4;
public static Func<Task, bool> <>9__17_5;
public static Func<Task, bool> <>9__17_6;
public static Func<Task, bool> <>9__17_1;
public static Func<Task, bool> <>9__17_7;
public static Func<Task, bool> <>9__17_8;
public static Func<Task, bool> <>9__17_2;
public static UnityAction <>9__19_0;
public static Action<CardInfo> <>9__19_1;
public static Action<CardInfo> <>9__19_2;
public static UnityAction<bool> <>9__22_0;
public static UnityAction<bool> <>9__22_1;
public static UnityAction<bool> <>9__22_2;
public static UnityAction<bool> <>9__22_3;
public static UnityAction<float> <>9__22_5;
public static UnityAction<bool> <>9__22_4;
public static Func<Task, bool> <>9__25_0;
public static Func<Task, bool> <>9__25_1;
internal bool <InstantiateModClasses>b__17_0(PluginInfo pi)
{
return Enumerable.Any<BepInDependency>(pi.Dependencies, (Func<BepInDependency, bool>)((BepInDependency d) => d.DependencyGUID == "root.classes.manager.reborn"));
}
internal bool <InstantiateModClasses>b__17_3(BepInDependency d)
{
return d.DependencyGUID == "root.classes.manager.reborn";
}
internal bool <InstantiateModClasses>b__17_4(Type myType)
{
if (myType.IsClass && !myType.IsAbstract)
{
return myType.IsSubclassOf(typeof(ClassHandler));
}
return false;
}
internal bool <InstantiateModClasses>b__17_5(Task t)
{
return t.Running;
}
internal bool <InstantiateModClasses>b__17_6(Task t)
{
return t.Running;
}
internal bool <InstantiateModClasses>b__17_1(Task t)
{
return t.Running;
}
internal bool <InstantiateModClasses>b__17_7(Task t)
{
return t.Running;
}
internal bool <InstantiateModClasses>b__17_8(Task t)
{
return t.Running;
}
internal bool <InstantiateModClasses>b__17_2(Task t)
{
return t.Running;
}
internal void <Start>b__19_0()
{
}
internal void <Start>b__19_1(CardInfo card)
{
JACK.card = card;
}
internal void <Start>b__19_2(CardInfo card)
{
MasteringTrade.card = card;
}
internal void <NewGUI>b__22_0(bool value)
{
Force_Class.Value = value;
}
internal void <NewGUI>b__22_1(bool value)
{
Ignore_Blacklist.Value = value;
}
internal void <NewGUI>b__22_2(bool value)
{
Ensure_Class_Card.Value = value;
}
internal void <NewGUI>b__22_3(bool value)
{
Class_War.Value = value;
}
internal void <NewGUI>b__22_5(float value)
{
Class_Odds.Value = value;
}
internal void <NewGUI>b__22_4(bool value)
{
DEBUG.Value = value;
}
internal bool <CleanupClasses>b__25_0(Task t)
{
return t.Running;
}
internal bool <CleanupClasses>b__25_1(Task t)
{
return t.Running;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass26_0 : Object
{
public List<bool> reasign;
internal void <CleanupClassCards>b__0(CardInfo _)
{
reasign.Add(true);
}
}
private const string ModId = "root.classes.manager.reborn";
private const string ModName = "Classes Manager Reborn";
public const string Version = "1.5.5";
public const string ModInitials = "CMR";
public static ConfigEntry<bool> DEBUG;
public static ConfigEntry<bool> Force_Class;
public static ConfigEntry<bool> Ignore_Blacklist;
public static ConfigEntry<bool> Ensure_Class_Card;
public static ConfigEntry<bool> Class_War;
public static ConfigEntry<float> Class_Odds;
internal static bool firstHand = true;
internal static int cardsToDraw = 0;
internal static AssetBundle assets;
[field: CompilerGenerated]
public static ClassesManager instance
{
[CompilerGenerated]
get;
[CompilerGenerated]
private set;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal IEnumerator InstantiateModClasses()
{
for (int _ = 0; _ < 5; _++)
{
yield return null;
}
ClassCardHandler[] classCardHandlers = (ClassCardHandler[])(object)Resources.FindObjectsOfTypeAll(typeof(ClassCardHandler));
List<Task> tasks = new List<Task>();
PluginInfo[] array = Enumerable.ToArray<PluginInfo>(Enumerable.Where<PluginInfo>((IEnumerable<PluginInfo>)(object)Chainloader.PluginInfos.Values, (Func<PluginInfo, bool>)((PluginInfo pi) => Enumerable.Any<BepInDependency>(pi.Dependencies, (Func<BepInDependency, bool>)((BepInDependency d) => d.DependencyGUID == "root.classes.manager.reborn")))));
List<ClassHandler> handlers = new List<ClassHandler>();
PluginInfo[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
Type[] array3 = Enumerable.ToArray<Type>(Enumerable.Where<Type>((IEnumerable<Type>)(object)Assembly.LoadFile(array2[i].Location).GetTypes(), (Func<Type, bool>)((Type myType) => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(ClassHandler)))));
foreach (Type val in array3)
{
ClassHandler classHandler = (ClassHandler)Activator.CreateInstance(val);
handlers.Add(classHandler);
tasks.Add(new Task(classHandler.Init(), autoStart: true, val.FullName));
}
}
ClassCardHandler[] array4 = classCardHandlers;
foreach (ClassCardHandler classCardHandler in array4)
{
tasks.Add(new Task(classCardHandler.Regester(), autoStart: true, String.Concat(classCardHandler.className, " : ", ((Component)classCardHandler).GetComponent<CardInfo>().cardName)));
}
int counter = 0;
while (Enumerable.Any<Task>((IEnumerable<Task>)(object)tasks, (Func<Task, bool>)((Task t) => t.Running)))
{
int i = counter + 1;
counter = i;
if (i == 20)
{
IEnumerator<Task> enumerator = Enumerable.Where<Task>((IEnumerable<Task>)(object)tasks, (Func<Task, bool>)((Task t) => t.Running)).GetEnumerator();
try
{
while (((IEnumerator)enumerator).MoveNext())
{
Task current = enumerator.Current;
Debug.LogWarning((object)String.Concat("ClassHanlder ", current.Name, " Init function is taking a long time to finish, this could be a bug."));
}
}
finally
{
if (enumerator != null)
{
((IDisposable)enumerator).Dispose();
}
}
}
if (counter == 200)
{
IEnumerator<Task> enumerator = Enumerable.Where<Task>((IEnumerable<Task>)(object)tasks, (Func<Task, bool>)((Task t) => t.Running)).GetEnumerator();
try
{
while (((IEnumerator)enumerator).MoveNext())
{
Task current2 = enumerator.Current;
current2.Stop();
Debug.LogError((object)String.Concat("ClassHanlder ", current2.Name, " Init function has Faild, Skipping. This will cause unintended game play behavoir."));
}
}
finally
{
if (enumerator != null)
{
((IDisposable)enumerator).Dispose();
}
}
}
yield return null;
}
tasks.Clear();
Enumerator<ClassHandler> enumerator2 = handlers.GetEnumerator();
try
{
while (enumerator2.MoveNext())
{
ClassHandler current3 = enumerator2.Current;
tasks.Add(new Task(current3.PostInit(), autoStart: true, ((Object)current3).GetType().FullName));
}
}
finally
{
((IDisposable)enumerator2).Dispose();
}
array4 = classCardHandlers;
foreach (ClassCardHandler classCardHandler2 in array4)
{
tasks.Add(new Task(classCardHandler2.PostRegester(), autoStart: true, String.Concat(classCardHandler2.className, " : ", ((Component)classCardHandler2).GetComponent<CardInfo>().cardName)));
}
counter = 0;
while (Enumerable.Any<Task>((IEnumerable<Task>)(object)tasks, (Func<Task, bool>)((Task t) => t.Running)))
{
int i = counter + 1;
counter = i;
if (i == 20)
{
IEnumerator<Task> enumerator = Enumerable.Where<Task>((IEnumerable<Task>)(object)tasks, (Func<Task, bool>)((Task t) => t.Running)).GetEnumerator();
try
{
while (((IEnumerator)enumerator).MoveNext())
{
Task current4 = enumerator.Current;
Debug.LogWarning((object)String.Concat("ClassHanlder ", current4.Name, " PostInit function is taking a long time to finish, this could be a bug."));
}
}
finally
{
if (enumerator != null)
{
((IDisposable)enumerator).Dispose();
}
}
}
if (counter == 200)
{
IEnumerator<Task> enumerator = Enumerable.Where<Task>((IEnumerable<Task>)(object)tasks, (Func<Task, bool>)((Task t) => t.Running)).GetEnumerator();
try
{
while (((IEnumerator)enumerator).MoveNext())
{
Task current5 = enumerator.Current;
current5.Stop();
Debug.LogError((object)String.Concat("ClassHanlder ", current5.Name, " PostInit function has Faild, Skipping. This will cause unintended game play behavoir."));
}
}
finally
{
if (enumerator != null)
{
((IDisposable)enumerator).Dispose();
}
}
}
yield return null;
}
Debug("Class Setup Complete", important: true);
}
private void Awake()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
DEBUG = ((BaseUnityPlugin)this).Config.Bind<bool>("root.classes.manager.reborn", "Debug", false, "Enable to turn on concole spam from our mod");
new Harmony("root.classes.manager.reborn").PatchAll();
Force_Class = ((BaseUnityPlugin)this).Config.Bind<bool>("root.classes.manager.reborn", "Force_Class", false, "Enable Force Classes");
Ignore_Blacklist = ((BaseUnityPlugin)this).Config.Bind<bool>("root.classes.manager.reborn", "Ignore_Blacklist", false, "Allow more then one class per player");
Ensure_Class_Card = ((BaseUnityPlugin)this).Config.Bind<bool>("root.classes.manager.reborn", "Ensure_Class_Card", false, "Guarantee players in a class will draw a card for that class if able");
Class_War = ((BaseUnityPlugin)this).Config.Bind<bool>("root.classes.manager.reborn", "Class_War", false, "Prevent players from having the same class");
Class_Odds = ((BaseUnityPlugin)this).Config.Bind<float>("root.classes.manager.reborn", "Class_Odds", 1f, "Incresses the chances of a class restricted card to show up (Intended for large packs)");
}
private void Start()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_005e: 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_0069: Expected O, but got Unknown
instance = this;
assets = AssetUtils.LoadAssetBundleFromResources("cmr", typeof(ClassesManager).Assembly);
Unbound.RegisterHandshake("root.classes.manager.reborn", new Action(OnHandShakeCompleted));
assets.LoadAllAssets();
object obj = <>c.<>9__19_0;
if (obj == null)
{
UnityAction val = delegate
{
};
<>c.<>9__19_0 = val;
obj = (object)val;
}
Unbound.RegisterMenu("Classes Manager Reborn", (UnityAction)obj, (Action<GameObject>)NewGUI, (GameObject)null, false);
((MonoBehaviour)instance).StartCoroutine(InstantiateModClasses());
GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)OnGameStart);
GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)CleanupClasses);
GameModeManager.AddHook("PickEnd", (Func<IGameModeHandler, IEnumerator>)CleanupClasses);
GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)AjustRarities.gameStart);
((CustomCard)assets.LoadAsset<GameObject>("JACK").GetComponent<JACK>()).BuildUnityCard((Action<CardInfo>)delegate(CardInfo card)
{
JACK.card = card;
});
((CustomCard)assets.LoadAsset<GameObject>("MasteringTrade").GetComponent<MasteringTrade>()).BuildUnityCard((Action<CardInfo>)delegate(CardInfo card)
{
MasteringTrade.card = card;
});
}
private void OnHandShakeCompleted()
{
if (PhotonNetwork.IsMasterClient)
{
NetworkingManager.RPC_Others(typeof(ClassesManager), "SyncSettings", (object[])(object)new Object[5]
{
(object)Force_Class.Value,
(object)Ignore_Blacklist.Value,
(object)Ensure_Class_Card.Value,
(object)Class_War.Value,
(object)Class_Odds.Value
});
}
}
[UnboundRPC]
private static void SyncSettings(bool host_Force_Class, bool host_Ignore_Blacklist, bool host_Ensure_Class_Card, bool host_Class_War, float host_Double_Odds)
{
Force_Class.Value = host_Force_Class;
Ignore_Blacklist.Value = host_Ignore_Blacklist;
Ensure_Class_Card.Value = host_Ensure_Class_Card;
Class_War.Value = host_Class_War;
Class_Odds.Value = host_Double_Odds;
}
private void NewGUI(GameObject menu)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
TextMeshProUGUI val = default(TextMeshProUGUI);
MenuHandler.CreateText("Classes Manager Reborn", menu, ref val, 60, false, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
MenuHandler.CreateToggle(Force_Class.Value, "Enable Force Classes", menu, (UnityAction<bool>)delegate(bool value)
{
Force_Class.Value = value;
}, 60, true, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
MenuHandler.CreateToggle(Ignore_Blacklist.Value, "Allow more then one class and subclass per player", menu, (UnityAction<bool>)delegate(bool value)
{
Ignore_Blacklist.Value = value;
}, 60, true, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
MenuHandler.CreateToggle(Ensure_Class_Card.Value, "Guarantee players in a class will draw a card for that class if able", menu, (UnityAction<bool>)delegate(bool value)
{
Ensure_Class_Card.Value = value;
}, 60, true, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
MenuHandler.CreateToggle(Class_War.Value, "Prevent players from having the same class", menu, (UnityAction<bool>)delegate(bool value)
{
Class_War.Value = value;
}, 60, true, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
Slider val2 = default(Slider);
MenuHandler.CreateSlider("Increase the chances of a class restricted card to show up (Intended for large packs)", menu, 30, 1f, 100f, Class_Odds.Value, (UnityAction<float>)delegate(float value)
{
Class_Odds.Value = value;
}, ref val2, false, default(Nullable<Color>), (Direction)0, true, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
MenuHandler.CreateText("", menu, ref val, 60, true, default(Nullable<Color>), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
MenuHandler.CreateToggle(DEBUG.Value, "Debug Mode", menu, (UnityAction<bool>)delegate(bool value)
{
DEBUG.Value = value;
}, 50, false, new Nullable<Color>(Color.red), (TMP_FontAsset)null, (Material)null, default(Nullable<TextAlignmentOptions>));
}
public static void Debug(object message, bool important = false)
{
if (DEBUG.Value || important)
{
Debug.Log((object)String.Format("{0}=>{1}", (object)"CMR", message));
}
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public static IEnumerator OnGameStart(IGameModeHandler gm)
{
MasteringTrade.masteringPlayers = new List<Player>();
firstHand = true;
cardsToDraw = 0;
yield break;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public static IEnumerator CleanupClasses(IGameModeHandler gm)
{
firstHand = false;
List<Task> tasks = new List<Task>();
Enumerator<Player> enumerator;
if (MasteringTrade.masteringPlayers.Count > 0)
{
enumerator = MasteringTrade.masteringPlayers.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Player current = enumerator.Current;
tasks.Add(new Task(MasteringTrade.IAddClassCards(current)));
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
MasteringTrade.masteringPlayers.Clear();
}
while (Enumerable.Any<Task>((IEnumerable<Task>)(object)tasks, (Func<Task, bool>)((Task t) => t.Running)))
{
yield return null;
}
tasks.Clear();
enumerator = PlayerManager.instance.players.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Player current2 = enumerator.Current;
tasks.Add(new Task(CleanupClassCards(current2)));
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
while (Enumerable.Any<Task>((IEnumerable<Task>)(object)tasks, (Func<Task, bool>)((Task t) => t.Running)))
{
yield return null;
}
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal static IEnumerator CleanupClassCards(Player player)
{
<>c__DisplayClass26_0 CS$<>8__locals0 = new <>c__DisplayClass26_0();
List<CardInfo> cards = Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards);
CS$<>8__locals0.reasign = new List<bool>();
cards.ForEach((Action<CardInfo>)delegate
{
CS$<>8__locals0.reasign.Add(true);
});
bool flag = false;
for (int i = 0; i < cards.Count; i++)
{
if (ClassesRegistry.Registry.ContainsKey(cards[i]) && (ClassesRegistry.Registry[cards[i]].type & CardType.NonClassCard) == 0)
{
CardInfo missingClass = ClassesRegistry.Registry[cards[i]].GetMissingClass(cards);
if ((Object)(object)missingClass != (Object)null)
{
cards[i] = missingClass;
flag = true;
i = 0;
CS$<>8__locals0.reasign[i] = false;
}
}
}
if (flag)
{
Cards.instance.RemoveAllCardsFromPlayer(player, true);
yield return null;
yield return null;
yield return null;
Cards.instance.AddCardsToPlayer(player, cards.ToArray(), CS$<>8__locals0.reasign.ToArray(), (string[])null, (float[])null, (float[])null, true);
}
}
}
public static class ClassesRegistry : Object
{
[CompilerGenerated]
private sealed class <>c__DisplayClass10_0 : Object
{
public CardType type;
public CardType excluded;
public bool includeNonClass;
internal bool <GetClassInfos>b__0(ClassObject v)
{
if ((type & v.type) != 0 && (excluded & v.type) == 0)
{
return ((v.type & CardType.NonClassCard) == 0) | includeNonClass;
}
return false;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass7_0 : Object
{
public CardType type;
public bool includeNonClass;
internal bool <GetClassObjects>b__0(ClassObject v)
{
if ((type & v.type) != 0)
{
return ((v.type & CardType.NonClassCard) == 0) | includeNonClass;
}
return false;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass8_0 : Object
{
public CardType type;
public CardType excluded;
public bool includeNonClass;
internal bool <GetClassObjects>b__0(ClassObject v)
{
if ((type & v.type) != 0 && (excluded & v.type) == 0)
{
return ((v.type & CardType.NonClassCard) == 0) | includeNonClass;
}
return false;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass9_0 : Object
{
public CardType type;
public bool includeNonClass;
internal bool <GetClassInfos>b__0(ClassObject v)
{
if ((type & v.type) != 0)
{
return ((v.type & CardType.NonClassCard) == 0) | includeNonClass;
}
return false;
}
}
internal static Dictionary<CardInfo, ClassObject> Registry = new Dictionary<CardInfo, ClassObject>();
internal static List<CardInfo> ClassInfos = new List<CardInfo>();
public static ClassObject Register(CardInfo card, CardType type, int CardLimit = 0)
{
return Register(card, type, (CardInfo[])(object)new CardInfo[0], CardLimit);
}
public static ClassObject Register(CardInfo card, CardType type, CardInfo RequiredClass, int CardLimit = 0)
{
return Register(card, type, (CardInfo[])(object)new CardInfo[1] { RequiredClass }, CardLimit);
}
public static ClassObject Register(CardInfo card, CardType type, CardInfo[] RequiredClassTree, int CardLimit = 0)
{
return Register(card, type, new CardInfo[1][] { RequiredClassTree }, CardLimit);
}
public static ClassObject Register(CardInfo card, CardType type, CardInfo[][] RequiredClassesTree, int CardLimit = 0)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (Registry.ContainsKey(card))
{
throw new ArgumentException(String.Concat("Card ", card.cardName, " has already been Registered"));
}
ClassObject classObject = new ClassObject(card, type, RequiredClassesTree, (!card.allowMultiple) ? 1 : CardLimit);
Registry.Add(card, classObject);
if (type == CardType.Entry)
{
ClassInfos.Add(card);
}
if (card.allowMultiple)
{
classObject.Whitelist(card);
}
return classObject;
}
public static ClassObject Get(CardInfo card)
{
if ((Object)(object)card == (Object)null)
{
return null;
}
if (Registry.ContainsKey(card))
{
return Registry[card];
}
return null;
}
public static List<ClassObject> GetClassObjects(CardType type, bool includeNonClass = false)
{
<>c__DisplayClass7_0 CS$<>8__locals0 = new <>c__DisplayClass7_0();
CS$<>8__locals0.type = type;
CS$<>8__locals0.includeNonClass = includeNonClass;
return Enumerable.ToList<ClassObject>(Enumerable.Where<ClassObject>((IEnumerable<ClassObject>)(object)Registry.Values, (Func<ClassObject, bool>)((ClassObject v) => (CS$<>8__locals0.type & v.type) != 0 && (((v.type & CardType.NonClassCard) == 0) | CS$<>8__locals0.includeNonClass))));
}
public static List<ClassObject> GetClassObjects(CardType type, CardType excluded, bool includeNonClass = false)
{
<>c__DisplayClass8_0 CS$<>8__locals0 = new <>c__DisplayClass8_0();
CS$<>8__locals0.type = type;
CS$<>8__locals0.excluded = excluded;
CS$<>8__locals0.includeNonClass = includeNonClass;
return Enumerable.ToList<ClassObject>(Enumerable.Where<ClassObject>((IEnumerable<ClassObject>)(object)Registry.Values, (Func<ClassObject, bool>)((ClassObject v) => (CS$<>8__locals0.type & v.type) != 0 && (CS$<>8__locals0.excluded & v.type) == 0 && (((v.type & CardType.NonClassCard) == 0) | CS$<>8__locals0.includeNonClass))));
}
public static List<CardInfo> GetClassInfos(CardType type, bool includeNonClass = false)
{
<>c__DisplayClass9_0 CS$<>8__locals0 = new <>c__DisplayClass9_0();
CS$<>8__locals0.type = type;
CS$<>8__locals0.includeNonClass = includeNonClass;
return Enumerable.ToList<CardInfo>(Enumerable.Select<ClassObject, CardInfo>(Enumerable.Where<ClassObject>((IEnumerable<ClassObject>)(object)Registry.Values, (Func<ClassObject, bool>)((ClassObject v) => (CS$<>8__locals0.type & v.type) != 0 && (((v.type & CardType.NonClassCard) == 0) | CS$<>8__locals0.includeNonClass))), (Func<ClassObject, CardInfo>)((ClassObject v) => v.card)));
}
public static List<CardInfo> GetClassInfos(CardType type, CardType excluded, bool includeNonClass = false)
{
<>c__DisplayClass10_0 CS$<>8__locals0 = new <>c__DisplayClass10_0();
CS$<>8__locals0.type = type;
CS$<>8__locals0.excluded = excluded;
CS$<>8__locals0.includeNonClass = includeNonClass;
return Enumerable.ToList<CardInfo>(Enumerable.Select<ClassObject, CardInfo>(Enumerable.Where<ClassObject>((IEnumerable<ClassObject>)(object)Registry.Values, (Func<ClassObject, bool>)((ClassObject v) => (CS$<>8__locals0.type & v.type) != 0 && (CS$<>8__locals0.excluded & v.type) == 0 && (((v.type & CardType.NonClassCard) == 0) | CS$<>8__locals0.includeNonClass))), (Func<ClassObject, CardInfo>)((ClassObject v) => v.card)));
}
}
[Flags]
public enum CardType : Enum
{
Entry = 1,
SubClass = 2,
Branch = 4,
Gate = 8,
Card = 0x10,
NonClassCard = 0x20
}
public abstract class ClassHandler : Object
{
public abstract IEnumerator Init();
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public virtual IEnumerator PostInit()
{
yield break;
}
}
public class ClassObject : Object
{
public CardInfo card;
public CardInfo[][] RequiredClassesTree;
public int cap;
private List<CardInfo> blackList = new List<CardInfo>();
private bool whitelistAll;
private List<CardInfo> whiteList = new List<CardInfo>();
[field: CompilerGenerated]
public CardType type
{
[CompilerGenerated]
get;
[CompilerGenerated]
internal set;
}
public List<CardInfo> WhiteList
{
get
{
if (((CardType.Entry | CardType.SubClass) & type) == 0)
{
return null;
}
if (whitelistAll)
{
return ClassesRegistry.GetClassInfos(type);
}
return whiteList;
}
}
public List<CardInfo> BlackList => Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)blackList);
public ClassObject(CardInfo card, CardType type, CardInfo[][] requiredClassesTree, int cap = 0)
{
this.card = card;
this.type = type;
this.cap = cap;
RequiredClassesTree = requiredClassesTree;
}
public ClassObject WhitelistAll(bool value = true)
{
whitelistAll = value;
return this;
}
public ClassObject Whitelist(CardInfo card)
{
whitelistAll = false;
if (!whiteList.Contains(card))
{
whiteList.Add(card);
}
return this;
}
public ClassObject DeWhitelist(CardInfo card)
{
whitelistAll = false;
whiteList.Remove(card);
return this;
}
public ClassObject Blacklist(CardInfo card)
{
if (!blackList.Contains(card))
{
blackList.Add(card);
}
return this;
}
public ClassObject DeBhitelist(CardInfo card)
{
blackList.Remove(card);
return this;
}
public bool PlayerIsAllowedCard(Player player)
{
return SimulatedPlayerIsAllowedCard(player.playerID, player.data.currentCards);
}
public bool SimulatedPlayerIsAllowedCard(int playerID, List<CardInfo> currentCards)
{
//IL_0071: 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)
if (cap > 0 && currentCards.FindAll((Predicate<CardInfo>)([CompilerGenerated] (CardInfo c) => (Object)(object)c == (Object)(object)card)).Count >= cap)
{
return false;
}
if ((type & CardType.NonClassCard) == 0)
{
if (currentCards.Contains(JACK.card) && (type & CardType.Entry) == 0)
{
return false;
}
if (ClassesManager.Class_War.Value && (type & CardType.Entry) != 0)
{
Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Player current = enumerator.Current;
if (current.playerID != playerID && current.data.currentCards.Contains(card))
{
return false;
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
}
if (!ClassesManager.Ignore_Blacklist.Value && !whitelistAll && ((CardType.Entry | CardType.SubClass) & type) != 0)
{
if (Enumerable.Any<CardInfo>((IEnumerable<CardInfo>)(object)whiteList))
{
if (Enumerable.Any<CardInfo>(Enumerable.Intersect<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)currentCards, (Func<CardInfo, bool>)([CompilerGenerated] (CardInfo c) => !whiteList.Contains(c))), (IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos(type))))
{
return false;
}
}
else if (Enumerable.Any<CardInfo>(Enumerable.Intersect<CardInfo>((IEnumerable<CardInfo>)(object)currentCards, (IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos(type))))
{
return false;
}
}
}
if (Enumerable.Any<CardInfo>((IEnumerable<CardInfo>)(object)blackList) && Enumerable.Any<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)currentCards, (Func<CardInfo, bool>)([CompilerGenerated] (CardInfo c) => blackList.Contains(c)))))
{
return false;
}
if ((type & CardType.Entry) != 0)
{
return true;
}
CardInfo[][] requiredClassesTree = RequiredClassesTree;
foreach (CardInfo[] obj in requiredClassesTree)
{
bool flag = true;
List<CardInfo> val = Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)currentCards);
CardInfo[] array = obj;
foreach (CardInfo val2 in array)
{
if (val.Contains(val2))
{
val.Remove(val2);
continue;
}
flag = false;
break;
}
if (flag)
{
return true;
}
}
return false;
}
internal CardInfo GetMissingClass(Player player)
{
return GetMissingClass(Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards));
}
internal CardInfo GetMissingClass(List<CardInfo> cards)
{
List<CardInfo> val = new List<CardInfo>();
bool flag = true;
CardInfo[][] requiredClassesTree = RequiredClassesTree;
foreach (CardInfo[] obj in requiredClassesTree)
{
List<CardInfo> val2 = new List<CardInfo>();
List<CardInfo> val3 = Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)cards);
CardInfo[] array = obj;
foreach (CardInfo val4 in array)
{
if (val3.Contains(val4))
{
val3.Remove(val4);
}
else
{
val2.Add(val4);
}
}
if (flag || val.Count > val2.Count)
{
flag = false;
val = Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)val2);
}
}
if (!Enumerable.Any<CardInfo>((IEnumerable<CardInfo>)(object)val))
{
return null;
}
return val[0];
}
public static CardInfo[][] TecTreeHelper(CardInfo[] cards, int required_count)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
List<CardInfo[]> val = new List<CardInfo[]>();
List<int> val2 = new List<int>();
for (int i = 0; i < required_count; i++)
{
val2.Add(0);
}
while (val2[0] < cards.Length)
{
List<CardInfo> val3 = new List<CardInfo>();
Enumerator<int> enumerator = val2.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
int current = enumerator.Current;
val3.Add(cards[current]);
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
val.Add(val3.ToArray());
List<int> val4 = val2;
int num = val2.Count - 1;
int num2 = val4[num];
val4[num] = num2 + 1;
for (int num3 = val2.Count - 1; num3 <= 0; num3--)
{
if (val2[num3] == cards.Length && num3 != 0)
{
val2[num3] = 0;
num2 = num3 - 1;
num = val2[num2];
val2[num2] = num + 1;
}
}
}
return val.ToArray();
}
}
[BepInPlugin("fluxxfield.rounds.plugins.classesmanager", "Classes Manager", "999.999.999")]
[BepInProcess("Rounds.exe")]
internal class DisableOldManager : BaseUnityPlugin
{
}
[BepInPlugin("fluxxfield.rounds.plugins.fluxxfieldscards", "FluxxField's Cards (FFC)", "999.999.999")]
[BepInProcess("Rounds.exe")]
internal class DisableOldFFC : BaseUnityPlugin
{
}
public class ClassCardHandler : MonoBehaviour
{
[Serializable]
public enum RequirementsType : Enum
{
None,
Single,
List,
MultiList
}
[SerializeField]
public string className;
[EnumToggleButtons]
[ShowInInspector]
[SerializeField]
public CardType cardType = CardType.Card;
public int maxAllowed;
[EnumToggleButtons]
[ShowInInspector]
public RequirementsType requirementType = RequirementsType.Single;
[AssetsOnly]
[ShowIf("requirementType", RequirementsType.Single, true)]
public CardInfo singleReq;
[AssetsOnly]
[ShowIf("requirementType", RequirementsType.List, true)]
public CardInfo[] listReq;
[AssetsOnly]
[ShowIf("requirementType", RequirementsType.MultiList, true)]
public CardInfo[] multilistReq;
[ShowIf("requirementType", RequirementsType.MultiList, true)]
public int multilistCount;
public CardInfo[] whiteList;
public CardInfo[] blackList;
[HideInInspector]
public ClassObject classObject;
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal IEnumerator Regester()
{
switch (requirementType)
{
case RequirementsType.None:
classObject = ClassesRegistry.Register(((Component)this).GetComponent<CardInfo>(), cardType, maxAllowed);
break;
case RequirementsType.Single:
classObject = ClassesRegistry.Register(((Component)this).GetComponent<CardInfo>(), cardType, singleReq, maxAllowed);
break;
case RequirementsType.List:
classObject = ClassesRegistry.Register(((Component)this).GetComponent<CardInfo>(), cardType, listReq, maxAllowed);
break;
case RequirementsType.MultiList:
{
CardInfo[][] requiredClassesTree = ClassObject.TecTreeHelper(multilistReq, multilistCount);
classObject = ClassesRegistry.Register(((Component)this).GetComponent<CardInfo>(), cardType, requiredClassesTree, maxAllowed);
break;
}
}
yield break;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal IEnumerator PostRegester()
{
CardInfo[] array = whiteList;
foreach (CardInfo card in array)
{
classObject.Whitelist(card);
}
array = blackList;
foreach (CardInfo card2 in array)
{
classObject.Blacklist(card2);
}
yield break;
}
}
}
namespace ClassesManagerReborn.Util
{
public class DestroyOnUnParent : MonoBehaviour
{
private void LateUpdate()
{
if ((Object)(object)((Component)this).gameObject.transform.parent == (Object)null)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
public class ClassNameMono : MonoBehaviour
{
public string className = "Class";
public Color ClassDefult = new Color(0.20784314f, 0.76862746f, 2f / 51f, 1f);
public Color SubClassDefult = new Color(0.7f, 0.33f, 0.05f, 1f);
public Color color1 = Color.black;
public Color color2 = Color.black;
internal bool isOn;
internal bool lastOn;
private CardInfo card;
private void Start()
{
//IL_0070: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
try
{
card = ((Component)this).gameObject.GetComponent<CardInfo>();
GameObject gameObject = ((Component)Enumerable.FirstOrDefault<RectTransform>(Enumerable.Where<RectTransform>((IEnumerable<RectTransform>)(object)((Component)this).gameObject.GetComponentsInChildren<RectTransform>(), (Func<RectTransform, bool>)((RectTransform obj) => ((Object)((Component)obj).gameObject).name == "EdgePart (1)")))).gameObject;
GameObject obj2 = Object.Instantiate<GameObject>(new GameObject("ExtraCardText", (Type[])(object)new Type[2]
{
typeof(TextMeshProUGUI),
typeof(DestroyOnUnParent)
}), gameObject.transform.position, gameObject.transform.rotation, gameObject.transform);
TextMeshProUGUI component = obj2.gameObject.GetComponent<TextMeshProUGUI>();
((TMP_Text)component).text = className;
((TMP_Text)component).enableWordWrapping = false;
((TMP_Text)component).alignment = (TextAlignmentOptions)1026;
((TMP_Text)component).alpha = 0.1f;
((TMP_Text)component).fontSize = 50f;
obj2.transform.Rotate(0f, 0f, 135f);
obj2.transform.localScale = new Vector3(1f, 1f, 1f);
obj2.transform.localPosition = new Vector3(-50f, -50f, 0f);
lastOn = !isOn;
}
catch (Object)
{
}
}
private void Update()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_0060: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
if (lastOn == isOn)
{
return;
}
try
{
if (ClassesRegistry.Get(card.sourceCard) != null && (ClassesRegistry.Get(card.sourceCard).type & CardType.NonClassCard) == 0)
{
if ((ClassesRegistry.Get(card.sourceCard).type & CardType.Entry) != 0)
{
color1 = (color2 = ClassDefult);
}
if ((ClassesRegistry.Get(card.sourceCard).type & CardType.SubClass) != 0)
{
color1 = (color2 = SubClassDefult);
}
}
List<GameObject> val = FindObjectsInChildren(((Component)this).gameObject, "Triangle");
bool flag = true;
int num = 1;
for (int i = 0; i < val.Count; i++)
{
if (++num > 2)
{
flag = !flag;
num = 1;
}
if (flag && color1 != Color.black)
{
for (int j = 4; j <= 6; j++)
{
((Graphic)((Component)val[i].transform.Find(String.Format("FRAME ({0})", (object)j))).GetComponent<Image>()).color = (Color)(isOn ? color1 : new Color(color1.r, color1.g, color1.b, color1.a / 6f));
}
}
if (!flag && color2 != Color.black)
{
for (int k = 4; k <= 6; k++)
{
((Graphic)((Component)val[i].transform.Find(String.Format("FRAME ({0})", (object)k))).GetComponent<Image>()).color = (Color)(isOn ? color2 : new Color(color2.r, color2.g, color2.b, color2.a / 6f));
}
}
}
lastOn = isOn;
}
catch (Object)
{
((Behaviour)this).enabled = false;
}
}
public static List<GameObject> FindObjectsInChildren(GameObject gameObject, string gameObjectName)
{
List<GameObject> val = new List<GameObject>();
Transform[] componentsInChildren = gameObject.GetComponentsInChildren<Transform>(true);
foreach (Transform val2 in componentsInChildren)
{
if (((Object)((Component)val2).gameObject).name.Equals(gameObjectName))
{
val.Add(((Component)val2).gameObject);
}
}
return val;
}
}
[Obsolete("This object is no longer needed do to the advent of RarityLib and will be removed soon", false)]
public class Legend : MonoBehaviour
{
public static Color color = new Color(1f, 1f, 0f, 1f);
}
public class Task : Object
{
public delegate void FinishedHandler(bool manual);
public string Name;
[CompilerGenerated]
private FinishedHandler m_Finished;
private TaskManager.TaskState task;
public bool Running => task.Running;
public bool Paused => task.Paused;
public event FinishedHandler Finished
{
[CompilerGenerated]
add
{
FinishedHandler finishedHandler = this.m_Finished;
FinishedHandler finishedHandler2;
do
{
finishedHandler2 = finishedHandler;
FinishedHandler finishedHandler3 = (FinishedHandler)(object)Delegate.Combine((Delegate)(object)finishedHandler2, (Delegate)(object)value);
finishedHandler = Interlocked.CompareExchange<FinishedHandler>(ref this.m_Finished, finishedHandler3, finishedHandler2);
}
while (finishedHandler != finishedHandler2);
}
[CompilerGenerated]
remove
{
FinishedHandler finishedHandler = this.m_Finished;
FinishedHandler finishedHandler2;
do
{
finishedHandler2 = finishedHandler;
FinishedHandler finishedHandler3 = (FinishedHandler)(object)Delegate.Remove((Delegate)(object)finishedHandler2, (Delegate)(object)value);
finishedHandler = Interlocked.CompareExchange<FinishedHandler>(ref this.m_Finished, finishedHandler3, finishedHandler2);
}
while (finishedHandler != finishedHandler2);
}
}
public Task(IEnumerator c, bool autoStart = true, string name = "")
{
Name = name;
task = TaskManager.CreateTask(c);
task.Finished += TaskFinished;
if (autoStart)
{
Start();
}
}
public void Start()
{
task.Start();
}
public void Stop()
{
task.Stop();
}
public void Pause()
{
task.Pause();
}
public void Unpause()
{
task.Unpause();
}
private void TaskFinished(bool manual)
{
this.Finished?.Invoke(manual);
}
}
internal class TaskManager : MonoBehaviour
{
public class TaskState : Object
{
public delegate void FinishedHandler(bool manual);
[CompilerGenerated]
private FinishedHandler m_Finished;
private IEnumerator coroutine;
private bool running;
private bool paused;
private bool stopped;
public bool Running => running;
public bool Paused => paused;
public event FinishedHandler Finished
{
[CompilerGenerated]
add
{
FinishedHandler finishedHandler = this.m_Finished;
FinishedHandler finishedHandler2;
do
{
finishedHandler2 = finishedHandler;
FinishedHandler finishedHandler3 = (FinishedHandler)(object)Delegate.Combine((Delegate)(object)finishedHandler2, (Delegate)(object)value);
finishedHandler = Interlocked.CompareExchange<FinishedHandler>(ref this.m_Finished, finishedHandler3, finishedHandler2);
}
while (finishedHandler != finishedHandler2);
}
[CompilerGenerated]
remove
{
FinishedHandler finishedHandler = this.m_Finished;
FinishedHandler finishedHandler2;
do
{
finishedHandler2 = finishedHandler;
FinishedHandler finishedHandler3 = (FinishedHandler)(object)Delegate.Remove((Delegate)(object)finishedHandler2, (Delegate)(object)value);
finishedHandler = Interlocked.CompareExchange<FinishedHandler>(ref this.m_Finished, finishedHandler3, finishedHandler2);
}
while (finishedHandler != finishedHandler2);
}
}
public TaskState(IEnumerator c)
{
coroutine = c;
}
public void Pause()
{
paused = true;
}
public void Unpause()
{
paused = false;
}
public void Start()
{
running = true;
((MonoBehaviour)singleton).StartCoroutine(CallWrapper());
}
public void Stop()
{
stopped = true;
running = false;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
private IEnumerator CallWrapper()
{
yield return null;
IEnumerator e = coroutine;
while (running)
{
if (paused)
{
yield return null;
continue;
}
try
{
if (e == null || !e.MoveNext())
{
running = false;
}
}
catch (Exception val)
{
running = false;
ClassesManager.Debug((object)val, important: true);
}
if (running)
{
yield return e.Current;
}
}
this.Finished?.Invoke(stopped);
}
}
private static TaskManager singleton;
public static TaskState CreateTask(IEnumerator coroutine)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)singleton == (Object)null)
{
singleton = new GameObject("TaskManager").AddComponent<TaskManager>();
}
return new TaskState(coroutine);
}
}
}
namespace ClassesManagerReborn.Patches
{
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class CardRarityColorPatchToggle : Object
{
private static void Prefix(bool isOn, CardRarityColor __instance)
{
ClassNameMono componentInParent = ((Component)__instance).GetComponentInParent<ClassNameMono>();
if ((Object)(object)componentInParent != (Object)null)
{
componentInParent.isOn = isOn;
}
}
}
}
namespace ClassesManagerReborn.Patchs
{
internal class AjustRarities : Object
{
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal static IEnumerator gameStart(IGameModeHandler gm)
{
ClassesRegistry.GetClassInfos(~CardType.Entry).ForEach((Action<CardInfo>)delegate(CardInfo CI)
{
RarityUtils.AjustCardRarityModifier(CI, 0f, ClassesManager.Class_Odds.Value);
});
yield break;
}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class CardSpawn : Object
{
[CompilerGenerated]
private sealed class <>c__DisplayClass2_0 : Object
{
public int ___pickrID;
public Player player;
internal bool <Prefix>b__0(Player p)
{
return p.playerID == ___pickrID;
}
internal bool <Prefix>b__2(CardInfo card)
{
return Cards.instance.PlayerIsAllowedCard(player, card);
}
}
internal static CardInfo sourceCard;
internal static int targetCard;
private static void Prefix(CardChoice __instance, ref GameObject objToSpawn, int ___pickrID, List<GameObject> ___spawnedCards, Transform[] ___children, ref GameObject __result, Vector3 pos, Quaternion rot)
{
<>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0();
CS$<>8__locals0.___pickrID = ___pickrID;
if (!ClassesManager.Ensure_Class_Card.Value)
{
return;
}
CS$<>8__locals0.player = PlayerManager.instance.players.Find((Predicate<Player>)((Player p) => p.playerID == CS$<>8__locals0.___pickrID));
if (ClassesManager.firstHand)
{
ClassesManager.cardsToDraw++;
return;
}
if (___spawnedCards.Count == 0)
{
targetCard = Random.Range(0, ClassesManager.cardsToDraw);
}
if (___spawnedCards.Count == targetCard && !Enumerable.Any<GameObject>((IEnumerable<GameObject>)(object)___spawnedCards, (Func<GameObject, bool>)((GameObject card) => ClassesRegistry.Registry.ContainsKey(card.GetComponent<CardInfo>()))))
{
CardInfo[] array = Enumerable.ToArray<CardInfo>(Enumerable.Intersect<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos(~CardType.Entry), (Func<CardInfo, bool>)((CardInfo card) => Cards.instance.PlayerIsAllowedCard(CS$<>8__locals0.player, card))), (IEnumerable<CardInfo>)(object)Cards.active));
if (array.Length != 0)
{
ExtensionMethods.Shuffle<CardInfo>((IList<CardInfo>)(object)array);
sourceCard = array[0];
objToSpawn = ((Component)sourceCard).gameObject;
}
}
}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class SpawnUniqueCard : Object
{
private static void Postfix(ref GameObject __result)
{
if (Object.op_Implicit((Object)(object)CardSpawn.sourceCard))
{
__result.GetComponent<CardInfo>().sourceCard = CardSpawn.sourceCard;
}
CardSpawn.sourceCard = null;
}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class PlayerIsAllowedCard : Object
{
public static void Postfix(ref bool __result, Player player, CardInfo card)
{
if (__result && !((Object)(object)player == (Object)null) && !((Object)(object)card == (Object)null))
{
if (ClassesManager.Force_Class.Value && !Enumerable.Any<CardInfo>(Enumerable.Intersect<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards, (IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos(CardType.Entry))) && !ClassesRegistry.GetClassInfos(CardType.Entry).Contains(card))
{
__result = false;
}
else if (((Object)(object)card == (Object)(object)JACK.card || (Object)(object)card == (Object)(object)MasteringTrade.card) && ClassesRegistry.GetClassObjects(~CardType.Entry).Count == 0)
{
__result = false;
}
else if (ClassesRegistry.Registry.ContainsKey(card))
{
__result = ClassesRegistry.Registry[card].PlayerIsAllowedCard(player) & __result;
}
else if ((Object)(object)card == (Object)(object)JACK.card)
{
__result = !Enumerable.Any<CardInfo>(Enumerable.Intersect<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards, (IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos(CardType.Entry))) & __result;
}
else if ((Object)(object)card == (Object)(object)MasteringTrade.card)
{
__result = Enumerable.Any<CardInfo>(Enumerable.Intersect<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards, (IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos(CardType.Entry))) & __result;
}
}
}
}
}
namespace ClassesManagerReborn.Cards
{
internal class JACK : CustomCard
{
internal static CardInfo card;
public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
{
CardInfoExtension.GetAdditionalData(cardInfo).canBeReassigned = false;
}
public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
}
protected override GameObject GetCardArt()
{
return ClassesManager.assets.LoadAsset<GameObject>("C_JACK");
}
protected override string GetDescription()
{
return "Master of none";
}
protected override Rarity GetRarity()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return RarityUtils.GetRarity("Legendary");
}
protected override CardInfoStat[] GetStats()
{
return (CardInfoStat[])(object)new CardInfoStat[0];
}
protected override CardThemeColorType GetTheme()
{
return (CardThemeColorType)6;
}
protected override string GetTitle()
{
return "JACK";
}
public override string GetModName()
{
return "CMR";
}
public override void Callback()
{
ExtensionMethods.GetOrAddComponent<Rainbow>(((Component)this).gameObject, false);
((CustomCard)this).Callback();
}
}
internal class Rainbow : MonoBehaviour
{
private CardVisuals visuals;
private float timer;
private List<CardThemeColor> cardThemeColors = Enumerable.ToList<CardThemeColor>((IEnumerable<CardThemeColor>)(object)CardChoice.instance.cardThemes);
private Random random = new Random();
public void Start()
{
visuals = ((Component)this).GetComponentInChildren<CardVisuals>();
timer = 1f;
}
public void Update()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
timer += TimeHandler.deltaTime;
if (timer > 0.25f && visuals.isSelected)
{
timer = 0f;
visuals.defaultColor = cardThemeColors[random.Next(9)].targetColor;
visuals.chillColor = visuals.defaultColor;
for (int i = 0; i < visuals.images.Length; i++)
{
((Graphic)visuals.images[i]).color = cardThemeColors[random.Next(9)].targetColor;
}
((Graphic)visuals.nameText).color = visuals.defaultColor;
}
else if (!visuals.isSelected)
{
timer = 1f;
}
}
}
public class JackEffect : MonoBehaviour
{
public Player player;
private void Awake()
{
player = ((Component)this).GetComponentInParent<Player>();
GameModeManager.AddHook("PickEnd", (Func<IGameModeHandler, IEnumerator>)DoJack);
}
private void OnDestroy()
{
GameModeManager.RemoveHook("PickEnd", (Func<IGameModeHandler, IEnumerator>)DoJack);
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
private IEnumerator DoJack(IGameModeHandler _)
{
List<CardInfo> val = Enumerable.ToList<CardInfo>(Enumerable.Where<CardInfo>(Enumerable.Intersect<CardInfo>((IEnumerable<CardInfo>)(object)ClassesRegistry.GetClassInfos(CardType.Entry), (IEnumerable<CardInfo>)(object)Cards.active), (Func<CardInfo, bool>)([CompilerGenerated] (CardInfo card) => !player.data.currentCards.Contains(card))));
ExtensionMethods.Shuffle<CardInfo>((IList<CardInfo>)(object)val);
Cards.instance.AddCardToPlayer(player, val[0], false, "", 0f, 0f, true);
yield break;
}
}
internal class MasteringTrade : CustomCard
{
[CompilerGenerated]
private sealed class <>c__DisplayClass4_0 : Object
{
public Player player;
public ClassObject[] classObjects;
public CardInfo chosenClass;
public int cardCount;
public Func<CardInfo[], bool> <>9__8;
internal bool <IAddClassCards>b__0(ClassObject classObj)
{
if (Cards.instance.PlayerIsAllowedCard(player, classObj.card))
{
return Cards.active.Contains(classObj.card);
}
return false;
}
internal bool <IAddClassCards>b__2(CardInfo card)
{
<>c__DisplayClass4_1 CS$<>8__locals0 = new <>c__DisplayClass4_1
{
card = card
};
return Enumerable.Any<ClassObject>((IEnumerable<ClassObject>)(object)classObjects, (Func<ClassObject, bool>)delegate(ClassObject classObj)
{
<>c__DisplayClass4_2 CS$<>8__locals1 = new <>c__DisplayClass4_2
{
CS$<>8__locals1 = CS$<>8__locals0,
classObj = classObj
};
return Enumerable.Any<CardInfo[]>((IEnumerable<CardInfo[]>)(object)CS$<>8__locals1.classObj.RequiredClassesTree, (Func<CardInfo[], bool>)delegate(CardInfo[] list)
{
IEnumerable<string> val = Enumerable.Select<CardInfo, string>((IEnumerable<CardInfo>)(object)list, (Func<CardInfo, string>)((CardInfo item) => item.cardName));
string text = String.Join(", ", val);
Debug.Log((object)String.Concat((string[])(object)new String[5]
{
CS$<>8__locals1.CS$<>8__locals1.card.cardName,
" ?= ",
text,
" -> ",
CS$<>8__locals1.classObj.card.cardName
}));
return Enumerable.Contains<CardInfo>((IEnumerable<CardInfo>)(object)list, CS$<>8__locals1.CS$<>8__locals1.card);
});
});
}
internal bool <IAddClassCards>b__3(ClassObject classObj)
{
return Enumerable.Any<CardInfo[]>((IEnumerable<CardInfo[]>)(object)classObj.RequiredClassesTree, (Func<CardInfo[], bool>)((CardInfo[] list) => Enumerable.Contains<CardInfo>((IEnumerable<CardInfo>)(object)list, chosenClass)));
}
internal bool <IAddClassCards>b__8(CardInfo[] list)
{
return Enumerable.Contains<CardInfo>((IEnumerable<CardInfo>)(object)list, chosenClass);
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass4_1 : Object
{
public CardInfo card;
internal bool <IAddClassCards>b__5(ClassObject classObj)
{
<>c__DisplayClass4_2 CS$<>8__locals0 = new <>c__DisplayClass4_2
{
CS$<>8__locals1 = this,
classObj = classObj
};
return Enumerable.Any<CardInfo[]>((IEnumerable<CardInfo[]>)(object)CS$<>8__locals0.classObj.RequiredClassesTree, (Func<CardInfo[], bool>)delegate(CardInfo[] list)
{
IEnumerable<string> val = Enumerable.Select<CardInfo, string>((IEnumerable<CardInfo>)(object)list, (Func<CardInfo, string>)((CardInfo item) => item.cardName));
string text = String.Join(", ", val);
Debug.Log((object)String.Concat((string[])(object)new String[5]
{
CS$<>8__locals0.CS$<>8__locals1.card.cardName,
" ?= ",
text,
" -> ",
CS$<>8__locals0.classObj.card.cardName
}));
return Enumerable.Contains<CardInfo>((IEnumerable<CardInfo>)(object)list, CS$<>8__locals0.CS$<>8__locals1.card);
});
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass4_2 : Object
{
public ClassObject classObj;
public <>c__DisplayClass4_1 CS$<>8__locals1;
internal bool <IAddClassCards>b__6(CardInfo[] list)
{
IEnumerable<string> val = Enumerable.Select<CardInfo, string>((IEnumerable<CardInfo>)(object)list, (Func<CardInfo, string>)((CardInfo item) => item.cardName));
string text = String.Join(", ", val);
Debug.Log((object)String.Concat((string[])(object)new String[5]
{
CS$<>8__locals1.card.cardName,
" ?= ",
text,
" -> ",
classObj.card.cardName
}));
return Enumerable.Contains<CardInfo>((IEnumerable<CardInfo>)(object)list, CS$<>8__locals1.card);
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass4_3 : Object
{
public CardInfo card;
public float time;
public <>c__DisplayClass4_0 CS$<>8__locals2;
internal bool <IAddClassCards>b__9()
{
time += Time.deltaTime;
if (CS$<>8__locals2.player.data.currentCards.Count <= CS$<>8__locals2.cardCount && !((Object)(object)CS$<>8__locals2.player.data.currentCards[CS$<>8__locals2.player.data.currentCards.Count - 1] == (Object)(object)card))
{
return time > 5f;
}
return true;
}
}
internal static CardInfo card;
internal static List<Player> masteringPlayers = new List<Player>();
public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers)
{
CardInfoExtension.GetAdditionalData(cardInfo).canBeReassigned = false;
}
public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
masteringPlayers.Add(player);
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal static IEnumerator IAddClassCards(Player player)
{
<>c__DisplayClass4_0 CS$<>8__locals0 = new <>c__DisplayClass4_0();
CS$<>8__locals0.player = player;
CS$<>8__locals0.classObjects = Enumerable.ToArray<ClassObject>(Enumerable.Where<ClassObject>((IEnumerable<ClassObject>)(object)ClassesRegistry.GetClassObjects(~CardType.Entry), (Func<ClassObject, bool>)((ClassObject classObj) => Cards.instance.PlayerIsAllowedCard(CS$<>8__locals0.player, classObj.card) && Cards.active.Contains(classObj.card))));
ClassObject[] classObjects = CS$<>8__locals0.classObjects;
for (int j = 0; j < classObjects.Length; j++)
{
Debug.Log((object)classObjects[j].card.cardName);
}
List<CardInfo> val = Enumerable.ToList<CardInfo>(Enumerable.Distinct<CardInfo>(Enumerable.Intersect<CardInfo>(Enumerable.Select<ClassObject, CardInfo>((IEnumerable<ClassObject>)(object)ClassesRegistry.GetClassObjects(~CardType.Card), (Func<ClassObject, CardInfo>)((ClassObject obj) => obj.card)), (IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards)));
val = Enumerable.ToList<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)val, (Func<CardInfo, bool>)delegate(CardInfo card)
{
<>c__DisplayClass4_1 CS$<>8__locals2 = new <>c__DisplayClass4_1
{
card = card
};
return Enumerable.Any<ClassObject>((IEnumerable<ClassObject>)(object)CS$<>8__locals0.classObjects, (Func<ClassObject, bool>)delegate(ClassObject classObj)
{
<>c__DisplayClass4_2 CS$<>8__locals3 = new <>c__DisplayClass4_2
{
CS$<>8__locals1 = CS$<>8__locals2,
classObj = classObj
};
return Enumerable.Any<CardInfo[]>((IEnumerable<CardInfo[]>)(object)CS$<>8__locals3.classObj.RequiredClassesTree, (Func<CardInfo[], bool>)delegate(CardInfo[] list)
{
IEnumerable<string> val2 = Enumerable.Select<CardInfo, string>((IEnumerable<CardInfo>)(object)list, (Func<CardInfo, string>)((CardInfo item) => item.cardName));
string text = String.Join(", ", val2);
Debug.Log((object)String.Concat((string[])(object)new String[5]
{
CS$<>8__locals3.CS$<>8__locals1.card.cardName,
" ?= ",
text,
" -> ",
CS$<>8__locals3.classObj.card.cardName
}));
return Enumerable.Contains<CardInfo>((IEnumerable<CardInfo>)(object)list, CS$<>8__locals3.CS$<>8__locals1.card);
});
});
}));
ExtensionMethods.Shuffle<CardInfo>((IList<CardInfo>)(object)val);
Enumerator<CardInfo> enumerator = val.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Debug.Log((object)enumerator.Current.cardName);
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
CS$<>8__locals0.chosenClass = val[0];
CardInfo[] classCards = Enumerable.ToArray<CardInfo>(Enumerable.Select<ClassObject, CardInfo>(Enumerable.Where<ClassObject>((IEnumerable<ClassObject>)(object)CS$<>8__locals0.classObjects, (Func<ClassObject, bool>)((ClassObject classObj) => Enumerable.Any<CardInfo[]>((IEnumerable<CardInfo[]>)(object)classObj.RequiredClassesTree, (Func<CardInfo[], bool>)((CardInfo[] list) => Enumerable.Contains<CardInfo>((IEnumerable<CardInfo>)(object)list, CS$<>8__locals0.chosenClass))))), (Func<ClassObject, CardInfo>)((ClassObject classObj) => classObj.card)));
ExtensionMethods.Shuffle<CardInfo>((IList<CardInfo>)(object)classCards);
yield return null;
yield return null;
CS$<>8__locals0.cardCount = 0;
CardInfo[] array = classCards;
for (int k = 0; k < array.Length; k++)
{
<>c__DisplayClass4_3 CS$<>8__locals1 = new <>c__DisplayClass4_3();
CS$<>8__locals1.CS$<>8__locals2 = CS$<>8__locals0;
CS$<>8__locals1.card = array[k];
if (Cards.instance.PlayerIsAllowedCard(CS$<>8__locals1.CS$<>8__locals2.player, CS$<>8__locals1.card))
{
CS$<>8__locals1.CS$<>8__locals2.cardCount = Enumerable.Count<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals1.CS$<>8__locals2.player.data.currentCards);
Cards.instance.AddCardToPlayer(CS$<>8__locals1.CS$<>8__locals2.player, CS$<>8__locals1.card, false, "", 2f, 2f, true);
CS$<>8__locals1.time = 0f;
yield return new WaitUntil((Func<bool>)delegate
{
CS$<>8__locals1.time += Time.deltaTime;
return CS$<>8__locals1.CS$<>8__locals2.player.data.currentCards.Count > CS$<>8__locals1.CS$<>8__locals2.cardCount || (Object)(object)CS$<>8__locals1.CS$<>8__locals2.player.data.currentCards[CS$<>8__locals1.CS$<>8__locals2.player.data.currentCards.Count - 1] == (Object)(object)CS$<>8__locals1.card || CS$<>8__locals1.time > 5f;
});
int i = 0;
while (i++ < 20)
{
yield return null;
}
}
}
}
protected override GameObject GetCardArt()
{
return null;
}
protected override string GetDescription()
{
return "Get a random number of cards for a random class you have.";
}
protected override Rarity GetRarity()
{
return (Rarity)2;
}
protected override CardInfoStat[] GetStats()
{
return (CardInfoStat[])(object)new CardInfoStat[0];
}
protected override CardThemeColorType GetTheme()
{
return (CardThemeColorType)6;
}
protected override string GetTitle()
{
return "Mastering the Trade";
}
public override string GetModName()
{
return "CMR";
}
}
}