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 CardChoiceSpawnUniqueCardPatch.CustomCategories;
using DrawNCards;
using HarmonyLib;
using ItemShops;
using ItemShops.Extensions;
using ItemShops.Utils;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using Nullmanager;
using Photon.Pun;
using RarityLib.Utils;
using RootCore;
using TMPro;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UI.ProceduralImage;
using WillsWackyManagers.Utils;
[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 Genie
{
public class Curseed : MonoBehaviour
{
private Player player;
private void Awake()
{
player = ((Component)this).GetComponentInParent<Player>();
GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)Curse);
}
private void OnDestroy()
{
GameModeManager.RemoveHook("PointStart", (Func<IGameModeHandler, IEnumerator>)Curse);
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
private IEnumerator Curse(IGameModeHandler _)
{
CurseManager.instance.CursePlayer(player, (Func<CardInfo, Player, bool>)((CardInfo c, Player p) => !Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, CustomCardCategories.instance.CardCategory("KindCurse"))));
yield break;
}
}
public class EndlessAdd : OnAddEffect
{
[CompilerGenerated]
private sealed class <>c__DisplayClass1_0 : Object
{
public Player player;
public CardInfo card;
internal bool <LockCard>b__0()
{
if ((Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)card)
{
return (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)CardList.GetCardInfo("Genie_Endless");
}
return false;
}
}
public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
((MonoBehaviour)Core.instance).StartCoroutine(LockCard(player));
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public static IEnumerator LockCard(Player player)
{
<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
CS$<>8__locals0.player = player;
CS$<>8__locals0.card = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
yield return new WaitUntil((Func<bool>)(() => (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CS$<>8__locals0.card && (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CardList.GetCardInfo("Genie_Endless")));
CharacterStatModifiersExtension.GetRootData(CS$<>8__locals0.player).perpetualCard = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards).sourceCard = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
}
}
public class EternityAdd : OnAddEffect
{
[CompilerGenerated]
private sealed class <>c__DisplayClass1_0 : Object
{
public Player player;
public CardInfo card;
internal bool <LockCard>b__0()
{
if ((Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)card)
{
return (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)CardList.GetCardInfo("Genie_Eternity");
}
return false;
}
}
public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
((MonoBehaviour)Core.instance).StartCoroutine(LockCard(player));
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public static IEnumerator LockCard(Player player)
{
<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
CS$<>8__locals0.player = player;
CS$<>8__locals0.card = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
yield return new WaitUntil((Func<bool>)(() => (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CS$<>8__locals0.card && (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CardList.GetCardInfo("Genie_Eternity")));
CharacterStatModifiersExtension.GetRootData(CS$<>8__locals0.player).lockedCard = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards).sourceCard = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
}
}
public class GenieCard : Object
{
[CompilerGenerated]
private sealed class <>c__DisplayClass3_0 : Object
{
public Player player;
public List<CardInfo> newCards;
internal void <GenieRerollAction>b__1()
{
Cards.instance.AddCardsToPlayer(player, newCards.ToArray(), true, (string[])null, (float[])null, (float[])null, true);
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass6_0 : Object
{
public bool done;
internal void <WaitTillShopDone>b__0(Player p)
{
if (PlayerExtension.GetAdditionalData(p).bankAccount.HasFunds(wishes))
{
Genie_Shop.Show(p);
done = false;
}
}
internal void <WaitTillShopDone>b__1(Player p)
{
if (ShopManager.instance.PlayerIsInShop(p))
{
done = false;
}
}
}
public static Shop Genie_Shop;
public static string ShopID = "Root_Genie_Shop";
public static Dictionary<string, int> wishes = new Dictionary<string, int>();
internal static void GenieRerollAction(Player player, CardInfo[] originalCards)
{
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Expected O, but got Unknown
<>c__DisplayClass3_0 CS$<>8__locals0 = new <>c__DisplayClass3_0();
CS$<>8__locals0.player = player;
List<CardInfo> val = Enumerable.ToList<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)originalCards, (Func<CardInfo, bool>)((CardInfo c) => Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, CustomCardCategories.instance.CardCategory("GenieOutcome")))));
if (val.Count != 0)
{
CS$<>8__locals0.newCards = new List<CardInfo>();
List<CardInfo> val2 = Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
while (val2.Count < val.Count)
{
val.RemoveAt(Random.Range(0, val.Count));
}
for (int i = 0; i < val.Count; i++)
{
CS$<>8__locals0.newCards.Add(val[i]);
CS$<>8__locals0.newCards.Add(val2[i]);
}
val2.RemoveRange(0, val.Count);
CS$<>8__locals0.newCards.AddRange((IEnumerable<CardInfo>)(object)val2);
Cards.instance.RemoveAllCardsFromPlayer(CS$<>8__locals0.player, true);
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Core.instance, 2, (Action)delegate
{
Cards.instance.AddCardsToPlayer(CS$<>8__locals0.player, CS$<>8__locals0.newCards.ToArray(), true, (string[])null, (float[])null, (float[])null, true);
});
}
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal static IEnumerator Wish()
{
wishes = new Dictionary<string, int>();
wishes.Add("Wish", 1);
if ((Object)(object)Genie_Shop != (Object)null)
{
ShopManager.instance.RemoveShop(Genie_Shop);
}
Genie_Shop = ShopManager.instance.CreateShop(ShopID);
Genie_Shop.UpdateMoneyColumnName("Wishes");
Genie_Shop.UpdateTitle("Be Carful What You Wish For");
((MonoBehaviour)Core.instance).StartCoroutine(SetUpShop());
yield break;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal static IEnumerator SetUpShop()
{
List<Card> obj = Enumerable.ToList<Card>((IEnumerable<Card>)(object)CardManager.cards.Values);
List<CardItem> val = new List<CardItem>();
Enumerator<Card> enumerator = obj.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Card current = enumerator.Current;
if (current != null && (Object)(object)current.cardInfo != (Object)(object)CardList.GetCardInfo("Genie") && (Object)(object)current.cardInfo != (Object)(object)CardList.GetCardInfo("Cake_Divine") && CardManager.IsCardActive(current.cardInfo) && ((Object)current.cardInfo).name != "Half Ass Copy Cat")
{
CardInfo cardInfo = current.cardInfo;
RootCardInfo val2 = (RootCardInfo)(object)((cardInfo is RootCardInfo) ? cardInfo : null);
if (val2 == null || !val2.Restricted || !val2.Key.StartsWith("Cake_") || CardManager.IsCardActive((CardInfo)(object)CardList.GetCardInfo("Cake_Toggle")))
{
val.Add(new CardItem(current));
}
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
Shop genie_Shop = Genie_Shop;
string[] array = Enumerable.ToArray<string>(Enumerable.Select<CardItem, string>((IEnumerable<CardItem>)(object)val, (Func<CardItem, string>)((CardItem c) => String.Concat(c.Card.cardInfo.cardName, ((Object)c.Card.cardInfo).name))));
Purchasable[] array2 = (Purchasable[])(object)val.ToArray();
genie_Shop.AddItems(array, array2);
yield break;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal static IEnumerator WaitTillShopDone()
{
<>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0
{
done = true
};
GameObject gameObject = null;
GameObject timer = null;
float time = 120f;
PlayerManager.instance.players.ForEach((Action<Player>)delegate(Player p)
{
if (PlayerExtension.GetAdditionalData(p).bankAccount.HasFunds(wishes))
{
Genie_Shop.Show(p);
CS$<>8__locals0.done = false;
}
});
int num;
if (!CS$<>8__locals0.done)
{
gameObject = new GameObject();
gameObject.AddComponent<Canvas>().sortingLayerName = "MostFront";
((TMP_Text)gameObject.AddComponent<TextMeshProUGUI>()).text = "Waiting For Players In Wish Menu";
Color magenta = Color.magenta;
magenta.a = 0.85f;
((Graphic)gameObject.GetComponent<TextMeshProUGUI>()).color = magenta;
gameObject.transform.localScale = new Vector3(0.2f, 0.2f);
gameObject.transform.localPosition = new Vector3(0f, 5f);
timer = new GameObject();
timer.AddComponent<Canvas>().sortingLayerName = "MostFront";
timer.transform.localScale = new Vector3(0.2f, 0.2f);
timer.transform.localPosition = new Vector3(0f, 16f);
((Graphic)timer.AddComponent<TextMeshProUGUI>()).color = magenta;
int i = 0;
while (i < 5)
{
TextMeshProUGUI component = timer.GetComponent<TextMeshProUGUI>();
num = (int)time;
((TMP_Text)component).text = ((Int32)(ref num)).ToString();
yield return new WaitForSecondsRealtime(1f);
time -= 1f;
num = i++;
}
}
while (!CS$<>8__locals0.done)
{
TextMeshProUGUI component2 = timer.GetComponent<TextMeshProUGUI>();
num = (int)time;
((TMP_Text)component2).text = ((Int32)(ref num)).ToString();
CS$<>8__locals0.done = true;
yield return new WaitForSecondsRealtime(0.2f);
time -= 0.2f;
PlayerManager.instance.players.ForEach((Action<Player>)delegate(Player p)
{
if (ShopManager.instance.PlayerIsInShop(p))
{
CS$<>8__locals0.done = false;
}
});
if (time <= 0f)
{
ShopManager.instance.HideAllShops();
CS$<>8__locals0.done = true;
}
}
Object.Destroy((Object)(object)gameObject);
Object.Destroy((Object)(object)timer);
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal static IEnumerator RestCardLock()
{
Player[] array = PlayerManager.instance.players.ToArray();
for (int i = 0; i < array.Length; i++)
{
CharacterStatModifiersExtension.GetRootData(array[i]).lockedCard = null;
}
yield break;
}
}
internal class CardItem : Purchasable
{
[CompilerGenerated]
private sealed class <>c__DisplayClass12_0 : Object
{
public Player player;
public bool can_eternity;
public CardItem <>4__this;
public CardInfo card;
public float max;
public Action<Player> <>9__3;
internal bool <DoGenieWish>b__0(RootCardInfo c)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
if (Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)((CardInfo)c).categories, CustomCardCategories.instance.CardCategory("GenieOutcome")) && (((CardInfo)c).allowMultiple || !UtilityExtenions.HasCard(player, (CardInfo)(object)c)) && (c.Key != "Genie_Debt" || GameModeManager.CurrentHandler.GetTeamScore(player.teamID).rounds > 0) && (can_eternity || c.Key != "Genie_Eternity"))
{
return <>4__this.GetDistance(((CardInfo)c).rarity, card.rarity) < 6f;
}
return false;
}
internal float <DoGenieWish>b__1(float f)
{
return Mathf.Abs(f - max);
}
internal void <DoGenieWish>b__3(Player p)
{
if (p.playerID != player.playerID)
{
Cards.instance.AddCardToPlayer(p, card, false, "", 2f, 2f, true);
}
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass15_0 : Object
{
public GameObject cardObj;
internal void <GetCardVisuals>b__0()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
CardRarityColor[] componentsInChildren = cardObj.GetComponentsInChildren<CardRarityColor>();
foreach (CardRarityColor val in componentsInChildren)
{
try
{
val.Toggle(true);
}
catch (Object)
{
}
}
TextMeshProUGUI component = FindObjectInChildren(cardObj, "Text_Name").GetComponent<TextMeshProUGUI>();
if (((Graphic)component).color.r < 0.18f && ((Graphic)component).color.g < 0.18f && ((Graphic)component).color.b < 0.18f)
{
((Graphic)component).color = Color32.op_Implicit(new Color32((byte)200, (byte)200, (byte)200, (byte)255));
}
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass16_0 : Object
{
public string gameObjectName;
internal bool <FindObjectInChildren>b__0(Transform item)
{
return ((Object)item).name == gameObjectName;
}
}
internal Card Card;
private Dictionary<string, int> cost = new Dictionary<string, int>();
public override string Name => Card.cardInfo.cardName;
public override Dictionary<string, int> Cost => cost;
public override Tag[] Tags => (Tag[])(object)new Tag[2]
{
new Tag(((Object)(Rarity)(ref Card.cardInfo.rarity)).ToString()),
new Tag(Card.category)
};
public CardItem(Card card)
{
Card = card;
cost.Add("Wish", 1);
}
public override bool CanPurchase(Player player)
{
return true;
}
public override GameObject CreateItem(GameObject parent)
{
//IL_00e1: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
GameObject val = null;
GameObject val2 = null;
try
{
val = Object.Instantiate<GameObject>(ItemShops.instance.assets.LoadAsset<GameObject>("Card Container"));
}
catch (Exception)
{
Debug.Log((object)"Issue with creating the card container");
}
try
{
val2 = ((Component)val.transform.Find("Card Holder")).gameObject;
}
catch (Exception)
{
Debug.Log((object)"Issue with getting the Card Holder");
val2 = ((Component)val.transform.GetChild(0)).gameObject;
}
val2.transform.localPosition = new Vector3(0f, -100f, 0f);
val2.transform.localScale = new Vector3(0.125f, 0.125f, 1f);
val2.transform.Rotate(0f, 180f, 0f);
try
{
GetCardVisuals(Card.cardInfo, val2);
}
catch (Exception val5)
{
Debug.Log((object)"Issue with getting card visuals");
Debug.LogError((object)val5);
}
val.transform.SetParent(parent.transform);
return val;
}
private float GetDistance(Rarity r1, Rarity r2)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
float relativeRarity = RarityUtils.GetRarityData(r2).relativeRarity;
float relativeRarity2 = RarityUtils.GetRarityData(r1).relativeRarity;
relativeRarity2 = ((!(relativeRarity2 > relativeRarity)) ? (relativeRarity / relativeRarity2) : (relativeRarity2 / relativeRarity));
Debug.Log((object)String.Format("{0},{1} : {2}", (object)r1, (object)r2, (object)relativeRarity2));
return relativeRarity2 - 1f;
}
private void DoGenieWish(Player player, CardInfo card)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass12_0 CS$<>8__locals0 = new <>c__DisplayClass12_0();
CS$<>8__locals0.player = player;
CS$<>8__locals0.<>4__this = this;
CS$<>8__locals0.card = card;
Random val = new Random();
CS$<>8__locals0.can_eternity = !Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)CS$<>8__locals0.card.categories, CustomCardCategories.instance.CardCategory("CardManipulation")) && !Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)CS$<>8__locals0.card.categories, CustomCardCategories.instance.CardCategory("cantEternity"));
List<RootCardInfo> cardsWithCondition = CardList.GetCardsWithCondition((Func<RootCardInfo, bool>)((RootCardInfo c) => Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)((CardInfo)c).categories, CustomCardCategories.instance.CardCategory("GenieOutcome")) && (((CardInfo)c).allowMultiple || !UtilityExtenions.HasCard(CS$<>8__locals0.player, (CardInfo)(object)c)) && (c.Key != "Genie_Debt" || GameModeManager.CurrentHandler.GetTeamScore(CS$<>8__locals0.player.teamID).rounds > 0) && (CS$<>8__locals0.can_eternity || c.Key != "Genie_Eternity") && CS$<>8__locals0.<>4__this.GetDistance(((CardInfo)c).rarity, CS$<>8__locals0.card.rarity) < 6f));
if (val.Next(100) >= 98 || cardsWithCondition.Count == 0)
{
Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, (CardInfo)(object)CardList.GetCardInfo("Empty_Lamp"), false, "", 2f, 2f, true);
return;
}
Debug.Log((object)cardsWithCondition.Count);
List<float> val2 = new List<float>();
_ = RarityUtils.GetRarityData(CS$<>8__locals0.card.rarity).relativeRarity;
for (int i = 0; i < cardsWithCondition.Count; i++)
{
val2.Add(GetDistance(((CardInfo)cardsWithCondition[i]).rarity, CS$<>8__locals0.card.rarity));
}
CS$<>8__locals0.max = Enumerable.Max((IEnumerable<float>)(object)val2);
val2 = Enumerable.ToList<float>(Enumerable.Select<float, float>((IEnumerable<float>)(object)val2, (Func<float, float>)((float f) => Mathf.Abs(f - CS$<>8__locals0.max))));
float num = Enumerable.Sum((IEnumerable<float>)(object)val2);
float num2 = Random.Range(0f, num);
Debug.Log((object)String.Format("Rolled:{0} out of {1}", (object)num2, (object)num));
for (int j = 0; j < cardsWithCondition.Count; j++)
{
num2 -= val2[j];
Debug.Log((object)val2[j]);
if (!(num2 <= 0f))
{
continue;
}
RootCardInfo val3 = cardsWithCondition[j];
if (val3.Key == "Genie_Greed")
{
Cards.instance.RemoveAllCardsFromPlayer(CS$<>8__locals0.player, true);
}
Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, (CardInfo)(object)val3, false, "", 2f, 2f, true);
if (val3.Key == "Genie_Smiles")
{
Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, CS$<>8__locals0.card, false, "", 2f, 2f, true);
}
if (val3.Key == "Genie_Gift")
{
Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, Cards.instance.GetRandomCardWithCondition(CS$<>8__locals0.player, CS$<>8__locals0.player.data.weaponHandler.gun, ((Component)CS$<>8__locals0.player.data.weaponHandler.gun).GetComponentInChildren<GunAmmo>(), CS$<>8__locals0.player.data, CS$<>8__locals0.player.data.healthHandler, ((Component)CS$<>8__locals0.player).GetComponent<Gravity>(), CS$<>8__locals0.player.data.block, CS$<>8__locals0.player.data.stats, (Func<CardInfo, Player, Gun, GunAmmo, CharacterData, HealthHandler, Gravity, Block, CharacterStatModifiers, bool>)((CardInfo cardInfo, Player _0, Gun _1, GunAmmo _2, CharacterData _3, HealthHandler _4, Gravity _5, Block _6, CharacterStatModifiers _7) => (int)cardInfo.rarity == 0), 0), false, "", 2f, 2f, true);
}
if (val3.Key == "Genie_Shared")
{
PlayerManager.instance.players.ForEach((Action<Player>)delegate(Player p)
{
if (p.playerID != CS$<>8__locals0.player.playerID)
{
Cards.instance.AddCardToPlayer(p, CS$<>8__locals0.card, false, "", 2f, 2f, true);
}
});
}
if (val3.Key == "Genie_Defective")
{
Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, (CardInfo)(object)NullManager.instance.GetNullCardInfo(((Object)CS$<>8__locals0.card).name, CS$<>8__locals0.player), false, "", 2f, 2f, true);
return;
}
if (!(val3.Key == "Genie_Delayed"))
{
break;
}
CharacterStatModifiersExtension.GetRootData(CS$<>8__locals0.player).DelayedCard = CS$<>8__locals0.card;
return;
}
Cards.instance.AddCardToPlayer(CS$<>8__locals0.player, CS$<>8__locals0.card, false, "", 2f, 2f, true);
}
public override void OnPurchase(Player player, Purchasable item)
{
CardInfo cardInfo = ((CardItem)(object)item).Card.cardInfo;
DoGenieWish(player, cardInfo);
((MonoBehaviour)Core.instance).StartCoroutine(ShowCard(player, cardInfo));
if (player.data.view.IsMine && !PlayerExtension.GetAdditionalData(player).bankAccount.HasFunds(GenieCard.wishes))
{
GenieCard.Genie_Shop.Hide();
}
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public static IEnumerator ShowCard(Player player, CardInfo card)
{
yield return CardBarUtils.instance.ShowImmediate(player, card, new Nullable<float>(2f));
}
private GameObject GetCardVisuals(CardInfo card, GameObject parent)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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_006c: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Expected O, but got Unknown
<>c__DisplayClass15_0 CS$<>8__locals0 = new <>c__DisplayClass15_0();
CS$<>8__locals0.cardObj = Object.Instantiate<GameObject>(((Component)card).gameObject, parent.gameObject.transform);
CS$<>8__locals0.cardObj.SetActive(true);
CS$<>8__locals0.cardObj.GetComponentInChildren<CardVisuals>().firstValueToSet = true;
RectTransform orAddComponent = ExtensionMethods.GetOrAddComponent<RectTransform>(CS$<>8__locals0.cardObj, false);
((Transform)orAddComponent).localScale = 100f * Vector3.one;
orAddComponent.anchorMin = Vector2.zero;
orAddComponent.anchorMax = Vector2.one;
orAddComponent.offsetMin = Vector2.zero;
orAddComponent.offsetMax = Vector2.zero;
orAddComponent.pivot = new Vector2(0.5f, 0.5f);
GameObject val = FindObjectInChildren(CS$<>8__locals0.cardObj, "Back");
try
{
Object.Destroy((Object)(object)val);
}
catch (Object)
{
}
GameObject obj = FindObjectInChildren(CS$<>8__locals0.cardObj, "BlockFront");
if (obj != null)
{
obj.SetActive(false);
}
CanvasGroup[] componentsInChildren = CS$<>8__locals0.cardObj.GetComponentsInChildren<CanvasGroup>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].alpha = 1f;
}
ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)ItemShops.instance, 0.2f, (Action)delegate
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
CardRarityColor[] componentsInChildren2 = CS$<>8__locals0.cardObj.GetComponentsInChildren<CardRarityColor>();
foreach (CardRarityColor val3 in componentsInChildren2)
{
try
{
val3.Toggle(true);
}
catch (Object)
{
}
}
TextMeshProUGUI component = FindObjectInChildren(CS$<>8__locals0.cardObj, "Text_Name").GetComponent<TextMeshProUGUI>();
if (((Graphic)component).color.r < 0.18f && ((Graphic)component).color.g < 0.18f && ((Graphic)component).color.b < 0.18f)
{
((Graphic)component).color = Color32.op_Implicit(new Color32((byte)200, (byte)200, (byte)200, (byte)255));
}
});
return CS$<>8__locals0.cardObj;
}
private static GameObject FindObjectInChildren(GameObject gameObject, string gameObjectName)
{
<>c__DisplayClass16_0 CS$<>8__locals0 = new <>c__DisplayClass16_0();
CS$<>8__locals0.gameObjectName = gameObjectName;
return Enumerable.FirstOrDefault<GameObject>(Enumerable.Select<Transform, GameObject>(Enumerable.Where<Transform>((IEnumerable<Transform>)(object)gameObject.GetComponentsInChildren<Transform>(true), (Func<Transform, bool>)((Transform item) => ((Object)item).name == CS$<>8__locals0.gameObjectName)), (Func<Transform, GameObject>)((Transform item) => ((Component)item).gameObject)));
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Systems.R00t.Genie", "Genie", "1.0.0")]
[BepInProcess("Rounds.exe")]
public class Main : BaseUnityPlugin
{
private const string ModId = "Systems.R00t.Genie";
private const string ModName = "Genie";
public const string Version = "1.0.0";
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("Systems.R00t.Genie").PatchAll();
Core.RegesterCards(AssetUtils.LoadAssetBundleFromResources("genieassets", typeof(Main).Assembly).LoadAsset<GameObject>("Genie").GetComponent<CardList>(), false);
}
private void Start()
{
GameModeManager.AddHook("PlayerPickStart", (Func<IGameModeHandler, IEnumerator>)([CompilerGenerated] (IGameModeHandler gm) =>
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
((MonoBehaviour)this).StartCoroutine(NoBlock.HideChocieBlock());
return (IEnumerator)(object)new List<object>().GetEnumerator();
}));
GameModeManager.AddHook("PickEnd", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler gm) => GenieCard.WaitTillShopDone()));
GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)GameStart);
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
internal IEnumerator GameStart(IGameModeHandler gm)
{
yield return GenieCard.Wish();
yield return GenieCard.RestCardLock();
}
}
public class MortalityTimer : MonoBehaviour
{
[CompilerGenerated]
private sealed class <>c__DisplayClass16_0 : Object
{
public int playerId;
internal bool <Kill>b__0(Player p)
{
return p.playerID == playerId;
}
}
private float timer;
public Player player;
[Range(0f, 1f)]
public float counter;
public float timeToFill = 30f;
public float timeToEmpty;
public float duration = 1f;
public ProceduralImage outerRing;
public ProceduralImage fill;
public Transform rotator;
public Transform still;
public GameObject Scythe;
public bool Enabled;
public void Awake()
{
player = ((Component)this).GetComponentInParent<Player>();
}
private void Start()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)Pause);
GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)Reset);
GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)Enable);
((Graphic)outerRing).color = Color32.op_Implicit(new Color32((byte)106, (byte)33, (byte)145, (byte)255));
((Graphic)fill).color = Color32.op_Implicit(new Color32((byte)255, (byte)0, (byte)64, (byte)150));
counter = 0f;
((Image)outerRing).fillAmount = counter;
((Image)fill).fillAmount = counter;
((Component)rotator).transform.localEulerAngles = new Vector3(0f, 0f, 0f - Mathf.Lerp(0f, 360f, counter));
}
private void OnDestroy()
{
GameModeManager.RemoveHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)Pause);
GameModeManager.RemoveHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)Reset);
GameModeManager.RemoveHook("PointStart", (Func<IGameModeHandler, IEnumerator>)Enable);
}
private void Update()
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: 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)
if (!Enabled || player.data.dead)
{
return;
}
timer += Time.deltaTime;
counter = timer / timeToFill;
((Image)outerRing).fillAmount = counter;
((Image)fill).fillAmount = counter;
((Component)rotator).transform.localEulerAngles = new Vector3(0f, 0f, 0f - Mathf.Lerp(0f, 360f, counter));
if (counter > 1f && !player.data.dead && player.data.view.IsMine)
{
NetworkingManager.RPC(typeof(MortalityTimer), "Kill", (object[])(object)new Object[1] { (object)player.playerID });
if (player.data.stats.remainingRespawns > 0)
{
player.data.view.RPC("RPCA_Die_Phoenix", (RpcTarget)0, (object[])(object)new Object[1] { (object)(Vector2.down * 1000f) });
}
else
{
player.data.view.RPC("RPCA_Die", (RpcTarget)0, (object[])(object)new Object[1] { (object)(Vector2.down * 1000f) });
}
}
}
[UnboundRPC]
public static void Kill(int playerId)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_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_0073: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass16_0 CS$<>8__locals0 = new <>c__DisplayClass16_0();
CS$<>8__locals0.playerId = playerId;
MortalityTimer componentInChildren = ((Component)PlayerManager.instance.players.Find((Predicate<Player>)((Player p) => p.playerID == CS$<>8__locals0.playerId))).GetComponentInChildren<MortalityTimer>();
GameObject obj = Object.Instantiate<GameObject>(componentInChildren.Scythe, ((Component)componentInChildren).transform.position + ((Component)componentInChildren).transform.up * ((Component)componentInChildren).transform.parent.localScale.y / 3f, Quaternion.identity);
((Behaviour)obj.GetComponent<Animator>()).enabled = true;
Object.Destroy((Object)(object)obj, 15f);
componentInChildren.counter = 1.5f;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
private IEnumerator Pause(IGameModeHandler gm)
{
Enabled = false;
yield break;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
private IEnumerator Enable(IGameModeHandler gm)
{
Enabled = true;
yield break;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
private IEnumerator Reset(IGameModeHandler gm)
{
try
{
Enabled = false;
timer = 0f;
counter = 0f;
((Image)outerRing).fillAmount = counter;
((Image)fill).fillAmount = counter;
((Component)rotator).transform.localEulerAngles = new Vector3(0f, 0f, 0f - Mathf.Lerp(0f, 360f, counter));
}
catch (Exception val)
{
Core.Debug((object)val);
}
yield break;
}
}
public class NoBlock : MonoBehaviour
{
private void Start()
{
((Behaviour)((Component)this).GetComponentInParent<Player>().data.block).enabled = false;
((Component)this).GetComponentInParent<Player>().data.block.counter = 0.25f;
((Component)((Component)((Component)this).GetComponentInParent<Player>()).transform.Find("Limbs/ArmStuff/ShieldStone")).gameObject.SetActive(false);
}
private void OnDestroy()
{
((Behaviour)((Component)this).GetComponentInParent<Player>().data.block).enabled = true;
((Component)((Component)((Component)this).GetComponentInParent<Player>()).transform.Find("Limbs/ArmStuff/ShieldStone")).gameObject.SetActive(true);
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public static IEnumerator HideChocieBlock()
{
while (!CardChoice.instance.IsPicking)
{
yield return null;
}
((Component)((Component)CardChoiceVisuals.instance).transform.Find("Card Choice Face/ArmStuff/ShieldStone")).gameObject.SetActive(!UtilityExtenions.HasCard(PlayerManager.instance.players.Find((Predicate<Player>)((Player player) => CardChoice.instance.pickrID == player.playerID)), "Genie_Exposed"));
}
}
public class PointReduction : MonoBehaviour
{
private Player player;
private void Awake()
{
player = ((Component)this).GetComponentInParent<Player>();
GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)ReducePoints);
}
private void OnDestroy()
{
GameModeManager.RemoveHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)ReducePoints);
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public IEnumerator ReducePoints(IGameModeHandler gameModeHandler)
{
TeamScore teamScore = gameModeHandler.GetTeamScore(player.teamID);
TeamScore val = default(TeamScore);
((TeamScore)(ref val))..ctor(teamScore.points - (int)(((Component)this).GetComponent<AttackLevel>().LevelScale() - 1f), teamScore.rounds);
gameModeHandler.SetTeamScore(player.teamID, val);
yield break;
}
}
public class Predestination : MonoBehaviour
{
private Player player;
private int OldDraws;
private void Awake()
{
player = ((Component)this).GetComponentInParent<Player>();
OldDraws = DrawNCards.GetPickerDraws(player.playerID);
}
private void Update()
{
if ((Object)(object)player != (Object)null && DrawNCards.GetPickerDraws(player.playerID) != 1)
{
DrawNCards.SetPickerDraws(player.playerID, 1);
}
}
private void OnDestroy()
{
DrawNCards.SetPickerDraws(player.playerID, OldDraws);
}
}
internal class RoundDeath : MonoBehaviour
{
public void Start()
{
GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)Kill);
}
public void OnDestroy()
{
GameModeManager.RemoveHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)Kill);
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
private IEnumerator Kill(IGameModeHandler gm)
{
GameModeManager.AddOnceHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)Die);
yield break;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
private IEnumerator Die(IGameModeHandler gm)
{
((Component)this).GetComponentInParent<Player>().data.view.RPC("RPCA_Die", (RpcTarget)0, (object[])(object)new Object[1] { (object)new Vector2(0f, 1f) });
yield break;
}
}
public class RoundLoss : MonoBehaviour
{
public int cost;
private void Start()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
GameModeManager.CurrentHandler.SetTeamScore(((Component)this).GetComponentInParent<Player>().teamID, new TeamScore(0, GameModeManager.CurrentHandler.GetTeamScore(((Component)this).GetComponentInParent<Player>().teamID).rounds - cost));
}
private void OnDestroy()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
GameModeManager.CurrentHandler.SetTeamScore(((Component)this).GetComponentInParent<Player>().teamID, new TeamScore(0, GameModeManager.CurrentHandler.GetTeamScore(((Component)this).GetComponentInParent<Player>().teamID).rounds + cost));
}
}
public class Trade : OnAddEffect
{
[CompilerGenerated]
private sealed class <>c__DisplayClass1_0 : Object
{
public Player player;
public CardInfo card;
public IEnumerable<CardInfo> cards;
internal bool <TradeCard>b__0()
{
if ((Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)card)
{
return (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards) != (Object)(object)CardList.GetCardInfo("Genie_Traded");
}
return false;
}
internal bool <TradeCard>b__1(CardInfo c)
{
if (c.cardName != "Genie" && c.cardName != Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)player.data.currentCards).cardName)
{
return !Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, CustomCardCategories.instance.CardCategory("GenieOutcome"));
}
return false;
}
internal bool <TradeCard>b__2(CardInfo cardi)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return RarityUtils.GetRarityData(cardi.rarity).relativeRarity == Enumerable.Min<CardInfo>(cards, (Func<CardInfo, float>)((CardInfo c) => RarityUtils.GetRarityData(c.rarity).relativeRarity));
}
}
public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
((MonoBehaviour)Core.instance).StartCoroutine(TradeCard(player));
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public static IEnumerator TradeCard(Player player)
{
<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
CS$<>8__locals0.player = player;
CS$<>8__locals0.card = Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards);
yield return new WaitUntil((Func<bool>)(() => (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CS$<>8__locals0.card && (Object)(object)Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards) != (Object)(object)CardList.GetCardInfo("Genie_Traded")));
for (int _ = 0; _ < 60; _++)
{
yield return null;
}
CS$<>8__locals0.cards = Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards, (Func<CardInfo, bool>)((CardInfo c) => c.cardName != "Genie" && c.cardName != Enumerable.Last<CardInfo>((IEnumerable<CardInfo>)(object)CS$<>8__locals0.player.data.currentCards).cardName && !Enumerable.Contains<CardCategory>((IEnumerable<CardCategory>)(object)c.categories, CustomCardCategories.instance.CardCategory("GenieOutcome"))));
CardInfo[] array = Enumerable.ToArray<CardInfo>(Enumerable.Where<CardInfo>(CS$<>8__locals0.cards, (Func<CardInfo, bool>)((CardInfo cardi) => RarityUtils.GetRarityData(cardi.rarity).relativeRarity == Enumerable.Min<CardInfo>(CS$<>8__locals0.cards, (Func<CardInfo, float>)((CardInfo c) => RarityUtils.GetRarityData(c.rarity).relativeRarity)))));
CardInfo val = array[Random.Range(0, Enumerable.Count<CardInfo>((IEnumerable<CardInfo>)(object)array))];
Cards.instance.RemoveCardFromPlayer(CS$<>8__locals0.player, val, (SelectionType)0, true);
}
}
}
namespace Genie.Patches
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class BlockNoBlockPatch : MonoBehaviour
{
[HarmonyPrefix]
[HarmonyPatch("RPCA_DoBlock")]
public static bool norpca(Block __instance)
{
return (Object)(object)((Component)__instance).GetComponentInChildren<NoBlock>() == (Object)null;
}
[HarmonyPrefix]
[HarmonyPatch("TryBlock")]
public static bool notry(Block __instance)
{
return (Object)(object)((Component)__instance).GetComponentInChildren<NoBlock>() == (Object)null;
}
[HarmonyPrefix]
[HarmonyPatch("DoBlock")]
public static bool nodo(Block __instance)
{
return (Object)(object)((Component)__instance).GetComponentInChildren<NoBlock>() == (Object)null;
}
[HarmonyPostfix]
[HarmonyPatch("IsBlocking")]
public static void IsBlocking(Block __instance, ref bool __result)
{
__result = __result && (Object)(object)((Component)__instance).GetComponentInChildren<NoBlock>() == (Object)null;
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class CardSpawnPatch : Object
{
[CompilerGenerated]
private sealed class <>c__DisplayClass0_0 : Object
{
public GameObject old;
internal void <Postfix>b__0()
{
PhotonNetwork.Destroy(old);
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass0_1 : Object
{
public GameObject old;
internal void <Postfix>b__1()
{
PhotonNetwork.Destroy(old);
}
}
private static void Postfix(List<GameObject> ___spawnedCards, Transform[] ___children, int ___pickrID, ref GameObject __result)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Expected O, but got Unknown
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
Player playerWithID = GetPlayerWithID(___pickrID);
if ((Object)(object)playerWithID != (Object)null && ___spawnedCards.Count == 0 && (Object)(object)CharacterStatModifiersExtension.GetRootData(playerWithID).perpetualCard != (Object)null)
{
<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
CS$<>8__locals0.old = __result;
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Core.instance, 3, (Action)delegate
{
PhotonNetwork.Destroy(CS$<>8__locals0.old);
});
__result = PhotonNetwork.Instantiate(((Object)CharacterStatModifiersExtension.GetRootData(playerWithID).perpetualCard).name, __result.transform.position, __result.transform.rotation, (byte)0, (object[])null);
}
if ((Object)(object)playerWithID != (Object)null && ___spawnedCards.Count == ___children.Length - 1 && (Object)(object)CharacterStatModifiersExtension.GetRootData(playerWithID).DelayedCard != (Object)null)
{
<>c__DisplayClass0_1 CS$<>8__locals1 = new <>c__DisplayClass0_1();
CS$<>8__locals1.old = __result;
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Core.instance, 3, (Action)delegate
{
PhotonNetwork.Destroy(CS$<>8__locals1.old);
});
__result = PhotonNetwork.Instantiate(((Object)CharacterStatModifiersExtension.GetRootData(playerWithID).DelayedCard).name, __result.transform.position, __result.transform.rotation, (byte)0, (object[])null);
CharacterStatModifiersExtension.GetRootData(playerWithID).DelayedCard = null;
}
}
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;
}
}
[HarmonyPatch]
public class EternityPatch : Object
{
[CompilerGenerated]
private sealed class <>c__DisplayClass0_0 : Object
{
public ApplyCardStats __instance;
internal void <PickCardOffline>b__1(Player player)
{
Debug.Log((object)CharacterStatModifiersExtension.GetRootData(player).lockedCard);
if ((Object)(object)CharacterStatModifiersExtension.GetRootData(player).lockedCard != (Object)null && (Object)(object)CharacterStatModifiersExtension.GetRootData(player).lockedCard != (Object)(object)((Component)__instance).GetComponent<CardInfo>().sourceCard)
{
Cards.instance.AddCardToPlayer(player, CharacterStatModifiersExtension.GetRootData(player).lockedCard, false, "", 0f, 0f, true);
}
else
{
Cards.instance.AddCardToPlayer(player, ((Component)__instance).GetComponent<CardInfo>().sourceCard, false, "", 0f, 0f, true);
}
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass1_0 : Object
{
public ApplyCardStats __instance;
internal void <PickCard>b__1(Player player)
{
Debug.Log((object)CharacterStatModifiersExtension.GetRootData(player).lockedCard);
if ((Object)(object)CharacterStatModifiersExtension.GetRootData(player).lockedCard != (Object)null && (Object)(object)CharacterStatModifiersExtension.GetRootData(player).lockedCard != (Object)(object)((Component)__instance).GetComponent<CardInfo>().sourceCard)
{
Cards.instance.AddCardToPlayer(player, CharacterStatModifiersExtension.GetRootData(player).lockedCard, false, "", 0f, 0f, true);
}
else
{
Cards.instance.AddCardToPlayer(player, ((Component)__instance).GetComponent<CardInfo>().sourceCard, false, "", 0f, 0f, true);
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPrefix]
public static bool PickCardOffline(ApplyCardStats __instance, Player[] players)
{
<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
CS$<>8__locals0.__instance = __instance;
List<Player> val = Enumerable.ToList<Player>((IEnumerable<Player>)(object)players);
if (Enumerable.Any<Player>((IEnumerable<Player>)(object)val, (Func<Player, bool>)((Player p) => (Object)(object)CharacterStatModifiersExtension.GetRootData(p).lockedCard != (Object)null)))
{
val.ForEach((Action<Player>)delegate(Player player)
{
Debug.Log((object)CharacterStatModifiersExtension.GetRootData(player).lockedCard);
if ((Object)(object)CharacterStatModifiersExtension.GetRootData(player).lockedCard != (Object)null && (Object)(object)CharacterStatModifiersExtension.GetRootData(player).lockedCard != (Object)(object)((Component)CS$<>8__locals0.__instance).GetComponent<CardInfo>().sourceCard)
{
Cards.instance.AddCardToPlayer(player, CharacterStatModifiersExtension.GetRootData(player).lockedCard, false, "", 0f, 0f, true);
}
else
{
Cards.instance.AddCardToPlayer(player, ((Component)CS$<>8__locals0.__instance).GetComponent<CardInfo>().sourceCard, false, "", 0f, 0f, true);
}
});
return false;
}
return true;
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPrefix]
public static bool PickCard(ApplyCardStats __instance, int[] actorIDs)
{
<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
CS$<>8__locals0.__instance = __instance;
List<Player> val = Enumerable.ToList<Player>(Enumerable.Select<int, Player>((IEnumerable<int>)(object)actorIDs, (Func<int, Player>)PlayerManager.instance.GetPlayerWithActorID));
if (Enumerable.Any<Player>((IEnumerable<Player>)(object)val, (Func<Player, bool>)((Player p) => (Object)(object)CharacterStatModifiersExtension.GetRootData(p).lockedCard != (Object)null)))
{
val.ForEach((Action<Player>)delegate(Player player)
{
Debug.Log((object)CharacterStatModifiersExtension.GetRootData(player).lockedCard);
if ((Object)(object)CharacterStatModifiersExtension.GetRootData(player).lockedCard != (Object)null && (Object)(object)CharacterStatModifiersExtension.GetRootData(player).lockedCard != (Object)(object)((Component)CS$<>8__locals0.__instance).GetComponent<CardInfo>().sourceCard)
{
Cards.instance.AddCardToPlayer(player, CharacterStatModifiersExtension.GetRootData(player).lockedCard, false, "", 0f, 0f, true);
}
else
{
Cards.instance.AddCardToPlayer(player, ((Component)CS$<>8__locals0.__instance).GetComponent<CardInfo>().sourceCard, false, "", 0f, 0f, true);
}
});
return false;
}
return true;
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPrefix]
public static void Add(Player player, ref CardInfo card)
{
if ((Object)(object)CharacterStatModifiersExtension.GetRootData(player).lockedCard != (Object)null)
{
card = CharacterStatModifiersExtension.GetRootData(player).lockedCard;
}
}
}
}