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;
using ExitGames.Client.Photon;
using HarmonyLib;
using InControl;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using Photon.Pun;
using Photon.Realtime;
using RWF;
using RarityBundle;
using Rarity_Bundle;
using RootCore;
using RootCore.CardConditions;
using UnboundLib;
using UnboundLib.Extensions;
using UnboundLib.GameModes;
using UnityEngine;
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 RootCurses
{
public class Tempted : OnAddEffect
{
public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
CardInfo val = player.data.currentCards.Find((Predicate<CardInfo>)((CardInfo c) => c.rarity == RarityBundle.Unique));
if ((Object)(object)val != (Object)null)
{
Cards.instance.ReplaceCard(player, val, (CardInfo)(object)CardList.GetCardInfo("Forbidden_Knowledge"), "", 0f, 0f, (SelectionType)0, true);
CardBarUtils.instance.ShowAtEndOfPhase(player, val);
CardBarUtils.instance.ShowAtEndOfPhase(player, (CardInfo)(object)CardList.GetCardInfo("Forbidden_Knowledge"));
}
else
{
UtilityExtenions.GiveCard(player, "Forbidden_Knowledge");
}
}
}
}
namespace RootCurses.CardConditions
{
public class TemptConditin : CardCondition
{
public override bool IsPlayerAllowedCard(Player player)
{
return !UtilityExtenions.HasCard(player, "Forbidden_Knowledge");
}
}
}
namespace RootCurses.Effects
{
public class RainbowCard : MonoBehaviour
{
private CardVisuals visuals;
private List<CardThemeColor> cardThemeColors;
private Random random = new Random();
public void Start()
{
visuals = ((Component)this).GetComponentInChildren<CardVisuals>();
cardThemeColors = Enumerable.ToList<CardThemeColor>((IEnumerable<CardThemeColor>)(object)CardChoice.instance.cardThemes);
}
public void Update()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
Color color = ((Component)((Component)this).GetComponentInChildren<UniqueRarityColor>()).gameObject.GetComponent<CanvasRenderer>().GetColor();
if (visuals.isSelected)
{
visuals.defaultColor = color;
visuals.chillColor = visuals.defaultColor;
for (int i = 0; i < visuals.images.Length; i++)
{
((Graphic)visuals.images[i]).color = color;
}
((Graphic)visuals.nameText).color = visuals.defaultColor;
}
}
}
}
namespace RootBeta
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Systems.R00t.Unstable", "Root Cards BETA", "1.1.6")]
[BepInProcess("Rounds.exe")]
public class Main : BaseUnityPlugin
{
private const string ModId = "Systems.R00t.Unstable";
private const string ModName = "Root Cards BETA";
public const string Version = "1.1.6";
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("Systems.R00t.Unstable").PatchAll();
Core.RegesterCards(AssetUtils.LoadAssetBundleFromResources("betaassets", typeof(Main).Assembly).LoadAsset<GameObject>("Beta").GetComponent<CardList>(), true);
}
}
}
namespace RootStandardCards.Patches
{
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class CardChoicePatchStartPick : Object
{
public static void Prefix(CardChoice __instance, ref int picksToSet, int pickerIDToSet)
{
if (UtilityExtenions.HasCard(PlayerManager.instance.GetPlayerWithID(pickerIDToSet), "Omniscience"))
{
picksToSet += 2;
}
if (UtilityExtenions.HasCard(PlayerManager.instance.GetPlayerWithID(pickerIDToSet), "Leftovers"))
{
picksToSet = -999;
}
}
}
[HarmonyPriority(800)]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class EthralBullets : Object
{
public static bool Prefix(HitInfo hit, ProjectileHit __instance)
{
if (Object.op_Implicit((Object)(object)hit.transform) && UtilityExtenions.HasCard(__instance.ownPlayer, "Ethral"))
{
HealthHandler component = ((Component)hit.transform).GetComponent<HealthHandler>();
if ((Object)(object)component == (Object)null)
{
return false;
}
return component.player.teamID != __instance.ownPlayer.teamID;
}
return true;
}
}
}
namespace RootAdvancedCards
{
public class Mitosis : MonoBehaviour
{
public const string MitosisID = "MitosisPlayerSpawnInstance";
private LobbyCharacter player;
private Player Owner;
private void Awake()
{
Owner = ((Component)this).GetComponentInParent<Player>();
if (!Owner.data.view.IsMine)
{
Object.DestroyImmediate((Object)(object)this);
}
}
private void Start()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
InputDevice device = ((PlayerActionSet)Owner.data.playerActions).Device;
int count = PlayerManager.instance.players.Count;
Vector3 position = ((Component)Owner).transform.position;
CharacterData component = PhotonNetwork.Instantiate(((Object)PlayerAssigner.instance.playerPrefab).name, position, Quaternion.identity, (byte)0, (object[])(object)new Object[4]
{
(Object)"MitosisPlayerSpawnInstance",
(object)Owner.teamID,
(object)count,
(object)PlayerExtensions.colorID(Owner)
}).GetComponent<CharacterData>();
if (device != null)
{
component.input.inputType = (InputType)0;
component.playerActions = PlayerActions.CreateWithControllerBindings();
}
else
{
component.input.inputType = (InputType)1;
component.playerActions = PlayerActions.CreateWithKeyboardBindings();
}
((PlayerActionSet)component.playerActions).Device = device;
PlayerAssigner.instance.players.Add(component);
Player val = component.player;
PlayerManager.RegisterPlayer(val);
int num = (val.teamID = Owner.teamID);
val.playerID = count;
if (!PhotonNetwork.OfflineMode)
{
Hashtable customProperties = val.data.view.Owner.CustomProperties;
if (((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"PlayerID"))
{
customProperties[(object)"PlayerID"] = count;
}
else
{
((Dictionary<object, object>)(object)customProperties).Add((object)"PlayerID", (object)count);
}
if (((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"TeamID"))
{
customProperties[(object)"TeamID"] = num;
}
else
{
((Dictionary<object, object>)(object)customProperties).Add((object)"TeamID", (object)num);
}
val.data.view.Owner.SetCustomProperties(customProperties, (Hashtable)null, (WebFlags)null);
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class MitosisPlayerAssigner : Object
{
public static void Postfix()
{
ExtensionMethods.GetOrAddComponent<MitosisTracker>(PlayerAssigner.instance.playerPrefab, false);
}
}
public class MitosisTracker : MonoBehaviour, IPunInstantiateMagicCallback
{
public void OnPhotonInstantiate(PhotonMessageInfo info)
{
//IL_000a: 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_0085: Expected I4, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected I4, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected I4, but got Unknown
Debug.Log((object)"MitosisScriptRun");
object[] instantiationData = info.photonView.InstantiationData;
if (instantiationData != null && Enumerable.Count<object>((IEnumerable<object>)(object)instantiationData) == 4)
{
object obj = instantiationData[0];
string text = (string)((obj is String) ? obj : null);
if (text != null && text == "MitosisPlayerSpawnInstance")
{
Debug.Log((object)String.Format("[{0},{1},{2},{3}]", (object[])(object)new Object[4]
{
instantiationData[0],
instantiationData[1],
instantiationData[2],
instantiationData[3]
}));
Player component = ((Component)this).GetComponent<Player>();
component.teamID = (int)(Int32)instantiationData[1];
component.playerID = (int)(Int32)instantiationData[2];
PlayerExtensions.AssignColorID(component, (int)(Int32)instantiationData[3]);
PlayerManager.RegisterPlayer(component);
GameModeManager.AddOnceHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)cleanup, 800);
}
}
Debug.Log((object)"MitosisScriptRan");
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
private IEnumerator cleanup(IGameModeHandler _)
{
Player component = ((Component)this).GetComponent<Player>();
PlayerManager.instance.RemovePlayer(component);
yield break;
}
}
}
namespace RootAdvancedCards.CardConditions
{
public class MitosisCondion : CardCondition
{
public override bool IsPlayerAllowedCard(Player player)
{
return PlayerManager.instance.players.Count < 15;
}
}
}
namespace RootAdvancedCards.GunEffects
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class GunBulletinitPatchPortalGun : Object
{
[CompilerGenerated]
private sealed class <>c__DisplayClass2_0 : Object
{
public GameObject bullet;
internal void <Prefix>b__0()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
bullet.GetComponentInChildren<SpawnedAttack>().SetColor(Color.cyan);
}
}
public static Dictionary<Player, GameObject> Bulets = new Dictionary<Player, GameObject>();
public static Dictionary<Player, List<GameObject>> Bulet2 = new Dictionary<Player, List<GameObject>>();
public static void Prefix(Gun __instance, GameObject bullet)
{
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Expected O, but got Unknown
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: 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_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: 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_016d: 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_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0();
CS$<>8__locals0.bullet = bullet;
if (!Bulets.ContainsKey(__instance.player))
{
Bulets[__instance.player] = null;
}
if (!Bulet2.ContainsKey(__instance.player))
{
Bulet2[__instance.player] = new List<GameObject>();
}
if ((Object)(object)((Weapon)__instance).holdable == (Object)null)
{
return;
}
if ((Object)(object)__instance.player != (Object)null && UtilityExtenions.HasCard(__instance.player, "Unstable_Portal"))
{
GameObject val = Bulets[__instance.player];
if ((Object)(object)val != (Object)null)
{
Vector3 val2 = ((Component)MainCam.instance).GetComponent<Camera>().WorldToScreenPoint(val.transform.position);
val2.x /= Screen.width;
val2.y /= Screen.height;
((Vector3)(ref val2))..ctor(Mathf.Clamp(val2.x, 0f, 1f), Mathf.Clamp(val2.y, 0f, 1f), val2.z);
if (val2.x > 0f && val2.x < 1f && val2.y < 1f && val2.y > 0f)
{
Transform transform = CS$<>8__locals0.bullet.transform;
Vector3 position = val.transform.position;
Quaternion rotation = val.transform.rotation;
Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
transform.position = position - ((Vector3)(ref eulerAngles)).normalized * 0.3f;
}
val.GetComponentInChildren<SpawnedAttack>().SetColor(Color.red);
}
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Core.instance, 2, (Action)delegate
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
CS$<>8__locals0.bullet.GetComponentInChildren<SpawnedAttack>().SetColor(Color.cyan);
});
Bulets[__instance.player] = CS$<>8__locals0.bullet;
}
Bulet2[__instance.player].Add(CS$<>8__locals0.bullet);
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class PreventColition : Object
{
[HarmonyPriority(800)]
public static bool Prefix(ProjectileCollision __instance, ref float dmg)
{
ProjectileHit componentInParent = ((Component)__instance).GetComponentInParent<ProjectileHit>();
if (componentInParent != null && (Object)(object)componentInParent.ownPlayer != (Object)null && UtilityExtenions.HasCard(componentInParent.ownPlayer, "Unstable_Portal"))
{
dmg = 0f;
return false;
}
return true;
}
}
}
namespace RootAdvancedCards.Patches
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class ApplyCardStatsPatches : Object
{
[HarmonyPatch("RPCA_Pick")]
[HarmonyPrefix]
public static void RPCA_Pick(ref int[] actorIDs, ApplyCardStats __instance)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
List<int> val = Enumerable.ToList<int>((IEnumerable<int>)(object)actorIDs);
Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Player current = enumerator.Current;
if (UtilityExtenions.HasCard(current, "Manifest_Destiny") && !val.Contains(current.data.view.ControllerActorNr) && Enumerable.Contains<int>((IEnumerable<int>)(object)GameModeManager.CurrentHandler.GetRoundWinners(), current.teamID) && UtilityExtenions.IsAllowedCard(current, ((Component)__instance).GetComponent<CardInfo>()))
{
val.Add(current.data.view.ControllerActorNr);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
actorIDs = val.ToArray();
}
[HarmonyPatch("OFFLINE_Pick")]
[HarmonyPrefix]
public static void OFFLINE_Pick(ref Player[] players, ApplyCardStats __instance)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
List<Player> val = Enumerable.ToList<Player>((IEnumerable<Player>)(object)players);
Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Player current = enumerator.Current;
if (UtilityExtenions.HasCard(current, "Manifest_Destiny") && !val.Contains(current) && Enumerable.Contains<int>((IEnumerable<int>)(object)GameModeManager.CurrentHandler.GetRoundWinners(), current.teamID) && UtilityExtenions.IsAllowedCard(current, ((Component)__instance).GetComponent<CardInfo>()))
{
val.Add(current);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
players = val.ToArray();
}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class DamagePatch : Object
{
[HarmonyPatch("CallTakeDamage")]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch("DoDamage")]
[HarmonyPatch("TakeDamageOverTime")]
[HarmonyPriority(2147483647)]
private static void Prefix(HealthHandler __instance, ref Player damagingPlayer)
{
if ((Object)(object)damagingPlayer != (Object)null && UtilityExtenions.HasCard(__instance.player, "Sanitization"))
{
damagingPlayer = null;
}
}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class SharedPick : Object
{
public static int Picker = -1;
public static bool eaten = false;
public static bool eating = false;
public static bool Prefix(CardChoice __instance, GameObject pickedCard, int theInt, int pickId, ref IEnumerator __result)
{
Debug.Log((object)String.Format("{0} {1} {2}", (object)pickedCard, (object)theInt, (object)pickId));
if (Picker == pickId)
{
eaten = true;
}
if (!UtilityExtenions.HasCard(PlayerManager.instance.GetPlayerWithID(pickId), "Leftovers"))
{
Picker = pickId;
}
Debug.Log((object)String.Format("{0}", (object)Picker));
Debug.Log((object)String.Format("{0} {1} {2}", (object)eaten, (object)UtilityExtenions.HasCard(PlayerManager.instance.GetPlayerWithID(pickId), "Leftovers"), (object)(!Enumerable.Any<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player player) => UtilityExtenions.HasCard(player, "Leftovers"))))));
if (eaten || UtilityExtenions.HasCard(PlayerManager.instance.GetPlayerWithID(pickId), "Leftovers") || !Enumerable.Any<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player player) => UtilityExtenions.HasCard(player, "Leftovers"))))
{
__instance.pickrID = Picker;
Picker = -1;
eaten = false;
eating = false;
UIHandler.instance.StopShowPicker();
return true;
}
eating = true;
__result = SinglePick(__instance, pickedCard, theInt, pickId);
return false;
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPrefix]
public static void Reset(int pickerID)
{
if (eating && Picker != -1)
{
CardChoice.instance.pickrID = Picker;
Debug.Log((object)"Eaten!!");
eaten = true;
}
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public static IEnumerator SinglePick(CardChoice __instance, GameObject pickedCard, int theInt = 0, int pickId = -1)
{
Vector3 startPos = pickedCard.transform.position;
Vector3 endPos = ((Component)CardChoiceVisuals.instance).transform.position;
float c2 = 0f;
while (c2 < 1f)
{
CardChoiceVisuals.instance.framesToSnap = 1;
Vector3 position = Vector3.LerpUnclamped(startPos, endPos, __instance.curve.Evaluate(c2));
pickedCard.transform.position = position;
((Component)__instance).transform.GetChild(theInt).position = position;
c2 += Time.deltaTime * __instance.speed;
yield return null;
}
Vector3 val = startPos - endPos;
GamefeelManager.GameFeel(Vector2.op_Implicit(((Vector3)(ref val)).normalized * 2f));
pickedCard.GetComponentInChildren<CardVisuals>().Leave();
Player val2 = Enumerable.First<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player player) => UtilityExtenions.HasCard(player, "Leftovers")));
__instance.pickrID = val2.playerID;
for (int i = 0; i < __instance.spawnedCards.Count; i++)
{
if ((Object)(object)__instance.spawnedCards[i] == (Object)(object)pickedCard)
{
((Component)__instance).transform.GetChild(theInt).position = startPos;
if (val2.data.view.IsMine)
{
__instance.spawnedCards[i] = __instance.Spawn(((Component)CardChoiceSpawnUniqueCardPatch.NullCard).gameObject, __instance.children[i].position, __instance.children[i].rotation);
}
}
}
for (int j = 0; j < __instance.spawnedCards.Count; j++)
{
if (!UtilityExtenions.IsAllowedCard(val2, __instance.spawnedCards[j].GetComponentInChildren<CardInfo>()))
{
Object.Destroy((Object)(object)__instance.spawnedCards[j]);
if (val2.data.view.IsMine)
{
__instance.spawnedCards[j] = __instance.Spawn(((Component)CardChoiceSpawnUniqueCardPatch.NullCard).gameObject, __instance.children[j].position, __instance.children[j].rotation);
}
}
}
for (int k = 0; k < __instance.spawnedCards.Count; k++)
{
ExtensionMethods.GetOrAddComponent<PublicInt>(__instance.spawnedCards[k], false).theInt = k;
}
UIHandler.instance.ShowPicker(__instance.pickrID, __instance.pickerType);
}
}
}