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.Bootstrap; using CardChoiceSpawnUniqueCardPatch; using CardChoiceSpawnUniqueCardPatch.CustomCategories; using GameSaver.Util; using HarmonyLib; using Jotunn.Utils; using Microsoft.CodeAnalysis; using ModdingUtils.Utils; using Photon.Pun; using PickPhaseImprovements; using RarityLib.Utils; using TMPro; using TabInfo.Utils; using UnboundLib; using UnboundLib.GameModes; using UnboundLib.Utils; using UnityEngine; using UnityEngine.EventSystems; 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 Nullmanager { [HarmonyPatch] internal class AddNullToPlayerPatch : Object { [CompilerGenerated] private sealed class <>c__DisplayClass0_0 : Object { public CardInfo card; public Player player; internal void b__0(Action c) { try { c.Invoke((NullCardInfo)(object)card, player); } catch (Object) { } } } [CompilerGenerated] private sealed class <>c__DisplayClass1_0 : Object { public NullCardInfo card; public Player playerToUpgrade; internal void b__0(Action c) { try { c.Invoke(card, playerToUpgrade); } catch (Object) { } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] public static bool Add(Player player, CardInfo card, bool reassign, string twoLetterCode, float forceDisplay, float forceDisplayDelay, bool addToCardBar) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0(); CS$<>8__locals0.card = card; CS$<>8__locals0.player = player; NullCardInfo nullCardInfo = CS$<>8__locals0.card as NullCardInfo; if (nullCardInfo != null) { if (nullCardInfo.randomCard) { nullCardInfo = NullManager.instance.GetRandomNullWithRarity(CS$<>8__locals0.player, ((CardInfo)nullCardInfo).rarity); } if (PhotonNetwork.OfflineMode) { CS$<>8__locals0.card = (CardInfo)(object)NullManager.instance.GetNullCardInfo(((Object)nullCardInfo.NulledSorce).name, CS$<>8__locals0.player); CS$<>8__locals0.player.data.currentCards.Add(CS$<>8__locals0.card); NullManager.instance.callbacks.ForEach((Action>)delegate(Action c) { try { c.Invoke((NullCardInfo)(object)CS$<>8__locals0.card, CS$<>8__locals0.player); } catch (Object) { } }); if (addToCardBar) { Cards.SilentAddToCardBar(CS$<>8__locals0.player.playerID, CS$<>8__locals0.card, twoLetterCode, forceDisplay, forceDisplayDelay); } } else if (PhotonNetwork.IsMasterClient) { if (addToCardBar) { NetworkingManager.RPC(typeof(Cards), "RPCA_AssignCard", (object[])(object)new Object[6] { (Object)String.Concat("___NULL___", ((Object)nullCardInfo.NulledSorce).name), (object)CS$<>8__locals0.player.playerID, (object)reassign, (Object)twoLetterCode, (object)forceDisplay, (object)forceDisplayDelay }); } else { NetworkingManager.RPC(typeof(Cards), "RPCA_AssignCardWithoutCardBar", (object[])(object)new Object[6] { (Object)String.Concat("___NULL___", ((Object)nullCardInfo.NulledSorce).name), (object)CS$<>8__locals0.player.playerID, (object)reassign, (Object)twoLetterCode, (object)forceDisplay, (object)forceDisplayDelay }); } } return false; } return true; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] public static bool RPC(string cardObjectName, int playerID, bool reassign, string twoLetterCode, float forceDisplay, float forceDisplayDelay, bool addToCardBar) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown if (cardObjectName.StartsWith("___NULL___")) { <>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0(); CS$<>8__locals0.playerToUpgrade = (Player)ExtensionMethods.InvokeMethod((object)PlayerManager.instance, "GetPlayerWithID", (object[])(object)new Object[1] { (object)playerID }); CS$<>8__locals0.card = NullManager.instance.GetNullCardInfo(cardObjectName.Substring(10), CS$<>8__locals0.playerToUpgrade); CS$<>8__locals0.playerToUpgrade.data.currentCards.Add((CardInfo)(object)CS$<>8__locals0.card); NullManager.instance.callbacks.ForEach((Action>)delegate(Action c) { try { c.Invoke(CS$<>8__locals0.card, CS$<>8__locals0.playerToUpgrade); } catch (Object) { } }); if (addToCardBar) { Cards.SilentAddToCardBar(CS$<>8__locals0.playerToUpgrade.playerID, (CardInfo)(object)CS$<>8__locals0.card, twoLetterCode, forceDisplay, forceDisplayDelay); } return false; } return true; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] public static void GetCardInfoWithName(string cardName, ref CardInfo __result) { if ((Object)(object)__result == (Object)null && cardName.StartsWith("___NULL___")) { __result = (CardInfo)(object)NullManager.instance.GetNullCardInfo(cardName.Substring(10), -1); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class ApplyCardStatsPatch : Object { [CompilerGenerated] private sealed class <>c__DisplayClass0_0 : Object { public NullCardInfo nullCard; public Player ___playerToUpgrade; public NullCardInfo nullCard2; internal void b__0(Action c) { try { c.Invoke(nullCard, ___playerToUpgrade); } catch (Object) { } } internal void b__1(Action c) { try { c.Invoke(nullCard2, ___playerToUpgrade); } catch (Object) { } } } private static void Postfix(ApplyCardStats __instance, Player ___playerToUpgrade) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0(); CS$<>8__locals0.___playerToUpgrade = ___playerToUpgrade; CardInfo component = ((Component)__instance).GetComponent(); CS$<>8__locals0.nullCard = component as NullCardInfo; if (CS$<>8__locals0.nullCard != null) { CS$<>8__locals0.___playerToUpgrade.data.stats.AjustNulls(-NullManager.instance.GetNullValue(((CardInfo)CS$<>8__locals0.nullCard).rarity)); NullManager.instance.callbacks.ForEach((Action>)delegate(Action c) { try { c.Invoke(CS$<>8__locals0.nullCard, CS$<>8__locals0.___playerToUpgrade); } catch (Object) { } }); } component = ((Component)__instance).GetComponent().sourceCard; CS$<>8__locals0.nullCard2 = component as NullCardInfo; if (CS$<>8__locals0.nullCard2 == null) { return; } CS$<>8__locals0.___playerToUpgrade.data.stats.AjustNulls(-NullManager.instance.GetNullValue(((CardInfo)CS$<>8__locals0.nullCard2).rarity)); NullManager.instance.callbacks.ForEach((Action>)delegate(Action c) { try { c.Invoke(CS$<>8__locals0.nullCard2, CS$<>8__locals0.___playerToUpgrade); } catch (Object) { } }); } } public class GameSaverPatch : Object { public static void Patch() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown Main.harmony.Patch((MethodBase)(object)typeof(PlayerData).GetConstructor((Type[])(object)new Type[7] { typeof(String), typeof(Int32), typeof(List), typeof(Int32), typeof(Int32), typeof(Boolean), typeof(UInt64) }), (HarmonyMethod)null, new HarmonyMethod(typeof(GameSaverPatch).GetMethod("Constructor")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void Constructor(List cards, PlayerData __instance) { for (int i = 0; i < cards.Count; i++) { if (cards[i] is NullCardInfo nullCardInfo) { __instance.serializedCards[i] = String.Concat("___NULL___", ((Object)nullCardInfo.NulledSorce).name); } } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [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("com.Root.Null", "NullManager", "1.3.1")] [BepInProcess("Rounds.exe")] public class Main : BaseUnityPlugin { [CompilerGenerated] private sealed class d__11 : Object, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public object _; public Main <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; PlayerManager.instance.players.ForEach((Action)delegate(Player p) { p.data.stats.GetNullData().nulls = 0; }); return false; } [DebuggerHidden] void IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } } private const string ModId = "com.Root.Null"; private const string ModName = "NullManager"; public const string Version = "1.3.1"; internal static AssetBundle Assets; internal static Harmony harmony; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public static Main instance { [CompilerGenerated] get; [CompilerGenerated] private set; } private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown harmony = new Harmony("com.Root.Null"); harmony.PatchAll(); instance = this; Assets = AssetUtils.LoadAssetBundleFromResources("nullassets", typeof(Main).Assembly); NullManager.instance = Assets.LoadAsset("NullManger").GetComponent(); PhotonNetwork.PrefabPool.RegisterPrefab(((Object)NullManager.instance.NullCard).name, NullManager.instance.NullCard); } private void Start() { List val = (List)typeof(Chainloader).GetField("_plugins", (BindingFlags)40).GetValue((object)null); if (val.Exists((Predicate)((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))) { TabinfoInterface.Setup(); } if (val.Exists((Predicate)((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "ot.dan.rounds.gamesaver"))) { GameSaverPatch.Patch(); } NullManager.instance.SetUp(); GameModeManager.AddHook("GameStart", (Func)RestNulls); PickManager.RegisterDrawValidationFunction((Func)NullSpawnLogic.AntiCardValitator); PickManager.RegisterHandModificationFunction((Func)NullSpawnLogic.NullOutCards, 400); } [IteratorStateMachine(/*Could not decode attribute arguments.*/)] internal IEnumerator RestNulls(object _) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return (IEnumerator)(object)new d__11(0) { <>4__this = this, _ = _ }; } } public class NullCard : MonoBehaviour, IPunInstantiateMagicCallback { [CompilerGenerated] private sealed class <>c__DisplayClass1_0 : Object { public GameObject temp; public NullCard <>4__this; internal void b__1() { for (int i = 0; i < temp.transform.childCount; i++) { temp.transform.GetChild(i).SetParent(((Component)<>4__this).transform, false); } Object.DestroyImmediate((Object)(object)temp); Enumerable.ToList((IEnumerable)(object)((Component)<>4__this).GetComponentsInChildren()).ForEach((Action)delegate(Image image) { image.sprite = Main.Assets.LoadAsset("missing_texture"); image.type = (Type)2; }); Enumerable.ToList((IEnumerable)(object)((Component)<>4__this).GetComponentsInChildren()).ForEach((Action)([CompilerGenerated] (TextMeshProUGUI text) => { if (((TMP_Text)text).text == ((NullCardInfo)(object)((Component)<>4__this).GetComponent().sourceCard).NulledSorce.cardName.ToUpper()) { ((TMP_Text)text).font = Main.Assets.LoadAsset("Nightmare"); } })); } } private object[] data; public void OnPhotonInstantiate(PhotonMessageInfo info) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown data = info.photonView.InstantiationData; ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Main.instance, 2, (Action)([CompilerGenerated] () => { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected I4, but got Unknown //IL_0038: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown <>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0 { <>4__this = this }; ((Component)this).GetComponent().sourceCard = (CardInfo)(object)NullManager.instance.GetNullCardInfo((string)(String)data[0], (int)(Int32)data[1]); ((Component)this).GetComponent().cardBase = ((Component)this).GetComponent().sourceCard.cardBase; ((Component)this).GetComponent().rarity = ((Component)this).GetComponent().sourceCard.rarity; Object.DestroyImmediate((Object)(object)((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject); ((Component)this).gameObject.SetActive(false); CS$<>8__locals0.temp = Object.Instantiate(((Component)((NullCardInfo)(object)((Component)this).GetComponent().sourceCard).NulledSorce).gameObject, ((Component)this).transform); CS$<>8__locals0.temp.GetComponent().cardDestription = ""; CS$<>8__locals0.temp.GetComponent().cardStats = ((Component)this).GetComponent().sourceCard.cardStats; ((Component)this).gameObject.SetActive(true); ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Main.instance, 4, (Action)delegate { for (int i = 0; i < CS$<>8__locals0.temp.transform.childCount; i++) { CS$<>8__locals0.temp.transform.GetChild(i).SetParent(((Component)CS$<>8__locals0.<>4__this).transform, false); } Object.DestroyImmediate((Object)(object)CS$<>8__locals0.temp); Enumerable.ToList((IEnumerable)(object)((Component)CS$<>8__locals0.<>4__this).GetComponentsInChildren()).ForEach((Action)delegate(Image image) { image.sprite = Main.Assets.LoadAsset("missing_texture"); image.type = (Type)2; }); Enumerable.ToList((IEnumerable)(object)((Component)CS$<>8__locals0.<>4__this).GetComponentsInChildren()).ForEach((Action)([CompilerGenerated] (TextMeshProUGUI text) => { if (((TMP_Text)text).text == ((NullCardInfo)(object)((Component)CS$<>8__locals0.<>4__this).GetComponent().sourceCard).NulledSorce.cardName.ToUpper()) { ((TMP_Text)text).font = Main.Assets.LoadAsset("Nightmare"); } })); }); })); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class NullCardBar : Object { [CompilerGenerated] private sealed class <>c__DisplayClass0_0 : Object { public CardInfo card; public Action <>9__2; internal void b__0() { if ((Object)(object)card != (Object)null) { Enumerable.ToList((IEnumerable)(object)((Component)card).GetComponentsInChildren()).ForEach((Action)delegate(Image image) { image.sprite = Main.Assets.LoadAsset("missing_texture"); image.type = (Type)2; }); } Enumerable.ToList((IEnumerable)(object)((Component)card).GetComponentsInChildren()).ForEach((Action)delegate(TextMeshProUGUI text) { if (((TMP_Text)text).text == card.cardName.ToUpper()) { ((TMP_Text)text).font = Main.Assets.LoadAsset("Nightmare"); } }); ((TMP_Text)((Component)card).GetComponentInChildren().nameText).text = ((TMP_Text)((Component)card).GetComponentInChildren().nameText).text.Substring(2); } internal void b__2(TextMeshProUGUI text) { if (((TMP_Text)text).text == card.cardName.ToUpper()) { ((TMP_Text)text).font = Main.Assets.LoadAsset("Nightmare"); } } } private static bool Prefix(CardInfo cardToSpawn, Vector3 pos, ref GameObject __result) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_006c: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown if (cardToSpawn is NullCardInfo nullCardInfo) { <>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0(); GameObject val = new GameObject(); NullCardInfo nullCardInfo2 = NullManager.instance.GetNullCardInfo(((Object)nullCardInfo.NulledSorce).name, nullCardInfo.PlayerId); val.SetActive(false); Debug.Log((object)".Instantiate"); __result = Object.Instantiate(((Component)(CardInfo)typeof(CardChoiceSpawnUniqueCardPatch).GetField("NullCard", (BindingFlags)40).GetValue((object)null)).gameObject, pos, Quaternion.identity, val.transform); CS$<>8__locals0.card = __result.GetComponent(); Object.DestroyImmediate((Object)(object)CS$<>8__locals0.card); CS$<>8__locals0.card = CopyComponent((CardInfo)(object)nullCardInfo2, __result); ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Main.instance, 2, (Action)delegate { if ((Object)(object)CS$<>8__locals0.card != (Object)null) { Enumerable.ToList((IEnumerable)(object)((Component)CS$<>8__locals0.card).GetComponentsInChildren()).ForEach((Action)delegate(Image image) { image.sprite = Main.Assets.LoadAsset("missing_texture"); image.type = (Type)2; }); } Enumerable.ToList((IEnumerable)(object)((Component)CS$<>8__locals0.card).GetComponentsInChildren()).ForEach((Action)delegate(TextMeshProUGUI text) { if (((TMP_Text)text).text == CS$<>8__locals0.card.cardName.ToUpper()) { ((TMP_Text)text).font = Main.Assets.LoadAsset("Nightmare"); } }); ((TMP_Text)((Component)CS$<>8__locals0.card).GetComponentInChildren().nameText).text = ((TMP_Text)((Component)CS$<>8__locals0.card).GetComponentInChildren().nameText).text.Substring(2); }); Debug.Log((object)"sanity check"); __result.transform.SetParent((Transform)null, true); Object.Destroy((Object)(object)val); __result.GetComponentInChildren().firstValueToSet = true; return false; } return true; } private static T CopyComponent(T original, GameObject destination) where T : Component { Type type = ((Object)original).GetType(); Component val = destination.AddComponent(type); FieldInfo[] fields = type.GetFields(); FieldInfo[] array = fields; foreach (FieldInfo val2 in array) { val2.SetValue((object)val, val2.GetValue((object)original)); } return (T)(object)((val is T) ? val : null); } } public class NullCardInfo : CardInfo { public CardInfo NulledSorce; public int PlayerId; internal bool randomCard = false; } [Serializable] public class CharacterStatModifiersnullData : Object { public int nulls; public CharacterStatModifiersnullData() { nulls = 0; } public void Reset() { } } public static class CharacterStatModifiersExtension : Object { public static readonly ConditionalWeakTable data = new ConditionalWeakTable(); internal static CharacterStatModifiersnullData GetNullData(this CharacterStatModifiers characterstats) { return data.GetOrCreateValue(characterstats); } public static void AjustNulls(this CharacterStatModifiers characterstats, int value) { characterstats.GetNullData().nulls = Mathf.Clamp(characterstats.GetNullData().nulls + value, 0, 1000000); } public static int GetNulls(this CharacterStatModifiers characterstats) { return characterstats.GetNullData().nulls; } internal static void AddData(this CharacterStatModifiers characterstats, CharacterStatModifiersnullData value) { try { data.Add(characterstats, value); } catch (Exception) { } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class CharacterStatModifiersPatchResetStats : Object { private static void Prefix(CharacterStatModifiers __instance) { __instance.GetNullData().Reset(); } } [Serializable] public class CardInfoAdditionalData : Object { public bool isAntiCard; public bool nullAble; public bool needsNull; public CardInfoAdditionalData() { isAntiCard = false; nullAble = true; needsNull = false; } } public static class CardInfoExtension : Object { public static readonly ConditionalWeakTable data = new ConditionalWeakTable(); internal static CardInfoAdditionalData GetNullData(this CardInfo cardInfo) { return data.GetOrCreateValue(cardInfo); } public static CardInfo SetAntiCard(this CardInfo cardInfo) { cardInfo.GetNullData().isAntiCard = true; return cardInfo; } public static bool IsAntiCard(this CardInfo cardInfo) { return cardInfo.GetNullData().isAntiCard; } public static CardInfo MarkUnNullable(this CardInfo cardInfo) { cardInfo.GetNullData().nullAble = false; return cardInfo; } public static bool IsNullable(this CardInfo cardInfo) { return cardInfo.GetNullData().nullAble; } public static CardInfo NeedsNull(this CardInfo cardInfo) { cardInfo.GetNullData().needsNull = true; return cardInfo; } public static void AddData(this CardInfo cardInfo, CardInfoAdditionalData value) { try { data.Add(cardInfo, value); } catch (Exception) { } } } public static class PlayerExtensions : Object { [CompilerGenerated] private sealed class <>c__DisplayClass0_0 : Object { public Rarity rarity; internal bool b__1(CardInfo c) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return c is NullCardInfo nullCardInfo && nullCardInfo.NulledSorce.rarity == rarity; } } [CompilerGenerated] private sealed class <>c__DisplayClass1_0 : Object { public Rarity rarity; internal bool b__2(CardInfo c) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return c is NullCardInfo nullCardInfo && nullCardInfo.NulledSorce.rarity == rarity; } } public static int GetNullCount(this Player player, Rarity rarity = -1) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 <>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0(); CS$<>8__locals0.rarity = rarity; if ((int)CS$<>8__locals0.rarity == -1) { return Enumerable.Count(Enumerable.Where((IEnumerable)(object)player.data.currentCards, (Func)((CardInfo c) => c is NullCardInfo))); } return Enumerable.Count(Enumerable.Where((IEnumerable)(object)player.data.currentCards, (Func)((CardInfo c) => c is NullCardInfo nullCardInfo && nullCardInfo.NulledSorce.rarity == CS$<>8__locals0.rarity))); } public static int GetNullValue(this Player player, Rarity rarity = -1) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 <>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0(); CS$<>8__locals0.rarity = rarity; if ((int)CS$<>8__locals0.rarity == -1) { return Enumerable.Sum(Enumerable.Select(Enumerable.Where((IEnumerable)(object)player.data.currentCards, (Func)((CardInfo c) => c is NullCardInfo)), (Func)((CardInfo c) => NullManager.instance.GetNullValue(c.rarity)))); } return Enumerable.Sum(Enumerable.Select(Enumerable.Where((IEnumerable)(object)player.data.currentCards, (Func)((CardInfo c) => c is NullCardInfo nullCardInfo && nullCardInfo.NulledSorce.rarity == CS$<>8__locals0.rarity)), (Func)((CardInfo c) => NullManager.instance.GetNullValue(c.rarity)))); } } public class NullManager : MonoBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass11_0 : Object { public Rarity rarity; public Player player; internal bool b__0(Card cardData) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return cardData.enabled && cardData.cardInfo.rarity == rarity && Cards.instance.PlayerIsAllowedCard(player, cardData.cardInfo); } } [CompilerGenerated] private sealed class <>c__DisplayClass9_0 : Object { public List list; public Action <>9__2; public Action <>9__3; internal void b__0(CardInfoStat[] stats) { Enumerable.ToList((IEnumerable)(object)stats).ForEach((Action)delegate(CardInfoStat stat) { list.Add(stat); }); } internal void b__2(CardInfoStat stat) { list.Add(stat); } internal void b__1(CardInfoStat[] stats) { Enumerable.ToList((IEnumerable)(object)stats).ForEach((Action)delegate(CardInfoStat stat) { list.Add(stat); }); } internal void b__3(CardInfoStat stat) { list.Add(stat); } } public static NullManager instance; public GameObject AntiCardBase; public GameObject NullCard; private Dictionary> nullDic = new Dictionary>(); private Dictionary> NullStats = new Dictionary>(); private Dictionary>> NullRarityStats = new Dictionary>>(); internal List> callbacks = new List>(); internal void SetUp() { Enumerable.ToList(RarityUtils.Rarities.Values).ForEach((Action)([CompilerGenerated] (Rarity rarity) => { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) NullCardInfo nullCardInfo = ((Component)this).gameObject.AddComponent(); ((CardInfo)nullCardInfo).rarity = rarity.value; ((Object)nullCardInfo).name = "[]"; ((CardInfo)nullCardInfo).cardDestription = "Adds a random nulled card of this rarity to a player"; nullCardInfo.randomCard = true; ((CardInfo)nullCardInfo).categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("nullCard") }; ((CardInfo)nullCardInfo).blacklistedCategories = (CardCategory[])(object)new CardCategory[0]; Cards.instance.AddHiddenCard((CardInfo)(object)nullCardInfo); })); } public int GetNullValue(Rarity rarity) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return (int)(1f / RarityUtils.GetRarityData(rarity).relativeRarity); } public NullCardInfo GetNullCardInfo(string card, int player) { //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass9_0 CS$<>8__locals0 = new <>c__DisplayClass9_0(); if (!nullDic.ContainsKey(player)) { nullDic[player] = new Dictionary(); } Dictionary val = nullDic[player]; if (!val.ContainsKey(card)) { NullCardInfo nullCardInfo = ((Component)this).gameObject.AddComponent(); nullCardInfo.NulledSorce = ((DefaultPool)PhotonNetwork.PrefabPool).ResourceCache[card].GetComponent(); nullCardInfo.PlayerId = player; ((CardInfo)nullCardInfo).cardName = String.Concat("[]", nullCardInfo.NulledSorce.cardName); ((CardInfo)nullCardInfo).rarity = nullCardInfo.NulledSorce.rarity; ((CardInfo)nullCardInfo).blacklistedCategories = (CardCategory[])(object)new CardCategory[0]; ((CardInfo)(object)nullCardInfo).GetNullData().isAntiCard = false; ((CardInfo)nullCardInfo).sourceCard = (CardInfo)(object)nullCardInfo; ((CardInfo)nullCardInfo).categories = (CardCategory[])(object)new CardCategory[1] { CustomCardCategories.instance.CardCategory("nullCard") }; ((CardInfo)nullCardInfo).cardBase = nullCardInfo.NulledSorce.cardBase; ((CardInfo)nullCardInfo).colorTheme = nullCardInfo.NulledSorce.colorTheme; ((CardInfo)nullCardInfo).cardArt = nullCardInfo.NulledSorce.cardArt; val[card] = nullCardInfo; } int nullValue = GetNullValue(val[card].NulledSorce.rarity); CS$<>8__locals0.list = new List(); CS$<>8__locals0.list.Add(new CardInfoStat { positive = true, stat = String.Concat("null", (nullValue == 1) ? "" : "s"), amount = String.Format("- {0} ", (object)nullValue) }); if (NullStats.ContainsKey(player)) { Enumerable.ToList((IEnumerable)(object)NullStats[player].Values).ForEach((Action)delegate(CardInfoStat[] stats) { Enumerable.ToList((IEnumerable)(object)stats).ForEach((Action)delegate(CardInfoStat stat) { CS$<>8__locals0.list.Add(stat); }); }); } if (NullRarityStats.ContainsKey(player) && NullRarityStats[player].ContainsKey(val[card].NulledSorce.rarity)) { Enumerable.ToList((IEnumerable)(object)NullRarityStats[player][val[card].NulledSorce.rarity].Values).ForEach((Action)delegate(CardInfoStat[] stats) { Enumerable.ToList((IEnumerable)(object)stats).ForEach((Action)delegate(CardInfoStat stat) { CS$<>8__locals0.list.Add(stat); }); }); } ((CardInfo)val[card]).cardStats = CS$<>8__locals0.list.ToArray(); return val[card]; } public NullCardInfo GetNullCardInfo(string card, Player player) { return GetNullCardInfo(card, player.playerID); } public NullCardInfo GetRandomNullWithRarity(Player player, Rarity rarity) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass11_0 CS$<>8__locals0 = new <>c__DisplayClass11_0(); CS$<>8__locals0.rarity = rarity; CS$<>8__locals0.player = player; List val = Enumerable.ToList(Enumerable.Select(Enumerable.Where((IEnumerable)(object)Enumerable.ToArray((IEnumerable)(object)CardManager.cards.Values), (Func)((Card cardData) => cardData.enabled && cardData.cardInfo.rarity == CS$<>8__locals0.rarity && Cards.instance.PlayerIsAllowedCard(CS$<>8__locals0.player, cardData.cardInfo))), (Func)((Card card) => ((Object)card.cardInfo).name))); if (val.Count == 0) { val.Add("__NULL__ "); } ExtensionMethods.Shuffle((IList)(object)val); return GetNullCardInfo(val[0], CS$<>8__locals0.player); } public void RegesterOnAddCallback(Action action) { callbacks.Add(action); } public void SetAdditionalNullStats(Player player, string key, CardInfoStat[] stats) { if (!NullStats.ContainsKey(player.playerID)) { NullStats[player.playerID] = new Dictionary(); } NullStats[player.playerID][key] = stats; } public void SetRarityNullStats(Player player, Rarity rarity, string key, CardInfoStat[] stats) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) if (!NullRarityStats.ContainsKey(player.playerID)) { NullRarityStats[player.playerID] = new Dictionary>(); } if (!NullRarityStats[player.playerID].ContainsKey(rarity)) { NullRarityStats[player.playerID][rarity] = new Dictionary(); } NullRarityStats[player.playerID][rarity][key] = stats; } } internal static class NullSpawnLogic : Object { internal static Player GetPlayerWithID(int playerID) { for (int i = 0; i < PlayerManager.instance.players.Count; i++) { if (PlayerManager.instance.players[i].playerID == playerID) { return PlayerManager.instance.players[i]; } } return null; } private static int nullTotal(CardInfo[] spawnedCards) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (spawnedCards == null) { return 0; } try { int num = 0; foreach (CardInfo val in spawnedCards) { if (val is NullCardInfo nullCardInfo) { num += NullManager.instance.GetNullValue(nullCardInfo.NulledSorce.rarity); } } return num; } catch (Object) { return 0; } } internal static ValidationResult AntiCardValitator(CardInfo[] hand, CardInfo card) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) Player playerWithID = GetPlayerWithID(CardChoice.instance.pickrID); if (hand == null || (Object)(object)card == (Object)null || !card.GetNullData().isAntiCard) { return (ValidationResult)0; } if ((Object)(object)playerWithID != (Object)null && nullTotal(hand) < playerWithID.data.stats.GetNullData().nulls) { return (ValidationResult)0; } return (ValidationResult)1; } internal static CardInfo[] NullOutCards(CardInfo[] hand) { Player playerWithID = GetPlayerWithID(CardChoice.instance.pickrID); if ((Object)(object)playerWithID == (Object)null) { return hand; } for (int i = 0; i < hand.Length; i++) { CardInfo cardInfo = hand[i]; if (!cardInfo.GetNullData().isAntiCard && cardInfo.GetNullData().nullAble && nullTotal(Enumerable.ToArray(Enumerable.Take((IEnumerable)(object)hand, i))) < playerWithID.data.stats.GetNullData().nulls) { hand[i] = (CardInfo)(object)NullManager.instance.GetNullCardInfo(((Object)hand[i]).name, playerWithID); PickManager.RegisterCustomPhotonData(hand[i], (object[])(object)new Object[2] { (Object)((Object)((NullCardInfo)(object)hand[i]).NulledSorce).name, (object)playerWithID.playerID }); PickManager.RegisterAlternetSpawnName(hand[i], ((Object)NullManager.instance.NullCard).name); } } return hand; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class SpawnNulls : Object { private static int nullTotal(List spawnedCards) { //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_0054: Unknown result type (might be due to invalid IL or missing references) if (spawnedCards == null) { return 0; } try { int num = 0; Enumerator enumerator = spawnedCards.GetEnumerator(); try { while (enumerator.MoveNext()) { GameObject current = enumerator.Current; CardInfo sourceCard = current.GetComponent().sourceCard; if (sourceCard is NullCardInfo nullCardInfo) { num += NullManager.instance.GetNullValue(nullCardInfo.NulledSorce.rarity); } } } finally { ((IDisposable)enumerator).Dispose(); } return num; } catch (Object) { return 0; } } internal static Player GetPlayerWithID(int playerID) { for (int i = 0; i < PlayerManager.instance.players.Count; i++) { if (PlayerManager.instance.players[i].playerID == playerID) { return PlayerManager.instance.players[i]; } } return null; } [HarmonyPostfix] private static void PatchAllowed(Player player, CardInfo card, ref bool __result) { if ((Object)(object)player == (Object)null || (Object)(object)card == (Object)null) { return; } if (__result && card.GetNullData().isAntiCard) { if (CardChoice.instance.IsPicking && player.playerID == CardChoice.instance.pickrID && nullTotal((List)ExtensionMethods.GetFieldValue((object)CardChoice.instance, "spawnedCards")) < player.data.stats.GetNullData().nulls) { __result = true; return; } __result = false; } if (__result && card.GetNullData().needsNull) { if (player.data.stats.GetNullData().nulls > 0 || player.GetNullCount((Rarity)(-1)) > 0) { __result = true; } else { __result = false; } } } } public class TabinfoInterface : Object { [CompilerGenerated] private sealed class <>c__DisplayClass1_0 : Object { public GameObject cardObj; public CardInfo card; public Action <>9__3; internal void b__0() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) cardObj.transform.localScale = Vector3.one * 25f; } internal void b__1() { if ((Object)(object)card != (Object)null) { Enumerable.ToList((IEnumerable)(object)((Component)card).GetComponentsInChildren()).ForEach((Action)delegate(Image image) { image.sprite = Main.Assets.LoadAsset("missing_texture"); image.type = (Type)2; }); } Enumerable.ToList((IEnumerable)(object)((Component)card).GetComponentsInChildren()).ForEach((Action)delegate(TextMeshProUGUI text) { if (((TMP_Text)text).text == card.cardName.ToUpper()) { ((TMP_Text)text).font = Main.Assets.LoadAsset("Nightmare"); } }); } internal void b__3(TextMeshProUGUI text) { if (((TMP_Text)text).text == card.cardName.ToUpper()) { ((TMP_Text)text).font = Main.Assets.LoadAsset("Nightmare"); } } } public static void Setup() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown StatCategory val = TabInfoManager.RegisterCategory("null", 7); TabInfoManager.RegisterStat(val, "Nulls", (Func)((Player p) => p.data.stats.GetNullData().nulls > 0), (Func)((Player p) => String.Format("{0}", (object)p.data.stats.GetNullData().nulls))); Main.harmony.Patch((MethodBase)(object)typeof(PlayerCardButton).GetMethod("OnPointerEnter"), new HarmonyMethod(typeof(TabinfoInterface).GetMethod("Prefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static bool Prefix(PlayerCardButton __instance, PointerEventData eventData) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Expected O, but got Unknown //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown if (__instance.card is NullCardInfo nullCardInfo) { <>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0(); GameObject val = (GameObject)ExtensionMethods.GetFieldValue((object)__instance, "displayedCard"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } val = Object.Instantiate((GameObject)typeof(TabInfoManager).GetField("cardHolderTemplate", (BindingFlags)40).GetValue((object)null), ((GameObject)typeof(TabInfoManager).GetField("canvas", (BindingFlags)40).GetValue((object)null)).transform); val.transform.position = ((Component)__instance).gameObject.transform.position; val.SetActive(false); CS$<>8__locals0.cardObj = Object.Instantiate(((Component)nullCardInfo.NulledSorce).gameObject, val.transform); CS$<>8__locals0.card = CS$<>8__locals0.cardObj.GetComponent(); Object.DestroyImmediate((Object)(object)CS$<>8__locals0.card); CS$<>8__locals0.card = CopyComponent((CardInfo)(object)nullCardInfo, CS$<>8__locals0.cardObj); val.SetActive(true); CardVisuals componentInChildren = CS$<>8__locals0.cardObj.GetComponentInChildren(); componentInChildren.firstValueToSet = true; CS$<>8__locals0.cardObj.transform.localPosition = Vector3.zero; Collider2D[] componentsInChildren = val.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Behaviour)componentsInChildren[i]).enabled = false; } CS$<>8__locals0.cardObj.GetComponentInChildren().sortingLayerName = "MostFront"; ((Behaviour)CS$<>8__locals0.cardObj.GetComponentInChildren()).enabled = false; ((Behaviour)CS$<>8__locals0.cardObj.GetComponentInChildren()).enabled = false; ((Component)CS$<>8__locals0.cardObj.GetComponentInChildren()).transform.localScale = Vector3.one * 1.15f; ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)__instance, 1, (Action)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) CS$<>8__locals0.cardObj.transform.localScale = Vector3.one * 25f; }); ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)__instance, 2, (Action)delegate { if ((Object)(object)CS$<>8__locals0.card != (Object)null) { Enumerable.ToList((IEnumerable)(object)((Component)CS$<>8__locals0.card).GetComponentsInChildren()).ForEach((Action)delegate(Image image) { image.sprite = Main.Assets.LoadAsset("missing_texture"); image.type = (Type)2; }); } Enumerable.ToList((IEnumerable)(object)((Component)CS$<>8__locals0.card).GetComponentsInChildren()).ForEach((Action)delegate(TextMeshProUGUI text) { if (((TMP_Text)text).text == CS$<>8__locals0.card.cardName.ToUpper()) { ((TMP_Text)text).font = Main.Assets.LoadAsset("Nightmare"); } }); }); ExtensionMethods.SetFieldValue((object)__instance, "displayedCard", (object)val); return false; } return true; } private static GameObject Instantiate(GameObject cardHolderTemplate, Transform transform) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) throw new NotImplementedException(); } private static T CopyComponent(T original, GameObject destination) where T : Component { Type type = ((Object)original).GetType(); Component val = destination.AddComponent(type); FieldInfo[] fields = type.GetFields(); FieldInfo[] array = fields; foreach (FieldInfo val2 in array) { val2.SetValue((object)val, val2.GetValue((object)original)); } return (T)(object)((val is T) ? val : null); } } }