Decompiled source of CatsCards v1.0.0

CatsCards.dll

Decompiled 2 weeks ago
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 BepInEx;
using CatsCards;
using HarmonyLib;
using InControl;
using Jotunn.Utils;
using Lightsaber.Extensions;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using PlayerActionsHelper;
using PlayerActionsHelper.Extensions;
using RarityLib.Utils;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.Extensions;
using UnboundLib.Networking;
using UnboundLib.Utils;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[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]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Lightsaber
{
	public static class Constants
	{
		public const string PlayerObjectCollider = "PlayerObjectCollider";

		public const string SwitchHoldable = "SwitchHoldable";

		public const string Lightsaber = "Lightsaber";

		public const string Damagable = "Damagable";

		public const string ModCards = "ModCards";

		public const string Spring = "Spring";

		public const string CardBase = "CardBase(Clone)";

		public const string AssetBundle = "assetbundle";

		public const string AmmoCanvas = "Ammo/Canvas";

		public const string ProcessName = "Rounds.exe";

		public const string CardChoiceSpawnUniqueCardPatch = "pykess.rounds.plugins.cardchoicespawnuniquecardpatch";

		public const string RarityBundle = "com.CrazyCoders.Rounds.RarityBundle";

		public const string ModdingUtils = "pykess.rounds.plugins.moddingutils";

		public const string ActionHelper = "com.rounds.willuwontu.ActionHelper";

		public const string UnboundLib = "com.willis.rounds.unbound";

		public const string CardThemeLib = "root.cardtheme.lib";

		public const string RarityLib = "root.rarity.lib";
	}
	public class LoadAsset : MonoBehaviour
	{
		public GameObject Object;

		public GameObject InstantiateObject(Transform transform)
		{
			Object = Instantiate(((Object)Object).name, transform);
			return Object;
		}

		private static GameObject Instantiate(string ObjectName, Transform transform)
		{
			GameObject obj = Object.Instantiate<GameObject>(global::CatsCards.CatsCards.assets.LoadAsset<GameObject>(ObjectName), transform);
			((Object)obj).name = ObjectName;
			return obj;
		}
	}
	public class A_HoldableHandler : MonoBehaviour
	{
		internal Player Player;

		internal ObjectSlash ObjectSlash;

		internal ObjectMirror ObjectMirror;

		internal ObjectCollider ObjectCollider;

		internal BladeColor BladeColor;

		internal GameObject Weapon;

		internal GameObject Blade;

		internal GameObject Collider;

		public A_HoldableHandler Initialize(A_HoldableObject HoldableObject, Player player, string WeaponName = "BackupInit")
		{
			if (HoldableObject.Weapon == null || (Object)(object)HoldableObject.Weapon == (Object)null)
			{
				HoldableObject.Weapon = Object.Instantiate<GameObject>(global::CatsCards.CatsCards.assets.LoadAsset<GameObject>(WeaponName), player.GetSpring().transform);
				((Object)HoldableObject.Weapon.gameObject).name = WeaponName;
			}
			Player = player;
			Weapon = HoldableObject.Weapon;
			Blade = ((Component)Weapon.transform.Find("Blade")).gameObject;
			Collider = ((Component)Blade.transform.Find("Collider")).gameObject;
			ObjectMirror = ExtensionMethods.GetOrAddComponent<ObjectMirror>(Weapon, false);
			ObjectSlash = ExtensionMethods.GetOrAddComponent<ObjectSlash>(Weapon, false).Initialize(Player);
			ObjectCollider = ExtensionMethods.GetOrAddComponent<ObjectCollider>(Collider.gameObject, false).IgnoreCollisions(ObjectSlash);
			ObjectSlash.Collider = ObjectCollider;
			ObjectSlash.Mirror = ObjectMirror;
			BladeColor = ExtensionMethods.GetOrAddComponent<BladeColor>(Blade.gameObject, false).Initialize(player.playerID);
			ObjectSlash.holdableObject = HoldableObject;
			ObjectMirror.holdableObject = HoldableObject;
			ObjectCollider.holdableObject = HoldableObject;
			BladeColor.holdableObject = HoldableObject;
			return this;
		}
	}
	public class A_HoldableObject : MonoBehaviour
	{
		public UnityEvent TriggerVFX;

		public LoadAsset asset;

		internal A_HoldableHandler Handler;

		internal GameObject Weapon;

		private Player Player;

		private const float Volume = 1f;

		internal const float SwitchDelay = 0.25f;

		private float StabTimer;

		private bool wasOut;

		internal float SwitchTimer { get; private set; }

		internal bool IsOut { get; private set; }

		private void Start()
		{
			IsOut = false;
			StabTimer = 0f;
			SwitchTimer = 0f;
			Player = ((Component)this).GetComponentInParent<Player>();
			Weapon = asset.InstantiateObject(Player.GetSpring().transform);
			Handler = ExtensionMethods.GetOrAddComponent<A_HoldableHandler>(((Component)this).gameObject, false).Initialize(this, Player, "Lightsaber");
		}

		private void OnDisable()
		{
			if (Player != null && Player.data.view.IsMine && IsOut && !wasOut)
			{
				IsOut = false;
				wasOut = true;
				NetworkingManager.RPC(typeof(A_HoldableObject), "RPCA_Switch_To_Holdable", new object[2] { Player.playerID, false });
			}
		}

		private void OnEnable()
		{
			if (Player != null && Player.data.view.IsMine && !IsOut && wasOut)
			{
				IsOut = true;
				wasOut = false;
				NetworkingManager.RPC(typeof(A_HoldableObject), "RPCA_Switch_To_Holdable", new object[2] { Player.playerID, true });
			}
		}

		private void Update()
		{
			if (Player == null || (!Player.data.view.IsMine && Player.data.dead))
			{
				return;
			}
			StabTimer -= TimeHandler.deltaTime;
			SwitchTimer -= TimeHandler.deltaTime;
			if (SwitchTimer <= 0f && PlayerActionsExtension.ActionWasPressed(Player.data.playerActions, "SwitchHoldable"))
			{
				SwitchTimer = (IsOut ? 0f : 0.25f);
				IsOut = !IsOut;
				if (IsOut)
				{
					TriggerVFX.Invoke();
				}
				NetworkingManager.RPC(typeof(A_HoldableObject), "RPCA_Switch_To_Holdable", new object[2] { Player.playerID, IsOut });
			}
		}

		[UnboundRPC]
		internal static void RPCA_Switch_To_Holdable(int stabbingPlayerID, bool holdableObj)
		{
			MakeGunHoldable(stabbingPlayerID, holdableObj);
		}

		private static void MoveToHide(Transform transform, bool hide)
		{
			//IL_0002: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, hide ? (-10000f) : 0f);
		}

		internal static void MakeGunHoldable(int playerID, bool holdableObj)
		{
			Player playerWithID = PlayerManager.instance.GetPlayerWithID(playerID);
			if (playerWithID != null)
			{
				((Component)((Component)playerWithID).GetComponentInChildren<A_HoldableObject>()).gameObject.GetComponent<A_HoldableHandler>().Weapon.SetActive(holdableObj);
				GameObject spring = playerWithID.GetSpring();
				MoveToHide(spring.transform.Find("Ammo/Canvas"), holdableObj);
				MoveToHide(spring.transform.GetChild(2), holdableObj);
				MoveToHide(spring.transform.GetChild(3), holdableObj);
				((Behaviour)((Component)spring.transform.GetChild(2)).GetComponent<RightLeftMirrorSpring>()).enabled = !holdableObj;
				((Behaviour)((Component)spring.transform.GetChild(3)).GetComponent<RightLeftMirrorSpring>()).enabled = !holdableObj;
				playerWithID.GetGun().GetData().disabled = holdableObj;
			}
		}

		private void OnDestroy()
		{
			if (Player != null)
			{
				RPCA_Switch_To_Holdable(Player.playerID, holdableObj: false);
				Transform obj = Player.GetSpring().transform.Find("Lightsaber");
				Object.Destroy((Object)(object)((obj != null) ? ((Component)obj).gameObject : null));
				Object.Destroy((Object)(object)Weapon);
			}
		}
	}
	internal class BladeColor : MonoBehaviour
	{
		internal A_HoldableObject holdableObject;

		private static SpriteRenderer render;

		private static PlayerSkin skin;

		private static Player player;

		private static Color color;

		internal BladeColor Initialize(int playerID)
		{
			//IL_0029: 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)
			player = PlayerManager.instance.GetPlayerWithID(playerID);
			skin = ExtraPlayerSkins.GetPlayerSkinColors(PlayerExtensions.colorID(player));
			color = skin.color;
			render = ((Component)this).gameObject.GetComponent<SpriteRenderer>();
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Unbound.Instance, 10, (Action)UpdateBladeColor);
			return this;
		}

		public static void UpdateBladeColor()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			RPCA_UpdateBladeColor(color);
		}

		[UnboundRPC]
		private static void RPCA_UpdateBladeColor(Color color)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			render.color = color;
		}
	}
	public class ObjectCollider : MonoBehaviour
	{
		internal A_HoldableObject holdableObject;

		internal ObjectSlash ObjectSlash;

		internal Collider2D collider;

		internal ObjectCollider IgnoreCollisions(ObjectSlash objectSlash)
		{
			((Component)this).gameObject.layer = LayerMask.NameToLayer("PlayerObjectCollider");
			collider = ((Component)this).GetComponent<Collider2D>();
			collider.attachedRigidbody.mass = 500f;
			collider.isTrigger = false;
			ObjectSlash = objectSlash;
			Collider2D[] componentsInChildren = ((Component)ObjectSlash.Player).GetComponentsInChildren<Collider2D>();
			foreach (Collider2D val in componentsInChildren)
			{
				Physics2D.IgnoreCollision(collider, val);
			}
			IgnoreLayerCollision();
			return this;
		}

		public static void IgnoreLayerCollision()
		{
			Physics2D.IgnoreLayerCollision(LayerMask.NameToLayer("PlayerObjectCollider"), LayerMask.NameToLayer("Player"));
		}

		private void OnCollider(Collider2D collider2D)
		{
			ObjectSlash?.TrySlash(collider2D);
		}

		private void OnCollision(Collision2D collision2D)
		{
			ObjectSlash?.TrySlash(collision2D);
		}

		private void OnTriggerEnter2D(Collider2D collider2D)
		{
			OnCollider(collider2D);
		}

		private void OnTriggerStay2D(Collider2D collider2D)
		{
			OnCollider(collider2D);
		}

		private void OnCollisionEnter2D(Collision2D collision)
		{
			OnCollision(collision);
		}

		private void OnCollisionStay2D(Collision2D collision)
		{
			OnCollision(collision);
		}
	}
	public class ObjectMirror : MonoBehaviour
	{
		internal A_HoldableObject holdableObject;

		private Holdable holdable;

		private static readonly Vector3 LeftPos = new Vector3(0.1f, 1.95f, 0f);

		private static readonly Vector3 RightPos = new Vector3(0.4f, 1.95f, 0f);

		private static readonly Vector3 LeftScale = new Vector3(-1f, 1f, 1f);

		private static readonly Vector3 RightScale = new Vector3(-1f, -1f, 1f);

		internal Vector3 positionMod = Vector3.zero;

		private const float LeftRot = 300f;

		private const float RightRot = 225f;

		internal float rotMod;

		private void Start()
		{
			holdable = ((Component)((Component)this).transform.root).GetComponent<Holdable>();
		}

		private void Update()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			if (holdable != null && holdable.holder != null)
			{
				bool flag = ((Component)this).transform.root.position.x - 0.1f < ((Component)holdable.holder).transform.position.x;
				((Component)this).transform.localScale = (flag ? LeftScale : RightScale);
				float num = (flag ? 300f : 225f) + rotMod * (flag ? (-1f) : 1f);
				((Component)this).transform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, num));
				Vector3 localPosition = (flag ? LeftPos : RightPos) + new Vector3(positionMod.x * (flag ? (-1f) : 1f), positionMod.y, positionMod.z);
				((Component)this).transform.localPosition = localPosition;
			}
		}
	}
	public class ObjectSlash : MonoBehaviour
	{
		internal A_HoldableObject holdableObject;

		internal GameObject OnHitEffect;

		private const float slashAnimationDuration = 0.25f;

		private const float slashCooldown = 0.3f;

		private float sinceSlash = 0.3f;

		private bool canDoDamage;

		private bool isSlashing;

		private Holdable Holdable;

		internal Player Player;

		internal ObjectCollider Collider;

		internal ObjectMirror Mirror;

		private GeneralInput Input;

		private static readonly AnimationCurve[] SlashCurves = (AnimationCurve[])(object)new AnimationCurve[3]
		{
			new AnimationCurve((Keyframe[])(object)new Keyframe[7]
			{
				new Keyframe(0f, 0f, 1f, 1f, 1f, 1f),
				new Keyframe(0.0625f, 0.1f, 1f, 1f, 1f, 1f),
				new Keyframe(0.25f, 0.35f, 2f, 2f, 1f, 1f),
				new Keyframe(2f / 3f, 0f, 1f, 1f, 1f, 1f),
				new Keyframe(5f / 6f, -0.2f, 1f, 1f, 1f, 1f),
				new Keyframe(0.875f, -0.1f, 1f, 1f, 1f, 1f),
				new Keyframe(1f, 0f, 1f, 1f, 1f, 1f)
			}),
			new AnimationCurve((Keyframe[])(object)new Keyframe[7]
			{
				new Keyframe(0f, 0f, 1f, 1f, 1f, 1f),
				new Keyframe(0.0625f, -0.15f, 1f, 1f, 1f, 1f),
				new Keyframe(0.25f, 0.2f, 1f, 1f, 1f, 1f),
				new Keyframe(2f / 3f, 0.4f, 1f, 1f, 1f, 1f),
				new Keyframe(5f / 6f, 0.25f, 1f, 1f, 1f, 1f),
				new Keyframe(0.875f, -0.05f, 1f, 1f, 1f, 1f),
				new Keyframe(1f, 0f, 1f, 1f, 1f, 1f)
			}),
			new AnimationCurve((Keyframe[])(object)new Keyframe[7]
			{
				new Keyframe(0f, 0f, 1f, 1f, 1f, 1f),
				new Keyframe(0.0625f, 5f, 1f, 1f, 1f, 1f),
				new Keyframe(0.25f, 40f, 1f, 1f, 1f, 1f),
				new Keyframe(2f / 3f, 0f, 1f, 1f, 1f, 1f),
				new Keyframe(5f / 6f, -20f, 1f, 1f, 1f, 1f),
				new Keyframe(0.875f, -10f, 1f, 1f, 1f, 1f),
				new Keyframe(1f, 0f, 1f, 1f, 1f, 1f)
			})
		};

		private List<Collider2D> HitColliders = new List<Collider2D>();

		private List<Player> HitPlayers = new List<Player>();

		private const float slashForceMultiplier = 1500f;

		private const float nonSlashForceMultiplier = 500f;

		internal ObjectSlash Initialize(Player player, GameObject OnHitEffect = null)
		{
			Holdable = ((Component)((Component)this).transform.root).GetComponent<Holdable>();
			Player = player;
			Input = Player.data.input;
			isSlashing = false;
			this.OnHitEffect = OnHitEffect;
			return this;
		}

		private void DoSlash()
		{
			if (holdableObject.IsOut)
			{
				sinceSlash = 0f;
				canDoDamage = true;
				DoSlashAnimation();
				if (Player.data.view.IsMine)
				{
					NetworkingManager.RPC_Others(typeof(ObjectSlash), "RPCA_DoSlashAnimation", new object[1] { Player.playerID });
				}
			}
		}

		[UnboundRPC]
		private static void RPCA_DoSlashAnimation(int playerID)
		{
			Player playerWithID = PlayerManager.instance.GetPlayerWithID(playerID);
			if (playerWithID != null)
			{
				((Component)((Component)playerWithID.GetGun()).transform.GetChild(1).Find("Lightsaber")).GetComponent<ObjectSlash>().DoSlashAnimation();
			}
		}

		internal void DoSlashAnimation()
		{
			((MonoBehaviour)this).StartCoroutine(IDoSlashAnimation());
		}

		private IEnumerator IDoSlashAnimation()
		{
			isSlashing = true;
			HitPlayers = new List<Player>();
			if ((Object)(object)Holdable == (Object)null)
			{
				Holdable = ((Component)((Component)this).transform.root).GetComponent<Holdable>();
			}
			float deltaTime = 0f;
			float num = Mathf.Clamp(deltaTime / 0.25f, 0f, 1f);
			Mirror.rotMod = SlashCurves[2].Evaluate(num);
			Vector3 val = default(Vector3);
			while (deltaTime < 0.25f)
			{
				yield return null;
				deltaTime += TimeHandler.deltaTime;
				num = Mathf.Clamp(deltaTime / 0.25f, 0f, 1f);
				bool flag = ((Component)this).transform.root.position.x - 0.1f < ((Component)Holdable.holder).transform.position.x;
				((Component)this).transform.root.position = Player.data.hand.position;
				((Vector3)(ref val))..ctor(SlashCurves[1].Evaluate(num), SlashCurves[0].Evaluate(num) * (flag ? (-1f) : 1f), 0f);
				Vector2 val2 = Vector2.op_Implicit(((Vector3)(ref Player.data.aimDirection)).normalized);
				Vector2 val3 = Vector2.op_Implicit(((Vector3)(ref val)).normalized);
				Transform root = ((Component)this).transform.root;
				root.position += Quaternion.Euler(0f, 0f, Vector2.Angle(val2, val3)) * val;
				Mirror.rotMod = SlashCurves[2].Evaluate(num);
			}
			Mirror.rotMod = 0f;
			isSlashing = false;
		}

		private void Update()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			sinceSlash += TimeHandler.deltaTime;
			if (Player.data.view.IsMine)
			{
				if (!isSlashing)
				{
					((Component)this).transform.root.position = Player.data.hand.position;
				}
				if (holdableObject.IsOut && Input.shootWasPressed && !(holdableObject.SwitchTimer > 0f) && !(sinceSlash < 0.3f))
				{
					DoSlash();
				}
			}
		}

		internal void TrySlash(Collider2D collider2D)
		{
			if (Player.data.view.IsMine && canDoDamage && !((Object)(object)collider2D == (Object)null))
			{
				Player component = ((Component)collider2D).GetComponent<Player>();
				if (!((Object)(object)component == (Object)null) && !component.data.dead && component.playerID != Player.playerID)
				{
					canDoDamage = false;
					NetworkingManager.RPC(typeof(ObjectSlash), "RPCA_SlashPlayer", new object[2]
					{
						Player.playerID,
						((Component)collider2D).GetComponent<Player>().playerID
					});
				}
			}
		}

		internal void TrySlash(Collision2D collision)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: 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)
			Collider2D collider2D = collision.collider;
			if (!Player.data.view.IsMine || (Object)(object)collider2D == (Object)null || collision.contactCount <= 0 || HitColliders.Contains(collider2D))
			{
				return;
			}
			HitColliders.Add(collider2D);
			ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)global::CatsCards.CatsCards.instance, 0.25f, (Action)delegate
			{
				HitColliders.Remove(collider2D);
			});
			Vector3 position = ((Component)this).gameObject.transform.position;
			if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponentInParent<Player>()))
			{
				if (((Component)collider2D).GetComponentInParent<Player>().playerID != Player.playerID)
				{
					Player componentInParent = ((Component)collider2D).GetComponentInParent<Player>();
					if (!HitPlayers.Contains(componentInParent))
					{
						HitPlayers.Add(componentInParent);
						HandlePlayer(componentInParent, collision);
					}
				}
			}
			else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponentInParent<ProjectileHit>()))
			{
				HandleBullet(((Component)collider2D).GetComponentInParent<ProjectileHit>(), collision);
			}
			else if ((Object)(object)collider2D.attachedRigidbody != (Object)null)
			{
				HandleBox(collider2D.attachedRigidbody, collision);
			}
			else if (isSlashing && Object.op_Implicit((Object)(object)((Component)((Component)collider2D).transform.root).GetComponentInChildren<Damagable>()))
			{
				((Component)((Component)collider2D).transform.root).GetComponentInChildren<Damagable>().CallTakeDamage(Vector2.up * 55f, Vector2.op_Implicit(position), (GameObject)null, Player, true);
			}
		}

		internal void HandlePlayer(Player target, Collision2D collision)
		{
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (isSlashing)
			{
				NetworkingManager.RPC(typeof(ObjectSlash), "RPCA_SlashPlayer", new object[2] { Player.playerID, target.playerID });
				Gun gun = Player.data.weaponHandler.gun;
				float num = (float)ExtensionMethods.GetFieldValue((object)target.data.playerVel, "mass") / 100f;
				float num2 = Mathf.Pow(gun.damage, 2f) * gun.knockback * Mathf.Clamp(num, 0f, 1f);
				target.data.healthHandler.CallTakeForce(num2 * ((ContactPoint2D)(ref collision.contacts[0])).point, (ForceMode2D)1, false, false, 0f);
			}
		}

		internal void HandleBox(Rigidbody2D box, Collision2D collision)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((Component)box).GetComponent<Damagable>()) && isSlashing)
			{
				Gun gun = Player.data.weaponHandler.gun;
				Damagable component = ((Component)box).GetComponent<Damagable>();
				Vector2 point = ((ContactPoint2D)(ref collision.contacts[0])).point;
				Vector3 position = ((Component)this).transform.position;
				Vector2 val = Vector2.op_Implicit(((Vector3)(ref position)).normalized);
				component.CallTakeDamage(55f * gun.damage * gun.bulletDamageMultiplier * (point - val), point, (GameObject)null, (Player)null, true);
			}
			ContactPoint2D[] array = (ContactPoint2D[])(object)new ContactPoint2D[collision.contactCount];
			int contacts = collision.GetContacts(array);
			for (int i = 0; i < contacts; i++)
			{
				box.AddForceAtPosition(Player.data.weaponHandler.gun.knockback * box.mass * -1f * ((ContactPoint2D)(ref array[i])).normal * (isSlashing ? 1500f : 500f) / (float)contacts, ((ContactPoint2D)(ref array[i])).point);
			}
		}

		internal void HandleBullet(ProjectileHit bullet, Collision2D collision)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Player.data.block.blocked(((Component)bullet).gameObject, ((Component)bullet).gameObject.transform.forward, collision.transform.position);
		}

		[UnboundRPC]
		private static void RPCA_SlashPlayer(int slashingPlayerID, int slashedPlayerID)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			if (slashedPlayerID == -1)
			{
				return;
			}
			Player playerWithID = PlayerManager.instance.GetPlayerWithID(slashingPlayerID);
			Player playerWithID2 = PlayerManager.instance.GetPlayerWithID(slashedPlayerID);
			if ((Object)(object)playerWithID2 == (Object)null || (Object)(object)playerWithID == (Object)null)
			{
				return;
			}
			Gun gun = playerWithID.GetGun();
			float damage = gun.damage;
			float bulletDamageMultiplier = gun.bulletDamageMultiplier;
			HealthHandler healthHandler = playerWithID2.data.healthHandler;
			Vector2 val = Vector2.op_Implicit(damage * bulletDamageMultiplier * 55f * gun.shootPosition.forward);
			Vector2 val2 = Vector2.op_Implicit(((Component)playerWithID2).transform.position);
			Color white = Color.white;
			Transform transform = ((Component)gun).transform;
			object obj;
			if (transform == null)
			{
				obj = null;
			}
			else
			{
				Transform child = transform.GetChild(1);
				if (child == null)
				{
					obj = null;
				}
				else
				{
					Transform obj2 = child.Find("Lightsaber");
					obj = ((obj2 != null) ? ((Component)obj2).gameObject : null);
				}
			}
			healthHandler.DoDamage(val, val2, white, (GameObject)obj, playerWithID, false, true, true);
		}
	}
}
namespace Lightsaber.Patches
{
	[HarmonyPatch(typeof(Gun))]
	internal class AttackPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Attack")]
		private static bool ToggleGun(Gun __instance)
		{
			return !__instance.GetData().disabled;
		}
	}
}
namespace Lightsaber.Extensions
{
	public static class GameObjectExtensions
	{
		public static T GetOrAddComponentInChildren<T>(this GameObject go) where T : Component
		{
			T val = go.GetComponentInChildren<T>();
			if ((Object)(object)val == (Object)null)
			{
				val = go.AddComponent<T>();
			}
			return val;
		}

