Decompiled source of GarysCards v2.0.1

GarysCards.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.Utils;
using UnboundLib.Cards;
using UnityEngine;

[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: AssemblyVersion("0.0.0.0")]
[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;
		}
	}
}
public class CardHolder : MonoBehaviour
{
	public List<GameObject> Cards;

	public List<GameObject> HiddenCards;

	internal void RegisterCards()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: 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)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		Enumerator<GameObject> enumerator = Cards.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				GameObject current = enumerator.Current;
				CustomCard.RegisterUnityCard(current, "GarysCards", current.GetComponent<CardInfo>().cardName, true, (Action<CardInfo>)null);
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
		Enumerator<GameObject> enumerator2 = HiddenCards.GetEnumerator();
		try
		{
			while (enumerator2.MoveNext())
			{
				GameObject current2 = enumerator2.Current;
				CustomCard.RegisterUnityCard(current2, "GarysCards", current2.GetComponent<CardInfo>().cardName, false, (Action<CardInfo>)null);
				Cards.instance.AddHiddenCard(current2.GetComponent<CardInfo>());
			}
		}
		finally
		{
			((IDisposable)enumerator2).Dispose();
		}
	}
}
public class CriticalMono : ReversibleEffect
{
	private readonly Color color = new Color(1f, 0.8f, 0f, 1f);

	private ReversibleColorEffect colorEffect;

	private readonly float updateDelay = 0.2f;

	private float startTime;

	private Patrick_Mono effect;

	public override void OnOnEnable()
	{
		if ((Object)(object)colorEffect != (Object)null)
		{
			((ColorEffect)colorEffect).Destroy();
		}
		if ((Object)(object)((Component)this).gameObject.transform.parent == (Object)null)
		{
			ResetTimer();
			((ReversibleEffect)this).Destroy();
		}
	}

	public override void OnStart()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		effect = ((Component)base.player).GetComponent<Patrick_Mono>();
		colorEffect = ((Component)base.player).gameObject.AddComponent<ReversibleColorEffect>();
		((ColorEffect)colorEffect).SetColor(color);
		colorEffect.SetLivesToEffect(1);
		ResetTimer();
		GameObject addObjectToPlayer = ((GameObject)Resources.Load("0 cards/Empower")).GetComponent<CharacterStatModifiers>().AddObjectToPlayer;
		if ((Object)(object)((Component)this).gameObject.transform.parent == (Object)null)
		{
			ResetTimer();
			((ReversibleEffect)this).Destroy();
		}
	}

	public override void OnUpdate()
	{
		if (Time.time >= startTime + updateDelay)
		{
			ResetTimer();
			((ReversibleEffect)this).Destroy();
		}
		if (((Component)this).GetComponent<Player>().data.dead || ((Component)this).GetComponent<Player>().data.health <= 0f || !((Component)((Component)this).GetComponent<Player>()).gameObject.activeInHierarchy)
		{
			ResetTimer();
			((ReversibleEffect)this).Destroy();
		}
	}

	public override void OnOnDisable()
	{
		if ((Object)(object)colorEffect != (Object)null)
		{
			((ColorEffect)colorEffect).Destroy();
		}
		if ((Object)(object)((Component)this).gameObject.transform.parent == (Object)null)
		{
			ResetTimer();
			((ReversibleEffect)this).Destroy();
		}
	}

	public override void OnOnDestroy()
	{
		if ((Object)(object)colorEffect != (Object)null)
		{
			((ColorEffect)colorEffect).Destroy();
			Object.Destroy((Object)(object)this);
		}
	}

	private void ResetTimer()
	{
		startTime = Time.time;
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("GarysCards", "GarysCards", "0.0.0")]
[BepInProcess("Rounds.exe")]
public class GarysCards : BaseUnityPlugin
{
	internal static AssetBundle assets;

	public const string ModId = "GarysCards";

	public const string ModName = "GarysCards";

	public const string Version = "0.0.0";

	public const string ModInitials = "BC";

	[field: CompilerGenerated]
	[field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
	public static GarysCards Instance
	{
		[CompilerGenerated]
		get;
		[CompilerGenerated]
		private set;
	}

	private void Awake()
	{
		Instance = this;
		AssetBundle val = AssetUtils.LoadAssetBundleFromResources("assets", typeof(GarysCards).Assembly);
		val.LoadAsset<GameObject>("ModCards").GetComponent<CardHolder>().RegisterCards();
	}

	private void Start()
	{
		Instance = this;
	}
}
public class Patrick_Mono : MonoBehaviour
{
	public enum TargetPlayer : Enum
	{
		OtherPlayer,
		Self
	}

	public TargetPlayer targetPlayer;

	public float shrinkScale = 0.5f;

	private Player target;

	private void Start()
	{
	}

	public void Go()
	{
		if (!Object.op_Implicit((Object)(object)target))
		{
			target = ((Component)this).GetComponentInParent<Player>();
			if (targetPlayer == TargetPlayer.OtherPlayer)
			{
				target = PlayerManager.instance.GetOtherPlayer(target);
			}
		}
		if (Object.op_Implicit((Object)(object)target))
		{
			target.data.stats.sizeMultiplier = shrinkScale;
		}
	}
}