		public static RightLeftMirrorSpring GetSpringMirror(this GameObject spring)
		{
			return ((Component)spring.transform.GetChild(2)).GetComponent<RightLeftMirrorSpring>();
		}
	}
	public class GunAdditionalData
	{
		public bool disabled;
	}
	public static class GunExtensions
	{
		private static readonly ConditionalWeakTable<Gun, GunAdditionalData> additionalData = new ConditionalWeakTable<Gun, GunAdditionalData>();

		public static GunAdditionalData GetData(this Gun instance)
		{
			return additionalData.GetOrCreateValue(instance);
		}

		public static void DisableGun(this Gun instance)
		{
			instance.GetData().disabled = true;
		}

		public static void EnableGun(this Gun instance)
		{
			instance.GetData().disabled = false;
		}

		public static GameObject GetSpring(this Gun gun)
		{
			return ((Component)((Component)gun).transform.Find("Spring")).gameObject;
		}

		public static RightLeftMirrorSpring GetSpringMirror(this Gun gun)
		{
			return gun.GetSpring().GetSpringMirror();
		}
	}
	public static class PlayerExtensions
	{
		public static Gun GetGun(this Player player)
		{
			if (player == null)
			{
				return null;
			}
			return ((Component)((Component)player).GetComponent<Holding>().holdable).GetComponent<Gun>();
		}

		public static GameObject GetSpring(this Player player)
		{
			return player.GetGun().GetSpring();
		}
	}
	public static class PlayerManagerExtensions
	{
		public static Player GetPlayerWithID(this PlayerManager instance, int playerID)
		{
			return ((IEnumerable<Player>)instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == playerID));
		}

		public static void ForEachPlayer(this PlayerManager instance, Action<Player> action)
		{
			foreach (Player player in instance.players)
			{
				action(player);
			}
		}

		public static RightLeftMirrorSpring GetSpringMirror(this Player player)
		{
			return player.GetGun().GetSpringMirror();
		}
	}
}
namespace CatsCards
{
	internal class RarityAdder : MonoBehaviour
	{
		public Rarity rarity = Rarity.Common;

		private void Start()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).GetComponent<CardInfo>().rarity = RarityUtils.GetRarity($"{rarity}");
		}
	}
	public enum Rarity
	{
		Trinket,
		Common,
		Scarce,
		Uncommon,
		Exotic,
		Rare,
		Epic,
		Legendary,
		Mythical,
		Divine
	}
	public class CardHolder : MonoBehaviour
	{
		public List<GameObject> Cards;

		public List<GameObject> HiddenCards;

		internal void RegisterCards()
		{
			foreach (GameObject card in Cards)
			{
				CustomCard.RegisterUnityCard(card, CatsCards.modInitials, card.GetComponent<CardInfo>().cardName, true, (Action<CardInfo>)null);
			}
			foreach (GameObject hiddenCard in HiddenCards)
			{
				CustomCard.RegisterUnityCard(hiddenCard, CatsCards.modInitials, hiddenCard.GetComponent<CardInfo>().cardName, false, (Action<CardInfo>)null);
				Cards.instance.AddHiddenCard(hiddenCard.GetComponent<CardInfo>());
			}
		}
	}
	[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.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.CatsCards.Cats", "Cats Cards", "1.0.0")]
	[BepInProcess("Rounds.exe")]
	public class CatsCards : BaseUnityPlugin
	{
		internal static AssetBundle assets;

		internal static CatsCards instance;

		internal static readonly string modInitials = "Cats";

		private const string ModId = "com.CatsCards.Cats";

		private const string ModName = "Cats Cards";

		public const string Version = "1.0.0";

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0035: Expected O, but got Unknown
			//IL_0035: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			new Harmony("com.CatsCards.Cats").PatchAll();
			instance = this;
			PlayerActionManager.RegisterPlayerAction(new ActionInfo("SwitchHoldable", (BindingSource)new KeyBindingSource((Key[])(object)new Key[1] { (Key)5 }), (BindingSource)new DeviceBindingSource((InputControlType)12)));
			assets = AssetUtils.LoadAssetBundleFromResources("assetbundle", typeof(CatsCards).Assembly);
			assets.LoadAsset<GameObject>("ModCards").GetComponent<CardHolder>().RegisterCards();
		}
	}
}