Decompiled source of ChaosPoppycarsCards v1.4.0

ChaosPoppycarsCards.dll

Decompiled 3 months 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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using CPCCardInfostuffs;
using CPCTabInfoSTATS;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using CardThemeLib;
using ChaosPoppycarsCards.Cards;
using ChaosPoppycarsCards.Cards.Minecrafter;
using ChaosPoppycarsCards.Extensions;
using ChaosPoppycarsCards.Lightsaber;
using ChaosPoppycarsCards.Lightsaber.Extensions;
using ChaosPoppycarsCards.MonoBehaviours;
using ChaosPoppycarsCards.MonoBehaviours.SodaMonos;
using ChaosPoppycarsCards.Utilities;
using ClassesManagerReborn;
using ClassesManagerReborn.Util;
using DoggoBonk.MonoBehaviors.Squish.Lanky;
using DoggoBonk.MonoBehaviors.Squish.Wide;
using HarmonyLib;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Extensions;
using ModdingUtils.GameModes;
using ModdingUtils.MonoBehaviours;
using ModdingUtils.RoundsEffects;
using ModdingUtils.Utils;
using Nullmanager;
using PSA.Extensions;
using Photon.Pun;
using RarityLib.Utils;
using SimulationChamber;
using Sonigon;
using TMPro;
using TabInfo.Utils;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.Extensions;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
using WWMO.MonoBehaviours;
using WillsWackyManagers.Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[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;
		}
	}
}
public class CardHolder : MonoBehaviour
{
	public List<GameObject> Cards;

	public List<GameObject> HiddenCards;

	internal void RegisterCards()
	{
		foreach (GameObject card in Cards)
		{
			CustomCard.RegisterUnityCard(card, "CPC", card.GetComponent<CardInfo>().cardName, true, (Action<CardInfo>)null);
		}
		foreach (GameObject hiddenCard in HiddenCards)
		{
		}
	}
}
public class CursorGun : MonoBehaviour
{
	private Player player;

	private Gun gun;

	private float cd = 0f;

	public SimulatedGun[] savedGuns = (SimulatedGun[])(object)new SimulatedGun[1];

	public static GameObject _stopRecursionObj;

	public static GameObject StopRecursionObj
	{
		get
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			if ((Object)(object)_stopRecursionObj == (Object)null)
			{
				_stopRecursionObj = new GameObject("A_StopRecursion", new Type[1] { typeof(StopRecursion) });
				Object.DontDestroyOnLoad((Object)(object)_stopRecursionObj);
			}
			return _stopRecursionObj;
		}
	}

	public static ObjectsToSpawn[] StopRecursionSpawn => (ObjectsToSpawn[])(object)new ObjectsToSpawn[1]
	{
		new ObjectsToSpawn
		{
			AddToProjectile = StopRecursionObj
		}
	};

	public void Start()
	{
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		player = ((Component)this).GetComponentInParent<Player>();
		gun = player.data.weaponHandler.gun;
		Gun obj = gun;
		obj.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(obj.ShootPojectileAction, new Action<GameObject>(OnShootProjectileAction));
		if ((Object)(object)savedGuns[0] == (Object)null)
		{
			savedGuns[0] = new GameObject("Cursor_One").AddComponent<SimulatedGun>();
		}
	}

	public void OnShootProjectileAction(GameObject obj)
	{
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		if (obj.GetComponentsInChildren<StopRecursion>().Length == 0)
		{
			SimulatedGun val = savedGuns[0];
			val.CopyGunStatsExceptActions(gun);
			val.CopyAttackAction(gun);
			val.CopyShootProjectileAction(gun);
			((Gun)val).ShootPojectileAction = (Action<GameObject>)Delegate.Remove(((Gun)val).ShootPojectileAction, new Action<GameObject>(OnShootProjectileAction));
			((Gun)val).numberOfProjectiles = 1;
			((Gun)val).bursts = 0;
			((Gun)val).damage = ((Gun)val).damage * 0.5f;
			((Gun)val).objectsToSpawn = ((Gun)val).objectsToSpawn.Concat(StopRecursionSpawn).ToArray();
			if ((player.data.view.IsMine || PhotonNetwork.OfflineMode) && cd <= 0f)
			{
				cd += 0.15f;
				val.SimulatedAttack(player.playerID, new Vector3(MainCam.instance.cam.ScreenToWorldPoint(Input.mousePosition).x, MainCam.instance.cam.ScreenToWorldPoint(Input.mousePosition).y, 0f), new Vector3(player.data.input.aimDirection.x, player.data.input.aimDirection.y, 0f), 1f, 1f, (Transform)null, false);
			}
		}
	}

	public void Update()
	{
		if (cd >= 0f)
		{
			cd -= TimeHandler.deltaTime;
		}
	}

	public void OnDestroy()
	{
		Gun obj = gun;
		obj.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(obj.ShootPojectileAction, new Action<GameObject>(OnShootProjectileAction));
		Object.Destroy((Object)(object)savedGuns[0]);
	}
}
namespace CPCTabInfoSTATS
{
	public class TabinfoInterface
	{
		public static void Setup()
		{
			StatCategory val = TabInfoManager.RegisterCategory("Minecraft Stats", 0);
			TabInfoManager.RegisterStat(val, "Totems", (Func<Player, bool>)((Player p) => p.data.stats.GetAdditionalData().totems != 0), (Func<Player, string>)((Player p) => $"{p.data.stats.GetAdditionalData().totems:F0}"));
			TabInfoManager.RegisterStat(val, "Remaining Totems", (Func<Player, bool>)((Player p) => p.data.stats.GetAdditionalData().remainingTotems != 0), (Func<Player, string>)((Player p) => $"{p.data.stats.GetAdditionalData().remainingTotems:F0}"));
			TabInfoManager.RegisterStat(val, "Glowstone", (Func<Player, bool>)((Player p) => p.data.stats.GetAdditionalData().Glowstone > 0), (Func<Player, string>)((Player p) => $"{p.data.stats.GetAdditionalData().Glowstone:F0}"));
			TabInfoManager.RegisterStat(val, "Redstone", (Func<Player, bool>)((Player p) => p.data.stats.GetAdditionalData().Redstone > 0), (Func<Player, string>)((Player p) => $"{p.data.stats.GetAdditionalData().Redstone:F0}"));
			StatCategory val2 = TabInfoManager.RegisterCategory("Critical Hit Stats", 5);
			TabInfoManager.RegisterStat(val2, "Crit Damage", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().criticalHitDamage1 != 1f), (Func<Player, string>)((Player p) => $"{(p.data.weaponHandler.gun.GetAdditionalData().criticalHitDamage1 - 1f) * 100f:F0}%"));
			TabInfoManager.RegisterStat(val2, "Crit Chance", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().criticalHitChance1 != 0f), (Func<Player, string>)((Player p) => $"{p.data.weaponHandler.gun.GetAdditionalData().criticalHitChance1 * 100f:F0}%"));
			TabInfoManager.RegisterStat(val2, "Crit Slow", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().CritSlow > 0f), (Func<Player, string>)((Player p) => $"{p.data.weaponHandler.gun.GetAdditionalData().CritSlow * 100f:F0}%"));
			TabInfoManager.RegisterStat(val2, "Crit Bounces", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().criticalHitBounces != 0), (Func<Player, string>)((Player p) => $"{p.data.weaponHandler.gun.GetAdditionalData().criticalHitBounces:F0}"));
			TabInfoManager.RegisterStat(val2, "Damage on Bounce when you Crit", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().criticalHitDamageOnBounce > 0f), (Func<Player, string>)((Player p) => $"{p.data.weaponHandler.gun.GetAdditionalData().criticalHitDamageOnBounce * 100f:F0}%"));
			TabInfoManager.RegisterStat(val2, "Guranteed Crits", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().guranteedCrits), (Func<Player, string>)((Player p) => "True"));
			TabInfoManager.RegisterStat(val2, "Crit Bullet Speed", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().criticalBulletSpeed > 1f), (Func<Player, string>)((Player p) => $"{(p.data.weaponHandler.gun.GetAdditionalData().criticalBulletSpeed - 1f) * 100f:F0}%"));
			TabInfoManager.RegisterStat(val2, "Crit Simulation Speed", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().criticalSimulationSpeed > 1f), (Func<Player, string>)((Player p) => $"{(p.data.weaponHandler.gun.GetAdditionalData().criticalSimulationSpeed - 1f) * 100f:F0}%"));
			TabInfoManager.RegisterStat(val2, "Unblockable Crits", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().unblockableCrits), (Func<Player, string>)((Player p) => "True"));
			TabInfoManager.RegisterStat(val2, "Blocking Crits", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().BlockingCrits), (Func<Player, string>)((Player p) => "True"));
			TabInfoManager.RegisterStat(val2, "Crit Heal", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().criticalHeal > 0f), (Func<Player, string>)((Player p) => $"{p.data.weaponHandler.gun.GetAdditionalData().criticalHeal:F0}"));
			TabInfoManager.RegisterStat(val2, "Crit CD Reduction", (Func<Player, bool>)((Player p) => p.data.weaponHandler.gun.GetAdditionalData().criticalBlockCDReduction > 0f), (Func<Player, string>)((Player p) => $"{p.data.weaponHandler.gun.GetAdditionalData().criticalBlockCDReduction:F0}%"));
		}
	}
}
namespace Assets._CatsCards.Code.CatsCards.MonoBehaviors.BonkSquishPlayer
{
	internal class ReverseBonkEffect
	{
	}
}
namespace DoggoBonk.MonoBehaviors.Squish
{
	public abstract class OnFlipEffect : MonoBehaviour
	{
		public abstract void Selected();

		public abstract void Unselected();
	}
}
namespace DoggoBonk.MonoBehaviors.Squish.Patches
{
	[Serializable]
	[HarmonyPatch(typeof(Player), "FullReset")]
	internal class PlayerFullResetPatch
	{
		private static void Prefix(Player __instance)
		{
			WidePlayerEffect[] componentsInChildren = ((Component)__instance).gameObject.GetComponentsInChildren<WidePlayerEffect>();
			foreach (WidePlayerEffect widePlayerEffect in componentsInChildren)
			{
				if ((Object)(object)widePlayerEffect != (Object)null)
				{
					Object.Destroy((Object)(object)widePlayerEffect);
				}
			}
			LankyPlayerEffect[] componentsInChildren2 = ((Component)__instance).gameObject.GetComponentsInChildren<LankyPlayerEffect>();
			foreach (LankyPlayerEffect lankyPlayerEffect in componentsInChildren2)
			{
				if ((Object)(object)lankyPlayerEffect != (Object)null)
				{
					Object.Destroy((Object)(object)lankyPlayerEffect);
				}
			}
			((Component)((Component)__instance).gameObject.transform.GetChild(3)).gameObject.GetComponentInChildren<LegRaycasters>().force = 1000f;
			Object.Destroy((Object)(object)((Component)__instance).GetComponentInChildren<A_HoldableObject>());
		}
	}
}
namespace DoggoBonk.MonoBehaviors.Squish.Wide
{
	internal class WidePlayerEffect : MonoBehaviour
	{
		private float startTime = -1f;

		internal float ratio = 1f;

		public bool isMult;

		public float ratioOffset;

		public float yOffset;

		internal Vector3 restore_scale = Vector3.zero;

		private void Start()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_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)
			if (isMult)
			{
				ratio *= ratioOffset;
			}
			else
			{
				ratio += ratioOffset;
			}
			restore_scale = ((Component)this).gameObject.transform.localScale;
			foreach (object item in ((Component)this).gameObject.transform.parent.GetChild(4))
			{
				Transform val = (Transform)item;
				val.localPosition += new Vector3(0f, yOffset, 0f);
			}
			ResetScale();
			Widen();
			ResetTimer();
		}

		private void Update()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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)
			if (Time.time >= startTime + 0.5f)
			{
				ResetTimer();
				if (((Component)this).gameObject.transform.localScale.x == ((Component)this).gameObject.transform.localScale.y)
				{
					restore_scale = ((Component)this).gameObject.transform.localScale;
					Widen();
				}
			}
		}

		internal void Widen()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_007a: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			if (Mathf.Abs(((Component)this).gameObject.transform.localScale.y / ((Component)this).gameObject.transform.localScale.x - ratio) >= 0.0001f)
			{
				((Component)this).gameObject.transform.localScale = 1.25f * new Vector3(((Component)this).gameObject.transform.localScale.x, ((Component)this).gameObject.transform.localScale.x * ratio, ((Component)this).gameObject.transform.localScale.z);
				((Component)this).gameObject.transform.localPosition = new Vector3(0f, yOffset, 0f);
			}
		}

		internal void ResetScale()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (restore_scale != Vector3.zero)
			{
				((Component)this).gameObject.transform.localScale = restore_scale;
			}
		}

		private void ResetTimer()
		{
			startTime = Time.time;
		}

		private void OnDestroy()
		{
			//IL_0022: 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)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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)
			ResetScale();
			((Component)this).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
			foreach (object item in ((Component)this).gameObject.transform.parent.GetChild(4))
			{
				Transform val = (Transform)item;
				val.localPosition -= new Vector3(0f, yOffset, 0f);
			}
		}
	}
	internal class WideVisualEffect : OnFlipEffect
	{
		private bool wide;

		private Vector3 restore_scale;

		private float signy = 1f;

		public override void Selected()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_005b: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			if (!wide)
			{
				wide = true;
				restore_scale = ((Component)this).gameObject.transform.localScale;
				((Component)this).gameObject.transform.localScale = new Vector3(((Component)this).gameObject.transform.localScale.x * 1.35f, ((Component)this).gameObject.transform.localScale.y * 0.45f, ((Component)this).gameObject.transform.localScale.z);
			}
		}

		public override void Unselected()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			wide = false;
			((Component)this).gameObject.transform.localScale = restore_scale;
		}

		private void Update()
		{
			//IL_002b: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			if (wide)
			{
				if (Mathf.Abs(restore_scale.y * 0.45f - ((Component)this).gameObject.transform.localScale.y) >= 0.1f)
				{
					signy *= -1f;
				}
				((Component)this).gameObject.transform.localScale = ((Component)this).gameObject.transform.localScale + new Vector3(0f, signy * 0.02f, 0f);
			}
		}

		private void OnDisable()
		{
			wide = false;
		}

		private void OnDestroy()
		{
			wide = false;
		}
	}
}
namespace DoggoBonk.MonoBehaviors.Squish.Lanky
{
	public class LankyPlayerEffect : MonoBehaviour
	{
		private float startTime = -1f;

		internal float ratio = 1f;

		public bool isMult;

		public float ratioOffset;

		public float yOffset;

		internal Vector3 restore_scale = Vector3.zero;

		private void Start()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_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)
			if (isMult)
			{
				ratio *= ratioOffset;
			}
			else
			{
				ratio += ratioOffset;
			}
			restore_scale = ((Component)this).gameObject.transform.localScale;
			foreach (object item in ((Component)this).gameObject.transform.parent.GetChild(4))
			{
				Transform val = (Transform)item;
				val.localPosition += new Vector3(0f, yOffset, 0f);
			}
			ResetScale();
			Lanken();
			ResetTimer();
		}

		private void Update()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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)
			if (Time.time >= startTime + 0.5f)
			{
				ResetTimer();
				if (((Component)this).gameObject.transform.localScale.x == ((Component)this).gameObject.transform.localScale.y)
				{
					restore_scale = ((Component)this).gameObject.transform.localScale;
					Lanken();
				}
			}
		}

		internal void Lanken()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0081: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			if (Mathf.Abs(((Component)this).gameObject.transform.localScale.x / ((Component)this).gameObject.transform.localScale.y - ratio) >= 0.0001f)
			{
				((Component)this).gameObject.transform.localScale = 1.25f * new Vector3(((Component)this).gameObject.transform.localScale.x * ratio, ((Component)this).gameObject.transform.localScale.x, ((Component)this).gameObject.transform.localScale.z);
				((Component)this).gameObject.transform.localPosition = new Vector3(0f, yOffset, 0f);
			}
		}

		internal void ResetScale()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (restore_scale != Vector3.zero)
			{
				((Component)this).gameObject.transform.localScale = restore_scale;
			}
		}

		private void ResetTimer()
		{
			startTime = Time.time;
		}

		private void OnDestroy()
		{
			//IL_0022: 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_005a: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			ResetScale();
			((Component)this).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
			foreach (object item in ((Component)this).gameObject.transform.parent.GetChild(4))
			{
				Transform val = (Transform)item;
				val.localPosition -= new Vector3(0f, yOffset, 0f);
			}
		}
	}
	internal class LankyVisualEffect : OnFlipEffect
	{
		private bool lanky;

		private Vector3 restore_scale;

		private float signy = 1f;

		public override void Selected()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_005b: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			if (!lanky)
			{
				lanky = true;
				restore_scale = ((Component)this).gameObject.transform.localScale;
				((Component)this).gameObject.transform.localScale = new Vector3(((Component)this).gameObject.transform.localScale.x * 0.6f, ((Component)this).gameObject.transform.localScale.y * 1.1f, ((Component)this).gameObject.transform.localScale.z);
			}
		}

		public override void Unselected()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			lanky = false;
			((Component)this).gameObject.transform.localScale = restore_scale;
		}

		private void Update()
		{
			//IL_002b: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			if (lanky)
			{
				if (Mathf.Abs(restore_scale.y * 1.1f - ((Component)this).gameObject.transform.localScale.y) >= 0.1f)
				{
					signy *= -1f;
				}
				((Component)this).gameObject.transform.localScale = ((Component)this).gameObject.transform.localScale + new Vector3(0f, signy * 0.02f, 0f);
			}
		}

		private void OnDisable()
		{
			lanky = false;
		}

		private void OnDestroy()
		{
			lanky = false;
		}
	}
}
namespace CPCCardInfostuffs
{
	public class CPCCardInfo : MonoBehaviour
	{
		[Header("CPC Settings")]
		public float GunCritDamage2 = 0f;

		public float GunCritChance2 = 0f;

		public int GunCritBounces = 0;

		public float GunCritDamageOnBounce = 0f;

		public bool GunConsecutiveCrits = false;

		public float GunConsecutiveCritsDamage = 0f;

		public bool GunGuranteedCrits = false;

		public float GunCritSlow = 0f;

		public Color GunCritColor = Color.red;

		public Color GunDoubleCritColor = Color.cyan;

		public float GunCritBulletSpeed = 0f;

		public float GunCritSimulationSpeed = 0f;

		public bool GunUnblockableCrits = false;

		public float GunCritHeal = 0f;

		public float GunCritBlockCDReduction = 0f;

		public bool GunBlockingCrits = false;

		public string Tag = "CPC";

		public void Start()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			RectTransform[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<RectTransform>();
			GameObject val = new GameObject("ModIDText");
			RectTransform val2 = ((IEnumerable<RectTransform>)componentsInChildren).FirstOrDefault((Func<RectTransform, bool>)((RectTransform obj) => ((Object)((Component)obj).gameObject).name == "EdgePart (2)"));
			if ((Object)(object)val2 != (Object)null)
			{
				GameObject gameObject = ((Component)val2).gameObject;
				val.gameObject.transform.SetParent(gameObject.transform);
			}
			TextMeshProUGUI val3 = val.gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = Tag;
			((TMP_Text)val3).autoSizeTextContainer = true;
			val.transform.localEulerAngles = new Vector3(0f, 0f, 135f);
			val.transform.localScale = Vector3.one;
			val.transform.localPosition = new Vector3(-75f, -75f, 0f);
			((TMP_Text)val3).alignment = (TextAlignmentOptions)1026;
			((TMP_Text)val3).alpha = 0.1f;
			((TMP_Text)val3).fontSize = 54f;
		}
	}
}
namespace ChaosPoppycarsCards
{
	[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.*/)]
	[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.Poppycars.CPC.Id", "ChaosPoppycarsCards", "1.4.0")]
	[BepInProcess("Rounds.exe")]
	public class ChaosPoppycarsCards : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<Type, bool> <>9__16_0;

			public static Action <>9__16_1;

			public static Predicate<BaseUnityPlugin> <>9__17_4;

			public static UnityAction <>9__17_0;

			public static Func<IGameModeHandler, IEnumerator> <>9__17_1;

			public static Action <>9__17_2;

			public static UnityAction<bool> <>9__19_0;

			internal bool <RegisterCards>b__16_0(Type type)
			{
				return type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(CustomCard));
			}

			internal void <RegisterCards>b__16_1()
			{
				CurseManager.instance.RegisterCurse(Anarkey.Card);
				CurseManager.instance.RegisterCurse(BlockConfusion.Card);
				CurseManager.instance.RegisterCurse(BrittleBullets.Card);
				CurseManager.instance.RegisterCurse(FearfulCurse.Card);
				CurseManager.instance.RegisterCurse(NerfGun.Card);
				CurseManager.instance.RegisterCurse(SpeedCurse.Card);
				CurseManager.instance.RegisterCurse(RandomCurse.Card);
			}

			internal bool <Start>b__17_4(BaseUnityPlugin plugin)
			{
				return plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo";
			}

			internal void <Start>b__17_0()
			{
			}

			internal IEnumerator <Start>b__17_1(IGameModeHandler gm)
			{
				return PoppysChaos.ExtraPicks();
			}

			internal void <Start>b__17_2()
			{
				if ((Object)(object)CardUtils.GetCardInfo("Boomerang") != (Object)null)
				{
					CardInfo cardInfo = CardUtils.GetCardInfo("Boomerang");
					CardUtils.MakeExclusive("Boomerang", "Light Saber");
					List<CardCategory> list = cardInfo.categories.ToList();
					cardInfo.categories = list.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Shields Up") != (Object)null)
				{
					CardInfo cardInfo2 = CardUtils.GetCardInfo("Shields Up");
					CardUtils.MakeExclusive("Shields Up", "Light Saber");
					List<CardCategory> list2 = cardInfo2.categories.ToList();
					cardInfo2.categories = list2.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Drive") != (Object)null)
				{
					CardInfo cardInfo3 = CardUtils.GetCardInfo("Drive");
					CardUtils.MakeExclusive("Drive", "Light Saber");
					List<CardCategory> list3 = cardInfo3.categories.ToList();
					cardInfo3.categories = list3.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Flak Cannon") != (Object)null)
				{
					CardInfo cardInfo4 = CardUtils.GetCardInfo("Flak Cannon");
					CardUtils.MakeExclusive("Flak Cannon", "Light Saber");
					List<CardCategory> list4 = cardInfo4.categories.ToList();
					cardInfo4.categories = list4.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Stasis") != (Object)null)
				{
					CardInfo cardInfo5 = CardUtils.GetCardInfo("Stasis");
					CardUtils.MakeExclusive("Stasis", "Light Saber");
					List<CardCategory> list5 = cardInfo5.categories.ToList();
					cardInfo5.categories = list5.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Bullet Time") != (Object)null)
				{
					CardInfo cardInfo6 = CardUtils.GetCardInfo("Bullet Time");
					CardUtils.MakeExclusive("Bullet Time", "Light Saber");
					List<CardCategory> list6 = cardInfo6.categories.ToList();
					cardInfo6.categories = list6.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Drone") != (Object)null)
				{
					CardInfo cardInfo7 = CardUtils.GetCardInfo("Drone");
					CardUtils.MakeExclusive("Drone", "Light Saber");
					List<CardCategory> list7 = cardInfo7.categories.ToList();
					cardInfo7.categories = list7.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Focus") != (Object)null)
				{
					CardInfo cardInfo8 = CardUtils.GetCardInfo("Focus");
					CardUtils.MakeExclusive("Focus", "Light Saber");
					List<CardCategory> list8 = cardInfo8.categories.ToList();
					cardInfo8.categories = list8.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Sun") != (Object)null)
				{
					CardInfo cardInfo9 = CardUtils.GetCardInfo("Sun");
					CardUtils.MakeExclusive("Sun", "Light Saber");
					List<CardCategory> list9 = cardInfo9.categories.ToList();
					cardInfo9.categories = list9.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Flex Seal") != (Object)null)
				{
					CardInfo cardInfo10 = CardUtils.GetCardInfo("Flex Seal");
					CardUtils.MakeExclusive("Flex Seal", "Light Saber");
					List<CardCategory> list10 = cardInfo10.categories.ToList();
					cardInfo10.categories = list10.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Rex") != (Object)null)
				{
					CardInfo cardInfo11 = CardUtils.GetCardInfo("Rex");
					CardUtils.MakeExclusive("Rex", "Light Saber");
					List<CardCategory> list11 = cardInfo11.categories.ToList();
					cardInfo11.categories = list11.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Anti Material Rifle\u200b") != (Object)null)
				{
					CardInfo cardInfo12 = CardUtils.GetCardInfo("Anti Material Rifle\u200b");
					CardUtils.MakeExclusive("Anti Material Rifle\u200b", "Light Saber");
					List<CardCategory> list12 = cardInfo12.categories.ToList();
					cardInfo12.categories = list12.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Hyper Sonic\u200b") != (Object)null)
				{
					CardInfo cardInfo13 = CardUtils.GetCardInfo("Hyper Sonic\u200b");
					CardUtils.MakeExclusive("Hyper Sonic\u200b", "Light Saber");
					List<CardCategory> list13 = cardInfo13.categories.ToList();
					cardInfo13.categories = list13.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Squid\u200b") != (Object)null)
				{
					CardInfo cardInfo14 = CardUtils.GetCardInfo("Squid\u200b");
					CardUtils.MakeExclusive("Squid\u200b", "Light Saber");
					List<CardCategory> list14 = cardInfo14.categories.ToList();
					cardInfo14.categories = list14.ToArray();
				}
			}

			internal void <NewGUI>b__19_0(bool value)
			{
				MC_Particles.Value = value;
			}
		}

		private const string ModId = "com.Poppycars.CPC.Id";

		private const string ModName = "ChaosPoppycarsCards";

		public const string Version = "1.4.0";

		public const string ModInitials = "CPC";

		internal static List<BaseUnityPlugin> plugins;

		public static ConfigEntry<bool> MC_Particles;

		public static AssetBundle Bundle;

		internal static AssetBundle ArtAssets;

		public static ChaosPoppycarsCards Instance { get; private set; }

		public static object CPC_Assets { get; internal set; }

		private void Awake()
		{
			//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)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			Bundle = AssetUtils.LoadAssetBundleFromResources("cpcart", typeof(ChaosPoppycarsCards).Assembly);
			CardThemeLib.instance.CreateOrGetType("Evergreen", new CardThemeColor
			{
				bgColor = new Color(0.09f, 0.23f, 0.11f),
				targetColor = new Color(0.28f, 0.8f, 0.32f)
			});
			Harmony val = new Harmony("com.Poppycars.CPC.Id");
			val.PatchAll();
			GameObject val2 = Bundle.LoadAsset<GameObject>("ModCards");
			CardHolder component = val2.GetComponent<CardHolder>();
			component.RegisterCards();
			Bundle.LoadAllAssets();
			MC_Particles = ((BaseUnityPlugin)this).Config.Bind<bool>("com.Poppycars.CPC.Id", "Minecraft_Particles", true, "Enable Minecraft Particles");
		}

		private void RegisterCards()
		{
			GameObject[] source = Bundle.LoadAllAssets<GameObject>();
			List<Type> list = (from type in typeof(ChaosPoppycarsCards).Assembly.GetTypes()
				where type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(CustomCard))
				select type).ToList();
			foreach (Type type2 in list)
			{
				try
				{
					GameObject val = source.Where((GameObject a) => a != null && (Object)(object)a.GetComponent<CustomCard>() != (Object)null && ((object)a.GetComponent<CustomCard>()).GetType() == type2).First();
					try
					{
						type2.GetField("Card", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
						val.GetComponent<CustomCard>().BuildUnityCard((Action<CardInfo>)delegate(CardInfo cardInfo)
						{
							type2.GetField("Card", BindingFlags.Static | BindingFlags.NonPublic).SetValue(null, cardInfo);
						});
					}
					catch
					{
						val.GetComponent<CustomCard>().BuildUnityCard((Action<CardInfo>)null);
					}
				}
				catch
				{
				}
			}
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 10, (Action)delegate
			{
				CurseManager.instance.RegisterCurse(Anarkey.Card);
				CurseManager.instance.RegisterCurse(BlockConfusion.Card);
				CurseManager.instance.RegisterCurse(BrittleBullets.Card);
				CurseManager.instance.RegisterCurse(FearfulCurse.Card);
				CurseManager.instance.RegisterCurse(NerfGun.Card);
				CurseManager.instance.RegisterCurse(SpeedCurse.Card);
				CurseManager.instance.RegisterCurse(RandomCurse.Card);
			});
		}

		private void Start()
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			plugins = (List<BaseUnityPlugin>)typeof(Chainloader).GetField("_plugins", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
			Instance = this;
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)GameStart);
			if (plugins.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
			{
				TabinfoInterface.Setup();
			}
			ArtAssets = AssetUtils.LoadAssetBundleFromResources("cpccart", typeof(ChaosPoppycarsCards).Assembly);
			RegisterCards();
			object obj = <>c.<>9__17_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
				};
				<>c.<>9__17_0 = val;
				obj = (object)val;
			}
			Unbound.RegisterMenu("ChaosPoppycarsCards", (UnityAction)obj, (Action<GameObject>)NewGUI, (GameObject)null, false);
			GameModeManager.AddHook("RoundEnd", (Func<IGameModeHandler, IEnumerator>)UpgradeAction);
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)PointEnd);
			GameModeManager.AddHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler gm) => PoppysChaos.ExtraPicks()));
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 10, (Action)delegate
			{
				if ((Object)(object)CardUtils.GetCardInfo("Boomerang") != (Object)null)
				{
					CardInfo cardInfo = CardUtils.GetCardInfo("Boomerang");
					CardUtils.MakeExclusive("Boomerang", "Light Saber");
					List<CardCategory> list = cardInfo.categories.ToList();
					cardInfo.categories = list.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Shields Up") != (Object)null)
				{
					CardInfo cardInfo2 = CardUtils.GetCardInfo("Shields Up");
					CardUtils.MakeExclusive("Shields Up", "Light Saber");
					List<CardCategory> list2 = cardInfo2.categories.ToList();
					cardInfo2.categories = list2.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Drive") != (Object)null)
				{
					CardInfo cardInfo3 = CardUtils.GetCardInfo("Drive");
					CardUtils.MakeExclusive("Drive", "Light Saber");
					List<CardCategory> list3 = cardInfo3.categories.ToList();
					cardInfo3.categories = list3.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Flak Cannon") != (Object)null)
				{
					CardInfo cardInfo4 = CardUtils.GetCardInfo("Flak Cannon");
					CardUtils.MakeExclusive("Flak Cannon", "Light Saber");
					List<CardCategory> list4 = cardInfo4.categories.ToList();
					cardInfo4.categories = list4.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Stasis") != (Object)null)
				{
					CardInfo cardInfo5 = CardUtils.GetCardInfo("Stasis");
					CardUtils.MakeExclusive("Stasis", "Light Saber");
					List<CardCategory> list5 = cardInfo5.categories.ToList();
					cardInfo5.categories = list5.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Bullet Time") != (Object)null)
				{
					CardInfo cardInfo6 = CardUtils.GetCardInfo("Bullet Time");
					CardUtils.MakeExclusive("Bullet Time", "Light Saber");
					List<CardCategory> list6 = cardInfo6.categories.ToList();
					cardInfo6.categories = list6.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Drone") != (Object)null)
				{
					CardInfo cardInfo7 = CardUtils.GetCardInfo("Drone");
					CardUtils.MakeExclusive("Drone", "Light Saber");
					List<CardCategory> list7 = cardInfo7.categories.ToList();
					cardInfo7.categories = list7.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Focus") != (Object)null)
				{
					CardInfo cardInfo8 = CardUtils.GetCardInfo("Focus");
					CardUtils.MakeExclusive("Focus", "Light Saber");
					List<CardCategory> list8 = cardInfo8.categories.ToList();
					cardInfo8.categories = list8.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Sun") != (Object)null)
				{
					CardInfo cardInfo9 = CardUtils.GetCardInfo("Sun");
					CardUtils.MakeExclusive("Sun", "Light Saber");
					List<CardCategory> list9 = cardInfo9.categories.ToList();
					cardInfo9.categories = list9.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Flex Seal") != (Object)null)
				{
					CardInfo cardInfo10 = CardUtils.GetCardInfo("Flex Seal");
					CardUtils.MakeExclusive("Flex Seal", "Light Saber");
					List<CardCategory> list10 = cardInfo10.categories.ToList();
					cardInfo10.categories = list10.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Rex") != (Object)null)
				{
					CardInfo cardInfo11 = CardUtils.GetCardInfo("Rex");
					CardUtils.MakeExclusive("Rex", "Light Saber");
					List<CardCategory> list11 = cardInfo11.categories.ToList();
					cardInfo11.categories = list11.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Anti Material Rifle\u200b") != (Object)null)
				{
					CardInfo cardInfo12 = CardUtils.GetCardInfo("Anti Material Rifle\u200b");
					CardUtils.MakeExclusive("Anti Material Rifle\u200b", "Light Saber");
					List<CardCategory> list12 = cardInfo12.categories.ToList();
					cardInfo12.categories = list12.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Hyper Sonic\u200b") != (Object)null)
				{
					CardInfo cardInfo13 = CardUtils.GetCardInfo("Hyper Sonic\u200b");
					CardUtils.MakeExclusive("Hyper Sonic\u200b", "Light Saber");
					List<CardCategory> list13 = cardInfo13.categories.ToList();
					cardInfo13.categories = list13.ToArray();
				}
				if ((Object)(object)CardUtils.GetCardInfo("Squid\u200b") != (Object)null)
				{
					CardInfo cardInfo14 = CardUtils.GetCardInfo("Squid\u200b");
					CardUtils.MakeExclusive("Squid\u200b", "Light Saber");
					List<CardCategory> list14 = cardInfo14.categories.ToList();
					cardInfo14.categories = list14.ToArray();
				}
			});
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 60, (Action)delegate
			{
				CardManager.cards.Values.ToList().ForEach(delegate(Card card)
				{
					AddMod(card);
				});
			});
		}

		private void AddMod(Card card)
		{
			string text = "__Rarity-" + ((object)(Rarity)(ref card.cardInfo.rarity)).ToString();
			CardCategory val = CustomCardCategories.instance.CardCategory(text);
			CardCategory[] categories = CollectionExtensions.AddToArray<CardCategory>(card.cardInfo.categories, val);
			card.cardInfo.categories = categories;
		}

		private void NewGUI(GameObject menu)
		{
			TextMeshProUGUI val = default(TextMeshProUGUI);
			MenuHandler.CreateText("ChaosPoppycarsCards", menu, ref val, 60, false, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateToggle(MC_Particles.Value, "Enable Minecraft Particles (only effects potions right now)", menu, (UnityAction<bool>)delegate(bool value)
			{
				MC_Particles.Value = value;
			}, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateText("", menu, ref val, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
		}

		private IEnumerator UpgradeAction(IGameModeHandler gm)
		{
			yield return WoodenSword.UpgradeSword(gm);
			yield return WoodenHoe.UpgradeHoe(gm);
			yield return WoodenAxe.UpgradeAxe(gm);
			yield return LetherArmor.UpgradeArmor(gm);
		}

		private IEnumerator PointEnd(IGameModeHandler gm)
		{
			foreach (Player player in PlayerManager.instance.players)
			{
				player.data.stats.GetAdditionalData().firstHit = true;
				player.data.stats.GetAdditionalData().firstDamage = true;
			}
			yield break;
		}

		private IEnumerator GameStart(IGameModeHandler gm)
		{
			foreach (Player player in PlayerManager.instance.players)
			{
				CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories.Remove(CPCCardCategories.PotionCategory);
				CharacterStatModifiersExtension.GetAdditionalData(player.data.stats).blacklistedCategories.Add(CPCCardCategories.GeeseCategory);
			}
			yield break;
		}
	}
	internal static class CPCCardCategories
	{
		public static CardCategory PotionCategory = CustomCardCategories.instance.CardCategory("UltimatePotion");

		public static CardCategory GeeseCategory = CustomCardCategories.instance.CardCategory("GeeseCategory");
	}
	public static class Config
	{
		public const bool isDebugBuild = false;
	}
}
namespace ChaosPoppycarsCards.Utilities
{
	internal class CPCDebug
	{
		public static void Log(object message)
		{
			bool flag = false;
		}
	}
	internal class Miscs
	{
		public static bool debugFlag = true;

		public static void Log(object message)
		{
			if (debugFlag)
			{
				Debug.Log(message);
			}
		}

		public static void LogWarn(object message)
		{
			if (debugFlag)
			{
				Debug.LogWarning(message);
			}
		}

		public static void LogError(object message)
		{
			if (debugFlag)
			{
				Debug.LogError(message);
			}
		}

		public static List<string> StringSplit(string input, char splitAt)
		{
			List<string> list = new List<string>();
			string text = "";
			for (int i = 0; i < input.Length; i++)
			{
				if (input[i] != splitAt)
				{
					text += input[i];
					continue;
				}
				list.Add(text);
				text = "";
			}
			if (text != "")
			{
				list.Add(text);
			}
			return list;
		}

		public static int ValidateStringQuery(string targetString, string query)
		{
			int num = 15;
			int num2 = 0;
			int num3 = 0;
			bool flag = true;
			for (int i = 0; i < targetString.Length; i++)
			{
				if (targetString[i] == query[num2])
				{
					num3 += num;
					num2++;
				}
				else
				{
					flag = false;
					num--;
					num2++;
				}
				if (num2 == query.Length)
				{
					if (flag)
					{
						num3 += num * 10;
					}
					break;
				}
			}
			return num3;
		}
	}
	public class CardUtils
	{
		public class PlayerCardData
		{
			public CardInfo cardInfo;

			public Player owner;

			public int index;

			public PlayerCardData(CardInfo cardInfo, Player owner, int index)
			{
				this.cardInfo = cardInfo;
				this.owner = owner;
				this.index = index;
			}
		}

		public static bool PlayerHasCard(Player player, string cardName)
		{
			List<PlayerCardData> playerCardsWithName = GetPlayerCardsWithName(player, cardName);
			return playerCardsWithName.Count > 0;
		}

		public static bool PlayerHasCardCategory(Player player, CardCategory cardCategory)
		{
			List<PlayerCardData> playerCardsWithCategory = GetPlayerCardsWithCategory(player, cardCategory);
			return playerCardsWithCategory.Count > 0;
		}

		public static List<PlayerCardData> GetPlayerCardsWithName(Player player, string targetCardName)
		{
			targetCardName = targetCardName.ToUpper();
			List<PlayerCardData> list = new List<PlayerCardData>();
			List<CardInfo> currentCards = player.data.currentCards;
			for (int i = 0; i < currentCards.Count; i++)
			{
				string text = currentCards[i].cardName.ToUpper();
				if (text.Equals(targetCardName))
				{
					list.Add(new PlayerCardData(currentCards[i], player, i));
				}
			}
			return list;
		}

		public static List<PlayerCardData> GetPlayerCardsWithCategory(Player player, CardCategory targetCategory)
		{
			List<PlayerCardData> list = new List<PlayerCardData>();
			List<CardInfo> currentCards = player.data.currentCards;
			for (int i = 0; i < currentCards.Count; i++)
			{
				bool flag = false;
				CardCategory[] categoriesFromCard = CustomCardCategories.instance.GetCategoriesFromCard(currentCards[i]);
				CardCategory[] array = categoriesFromCard;
				foreach (CardCategory val in array)
				{
					if ((Object)(object)targetCategory == (Object)(object)val)
					{
						flag = true;
						break;
					}
				}
				if (flag)
				{
					list.Add(new PlayerCardData(currentCards[i], player, i));
				}
			}
			return list;
		}

		public static CardInfo GetCardInfo(string modInitial, string cardNameExact)
		{
			string value = "__" + modInitial + "__" + cardNameExact;
			List<CardInfo> list = CardManager.cards.Values.Select((Card c) => c.cardInfo).ToList();
			CardInfo result = null;
			foreach (CardInfo item in list)
			{
				if (((Object)((Component)item).gameObject).name.Contains(value))
				{
					result = item;
					break;
				}
			}
			return result;
		}

		public static CardInfo GetCardInfo(string query, bool searchVanillaOnly = false)
		{
			if (query.Contains("@"))
			{
				List<string> list = Miscs.StringSplit(query, '@');
				if (list.Count == 2)
				{
					if (list[0] == "")
					{
						return GetCardInfo(list[1]);
					}
					if (list[0] == "Vanilla")
					{
						return GetCardInfo(list[1], searchVanillaOnly: true);
					}
					return GetCardInfo(list[0], list[1]);
				}
				Miscs.LogWarn(">> query splitting failed");
				query = list[0];
			}
			query = CardNameSanitize(query, removeWhitespaces: true);
			List<CardInfo> list2 = CardManager.cards.Values.Select((Card c) => c.cardInfo).ToList();
			CardInfo result = null;
			int num = 0;
			foreach (CardInfo item in list2)
			{
				string text = CardNameSanitize(((Object)((Component)item).gameObject).name, removeWhitespaces: true);
				if (searchVanillaOnly && text.Contains("__"))
				{
					continue;
				}
				text = CardNameSanitize(item.cardName, removeWhitespaces: true);
				if (text.Equals(query))
				{
					result = item;
					num = 9999;
					break;
				}
				if (text.Contains(query))
				{
					int num2 = Miscs.ValidateStringQuery(text, query);
					if (num2 > num)
					{
						num = num2;
						result = item;
					}
				}
			}
			return result;
		}

		public static List<PlayerCardData> GetPlayerCardsWithCardInfo(Player player, CardInfo cardInfo)
		{
			string value = ((Object)((Component)cardInfo).gameObject).name.ToUpper();
			List<PlayerCardData> list = new List<PlayerCardData>();
			List<CardInfo> currentCards = player.data.currentCards;
			for (int i = 0; i < currentCards.Count; i++)
			{
				string text = ((Object)((Component)currentCards[i]).gameObject).name.ToUpper();
				if (text.Equals(value))
				{
					list.Add(new PlayerCardData(currentCards[i], player, i));
				}
			}
			return list;
		}

		public static List<PlayerCardData> GetPlayerCardsWithStringList(Player player, List<string> checkList)
		{
			List<PlayerCardData> list = new List<PlayerCardData>();
			List<CardInfo> currentCards = player.data.currentCards;
			foreach (string check in checkList)
			{
				CardInfo cardInfo = GetCardInfo(check);
				if (!((Object)(object)cardInfo == (Object)null))
				{
					list = list.Concat(GetPlayerCardsWithCardInfo(player, cardInfo)).ToList();
				}
			}
			return list;
		}

		public static string CardNameSanitize(string name, bool removeWhitespaces = false)
		{
			string text = name.ToLower();
			if (removeWhitespaces)
			{
				text = text.Replace(" ", "");
			}
			return text;
		}

		public static void MakeExclusive(string cardA, string cardB)
		{
			CardInfo cardInfo = GetCardInfo(cardA);
			CardInfo cardInfo2 = GetCardInfo(cardB);
			if ((Object)(object)cardInfo != (Object)null && (Object)(object)cardInfo2 != (Object)null)
			{
				CustomCardCategories.instance.MakeCardsExclusive(cardInfo, cardInfo2);
				Miscs.Log("[CPC] MakeExclusive: card [" + cardA + "] and card [" + cardB + "] made exclusive");
			}
			else
			{
				if ((Object)(object)cardInfo == (Object)null)
				{
					Miscs.LogWarn("[CPC] MakeExclusive: card [" + cardA + "] not found");
				}
				if ((Object)(object)cardInfo2 == (Object)null)
				{
					Miscs.LogWarn("[CPC] MakeExclusive: card [" + cardB + "] not found");
				}
			}
		}
	}
}
namespace ChaosPoppycarsCards.Patches
{
	[HarmonyPatch(typeof(DeathEffect))]
	internal class DeathEffect_Patch
	{
		[HarmonyPostfix]
		[HarmonyPatch("PlayDeath")]
		private static void AdjustedRespawnTime(DeathEffect __instance, Color color, PlayerVelocity playerRig, Vector2 vel, int playerIDToRevive)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			if (playerIDToRevive == -1)
			{
				return;
			}
			Player player = ((CharacterData)ExtensionMethods.GetFieldValue((object)playerRig, "data")).player;
			if (player.data.stats.GetAdditionalData().useNewRespawnTime)
			{
				float newRespawnTime = player.data.stats.GetAdditionalData().newRespawnTime;
				ExtensionMethods.SetFieldValue((object)__instance, "respawnTime", (object)newRespawnTime);
				ParticleSystem[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<ParticleSystem>();
				ParticleSystem[] array = componentsInChildren;
				foreach (ParticleSystem val in array)
				{
					val.playbackSpeed = 2.53f / newRespawnTime;
					MainModule main = val.main;
					((MainModule)(ref main)).simulationSpeed = 2.53f / newRespawnTime;
				}
				((Component)__instance).gameObject.GetComponent<RemoveAfterSeconds>().seconds = 2f * newRespawnTime;
			}
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(HealthHandler), "DoDamage")]
	internal class HealtHandlerPatchDoDamage
	{
		private static void Prefix(HealthHandler __instance, ref Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon, Player damagingPlayer, bool healthRemoval, ref bool lethal, bool ignoreBlock)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_00f5: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			Player player = val.player;
			if (!val.isPlaying || val.dead || __instance.isRespawning)
			{
				return;
			}
			if ((Object)(object)damagingPlayer != (Object)null && damagingPlayer.data.stats.GetAdditionalData().firstDamage)
			{
				damagingPlayer.data.stats.GetAdditionalData().damageMult = damagingPlayer.data.stats.GetAdditionalData().damageMultMax;
				damagingPlayer.data.stats.GetAdditionalData().firstDamage = false;
			}
			if ((Object)(object)damagingPlayer != (Object)null && damagingPlayer.data.stats.GetAdditionalData().reducingDmg)
			{
				damage *= damagingPlayer.data.stats.GetAdditionalData().damageMult;
				if (damagingPlayer.data.stats.GetAdditionalData().damageMult > 0.05f)
				{
					damagingPlayer.data.stats.GetAdditionalData().damageMult -= damagingPlayer.data.stats.GetAdditionalData().reducingDmgAmt;
				}
				if (damagingPlayer.data.stats.GetAdditionalData().damageMult < 0.05f)
				{
					damagingPlayer.data.stats.GetAdditionalData().damageMult = 0.05f;
				}
			}
			if (player.data.stats.GetAdditionalData().firstHit)
			{
				player.data.stats.GetAdditionalData().firstHit = false;
				if (player.data.stats.GetAdditionalData().firstHitdmgReduction > 0f)
				{
					damage /= player.data.stats.GetAdditionalData().firstHitdmgReduction;
				}
			}
			if (lethal && val.health < ((Vector2)(ref damage)).magnitude && val.stats.GetAdditionalData().remainingTotems > 0 && (Object)(object)((Component)player).GetComponent<TotemEffect>() != (Object)null)
			{
				((Component)player).GetComponent<TotemEffect>().UseMulligan();
				lethal = false;
			}
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(HealthHandler), "Revive")]
	internal class HealtHandlerPatchRevive
	{
		private static void Prefix(HealthHandler __instance, bool isFullRevive = true)
		{
			//IL_001c: 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)
			if (isFullRevive)
			{
				((CharacterData)Traverse.Create((object)__instance).Field("data").GetValue()).stats.GetAdditionalData().remainingTotems = ((CharacterData)Traverse.Create((object)__instance).Field("data").GetValue()).stats.GetAdditionalData().totems;
			}
		}
	}
	[Serializable]
	[HarmonyPatch(typeof(HealthHandler), "RPCA_SendTakeDamage")]
	internal class HealtHandlerPatchRPCASendTakeDamage
	{
		internal static Player GetPlayerWithID(int playerID)
		{
			for (int i = 0; i < PlayerManager.instance.players.Count; i++)
			{
				if (PlayerManager.instance.players[i].playerID == playerID)
				{
					return PlayerManager.instance.players[i];
				}
			}
			return null;
		}

		private static void SimGun(Player player, Vector2 damage)
		{
			//IL_001f: 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_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			SimulatedGun[] array = (SimulatedGun[])(object)new SimulatedGun[1];
			if ((Object)(object)array[0] == (Object)null)
			{
				array[0] = new GameObject("DamageGun").AddComponent<SimulatedGun>();
			}
			SimulatedGun val = array[0];
			Gun gun = player.data.weaponHandler.gun;
			val.CopyGunStatsExceptActions(gun);
			val.CopyAttackAction(gun);
			val.CopyShootProjectileAction(gun);
			((Gun)val).objectsToSpawn = ((Gun)val).objectsToSpawn.Concat(SimulatedGunTest.StopRecursionSpawn).ToArray();
			((Gun)val).bursts = 0;
			((Gun)val).numberOfProjectiles = 1;
			((Gun)val).damage = Mathf.Clamp(((Vector2)(ref damage)).magnitude / 110f, 0f, player.data.health / 55f);
			((Gun)val).reflects = 0;
			((Gun)val).chargeNumberOfProjectilesTo = 0f;
			if (player.data.view.IsMine || PhotonNetwork.OfflineMode)
			{
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(player.data.input.aimDirection.x, player.data.input.aimDirection.y, 0f);
				Debug.Log((object)("X " + val2.x + " Y " + val2.y + " Damage " + ((Vector2)(ref damage)).magnitude));
				val.SimulatedAttack(player.playerID, Vector2.op_Implicit(new Vector2(((Component)player).transform.position.x + 1.5f, ((Component)player).transform.position.y)), new Vector3(1f, 0f, 0f), 1f, 1f, (Transform)null, false);
				val.SimulatedAttack(player.playerID, Vector2.op_Implicit(new Vector2(((Component)player).transform.position.x - 1.5f, ((Component)player).transform.position.y)), new Vector3(-1f, 0f, 0f), 1f, 1f, (Transform)null, false);
				val.SimulatedAttack(player.playerID, Vector2.op_Implicit(new Vector2(((Component)player).transform.position.x + 1.5f, ((Component)player).transform.position.y + 0.5f)), new Vector3(0.5f, 1f, 0f), 1f, 1f, (Transform)null, false);
				val.SimulatedAttack(player.playerID, Vector2.op_Implicit(new Vector2(((Component)player).transform.position.x - 1.5f, ((Component)player).transform.position.y + 0.5f)), new Vector3(-0.5f, 1f, 0f), 1f, 1f, (Transform)null, false);
			}
		}

		private static void Prefix(HealthHandler __instance, ref Vector2 damage, Vector2 position, bool lethal, int playerID)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			CharacterData val = (CharacterData)Traverse.Create((object)__instance).Field("data").GetValue();
			Player player = val.player;
			Player playerWithID = GetPlayerWithID(playerID);
			damage = new Vector2(Math.Abs(damage.x) + Math.Abs(damage.y), 0f);
			if ((Object)(object)playerWithID != (Object)null && playerWithID.data.stats.GetAdditionalData().firstDamage)
			{
				playerWithID.data.stats.GetAdditionalData().damageMult = playerWithID.data.stats.GetAdditionalData().damageMultMax;
				playerWithID.data.stats.GetAdditionalData().firstDamage = false;
			}
			if ((Object)(object)playerWithID != (Object)null && playerWithID.data.stats.GetAdditionalData().reducingDmg)
			{
				damage *= playerWithID.data.stats.GetAdditionalData().damageMult;
				if (playerWithID.data.stats.GetAdditionalData().damageMult > 0.05f)
				{
					playerWithID.data.stats.GetAdditionalData().damageMult -= playerWithID.data.stats.GetAdditionalData().reducingDmgAmt;
				}
				if (playerWithID.data.stats.GetAdditionalData().damageMult < 0.05f)
				{
					playerWithID.data.stats.GetAdditionalData().damageMult = 0.05f;
				}
			}
			if (player.data.stats.GetAdditionalData().damagingBullet)
			{
				SimGun(player, damage);
			}
		}
	}
}
namespace ChaosPoppycarsCards.Lightsaber
{
	public class A_HoldableObject : MonoBehaviour
	{
		public static GameObject weapon;

		public UnityEvent eventTrigger;

		public const float Volume = 0.5f;

		internal const float SwitchDelay = 0.25f;

		private float StabTimer = 0f;

		private Player Player;

		private bool wasOut = false;

		public bool IsOut { get; private set; } = false;


		public float switchTimer { get; private set; } = 0f;


		internal static IEnumerator RemoveAllHoldableObjects(IGameModeHandler gm)
		{
			PlayerManager.instance.ForEachPlayer(delegate(Player p)
			{
				try
				{
					MakeGunHoldable(p.playerID, holdableObj: false);
				}
				catch
				{
				}
			});
			yield break;
		}

		private void Start()
		{
			IsOut = false;
			StabTimer = 0f;
			switchTimer = 0f;
			Player = ((Component)this).GetComponentInParent<Player>();
		}

		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)
			{
				switchTimer = (IsOut ? 0f : 0.25f);
				IsOut = !IsOut;
				if (IsOut)
				{
					eventTrigger.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_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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 val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == playerID));
			if (val != null)
			{
				A_HoldableObject componentInChildren = ((Component)val).GetComponentInChildren<A_HoldableObject>();
				Gun component = ((Component)((Component)val).GetComponent<Holding>().holdable).GetComponent<Gun>();
				GameObject gameObject = ((Component)((Component)component).transform.Find("Spring")).gameObject;
				RightLeftMirrorSpring component2 = ((Component)gameObject.transform.GetChild(2)).GetComponent<RightLeftMirrorSpring>();
				Transform obj = gameObject.transform.Find("Lightsaber(Clone)");
				GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null);
				if (val2 == null)
				{
					val2 = Object.Instantiate<GameObject>(ChaosPoppycarsCards.ArtAssets.LoadAsset<GameObject>("Lightsaber"), gameObject.transform);
					ObjectMirror orAddComponent = ExtensionMethods.GetOrAddComponent<ObjectMirror>(val2, false);
					ObjectSlash orAddComponent2 = ExtensionMethods.GetOrAddComponent<ObjectSlash>(val2, false);
					orAddComponent2.mirror = orAddComponent;
					GameObject gameObject2 = ((Component)val2.transform.Find("Blade")).gameObject;
					ObjectCollider orAddComponent3 = ExtensionMethods.GetOrAddComponent<ObjectCollider>(((Component)gameObject2.transform.Find("Collider")).gameObject, false);
					BladeColor orAddComponent4 = ExtensionMethods.GetOrAddComponent<BladeColor>(gameObject2, false);
					orAddComponent4.playerID = playerID;
				}
				val2.SetActive(holdableObj);
				MoveToHide(gameObject.transform.Find("Ammo/Canvas"), holdableObj);
				MoveToHide(gameObject.transform.GetChild(2), holdableObj);
				MoveToHide(gameObject.transform.GetChild(3), holdableObj);
				((Behaviour)((Component)gameObject.transform.GetChild(2)).GetComponent<RightLeftMirrorSpring>()).enabled = !holdableObj;
				((Behaviour)((Component)gameObject.transform.GetChild(3)).GetComponent<RightLeftMirrorSpring>()).enabled = !holdableObj;
				component.GetData().disabled = holdableObj;
			}
		}

		private void OnDestroy()
		{
			if (Player != null)
			{
				RPCA_Switch_To_Holdable(Player.playerID, holdableObj: false);
				Gun component = ((Component)((Component)Player).GetComponent<Holding>().holdable).GetComponent<Gun>();
				GameObject gameObject = ((Component)((Component)component).transform.Find("Spring")).gameObject;
				Transform obj = gameObject.transform.Find("Lightsaber(Clone)");
				GameObject val = ((obj != null) ? ((Component)obj).gameObject : null);
				if (val != null)
				{
					Object.Destroy((Object)(object)val);
				}
			}
		}
	}
	internal class BladeColor : MonoBehaviour
	{
		public static Player player;

		public int playerID;

		private static Color color;

		private static PlayerSkin skin;

		private static SpriteRenderer render;

		private void Start()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			player = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == 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);
		}

		[UnboundRPC]
		internal static void RPCA_UpdateBladeColor(Color color)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			render.color = color;
		}

		public static void UpdateBladeColor()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			RPCA_UpdateBladeColor(color);
		}
	}
	internal class ObjectCollider : MonoBehaviour
	{
		private ObjectSlash objectStab;

		internal Collider2D collider;

		private void Start()
		{
			objectStab = ((Component)this).GetComponentInParent<ObjectSlash>();
			collider = ((Component)this).GetComponent<Collider2D>();
			collider.isTrigger = false;
			collider.attachedRigidbody.mass = 500f;
			((Component)this).gameObject.layer = LayerMask.NameToLayer("PlayerObjectCollider");
			Collider2D[] componentsInChildren = ((Component)objectStab.player).GetComponentsInChildren<Collider2D>();
			foreach (Collider2D val in componentsInChildren)
			{
				Physics2D.IgnoreCollision(collider, val);
			}
		}

		private void OnTriggerEnter2D(Collider2D collider2D)
		{
			objectStab?.TrySlash(collider2D);
		}

		private void OnTriggerStay2D(Collider2D collider2D)
		{
			objectStab?.TrySlash(collider2D);
		}

		private void OnCollisionEnter2D(Collision2D collision)
		{
			objectStab?.TrySlash(collision);
		}

		private void OnCollisionStay2D(Collision2D collision)
		{
			objectStab?.TrySlash(collision);
		}
	}
	internal class ObjectMirror : MonoBehaviour
	{
		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);

		private const float LeftRot = 300f;

		private const float RightRot = 225f;

		internal float rotMod = 0f;

		internal Vector3 positionMod = Vector3.zero;

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

		private void Update()
		{
			//IL_0036: 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_0073: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: 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_0117: 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;
			}
		}
	}
	internal class ObjectSlash : MonoBehaviour
	{
		private A_HoldableObject holdableObj;

		private ObjectCollider objCollider;

		private const float slashAnimDuration = 0.25f;

		private const float slashCooldown = 0.3f;

		private float sinceSlash = 0.3f;

		private bool canDoDamage = false;

		private bool slashing = false;

		private Holdable holdable;

		internal Player player;

		private GeneralInput input;

		internal ObjectMirror mirror;

		private static 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 float slashForceMult = 1500f;

		private float nonslashForceMult = 500f;

		private void Start()
		{
			objCollider = ((Component)((Component)this).gameObject.transform.Find("Blade")).GetComponentInChildren<ObjectCollider>();
		}

		private void OnEnable()
		{
			player = ((Component)((Component)((Component)this).transform.root).GetComponent<Holdable>().holder).GetComponent<Player>();
			holdableObj = ((Component)player).GetComponentInChildren<A_HoldableObject>();
			input = player.data.input;
			slashing = false;
		}

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

		[UnboundRPC]
		private static void RPCO_DoSlashAnim(int playerID)
		{
			Player playerWithID = PlayerManager.instance.GetPlayerWithID(playerID);
			if (playerWithID != null)
			{
				ObjectSlash component = ((Component)((Component)playerWithID.data.weaponHandler.gun).transform.GetChild(1).Find("Lightsaber(Clone)")).GetComponent<ObjectSlash>();
				component.DoSlashAnim();
			}
		}

		internal void DoSlashAnim()
		{
			((MonoBehaviour)this).StartCoroutine(IDoSlashAnim());
		}

		private IEnumerator IDoSlashAnim()
		{
			slashing = true;
			hitPlayers = new List<Player>();
			if (holdable == null)
			{
				holdable = ((Component)((Component)this).transform.root).GetComponent<Holdable>();
			}
			float time = 0f;
			float c = Mathf.Clamp(time / 0.25f, 0f, 1f);
			_ = ((Component)this).transform.root.position.x - 0.1f < ((Component)holdable.holder).transform.position.x;
			mirror.rotMod = slashCurves[2].Evaluate(c);
			while (time < 0.25f)
			{
				yield return null;
				time += TimeHandler.deltaTime;
				float prev = c;
				c = Mathf.Clamp(time / 0.25f, 0f, 1f);
				bool left = ((Component)this).transform.root.position.x - 0.1f < ((Component)holdable.holder).transform.position.x;
				((Component)this).transform.root.position = player.data.hand.position;
				new Vector3(slashCurves[1].Evaluate(prev), slashCurves[0].Evaluate(prev) * (left ? (-1f) : 1f), 0f);
				Vector3 heading = new Vector3(slashCurves[1].Evaluate(c), slashCurves[0].Evaluate(c) * (left ? (-1f) : 1f), 0f);
				Transform root = ((Component)this).transform.root;
				root.position += Quaternion.Euler(0f, 0f, Vector2.Angle(Vector2.op_Implicit(((Vector3)(ref player.data.aimDirection)).normalized), Vector2.op_Implicit(((Vector3)(ref heading)).normalized))) * heading;
				mirror.rotMod = slashCurves[2].Evaluate(c);
				heading = default(Vector3);
			}
			mirror.rotMod = 0f;
			slashing = false;
		}

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

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

		internal void TrySlash(Collision2D collision)
		{
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			Collider2D collider2D = collision.collider;
			if (!player.data.view.IsMine || collider2D == null || hitColliders.Contains(collider2D) || collision.contactCount <= 0)
			{
				return;
			}
			hitColliders.Add(collider2D);
			ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)ChaosPoppycarsCards.Instance, 0.25f, (Action)delegate
			{
				hitColliders.Remove(collider2D);
			});
			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 (Object.op_Implicit((Object)(object)((Component)((Component)collider2D).transform.root).GetComponentInChildren<Damagable>()) && slashing)
			{
				((Component)((Component)collider2D).transform.root).GetComponentInChildren<Damagable>().CallTakeDamage(Vector2.up * 55f, Vector2.op_Implicit(((Component)this).gameObject.transform.position), (GameObject)null, player, true);
			}
		}

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

		internal void HandleBox(Rigidbody2D box, Collision2D collision)
		{
			//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)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((Component)box).GetComponent<Damagable>()) && slashing)
			{
				Damagable component = ((Component)box).GetComponent<Damagable>();
				float num = 55f * player.data.weaponHandler.gun.damage * player.data.weaponHandler.gun.bulletDamageMultiplier;
				Vector2 val = ((ContactPoint2D)(ref collision.contacts[0])).point - Vector2.op_Implicit(((Component)this).transform.position);
				component.CallTakeDamage(num * ((Vector2)(ref val)).normalized, ((ContactPoint2D)(ref collision.contacts[0])).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 * (slashing ? slashForceMult : nonslashForceMult) / (float)contacts, ((ContactPoint2D)(ref array[i])).point);
			}
		}

		internal void HandleBullet(ProjectileHit bullet, Collision2D collision)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			if (slashedPlayerID == -1)
			{
				return;
			}
			Player val = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == slashingPlayerID));
			Player val2 = ((IEnumerable<Player>)PlayerManager.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.playerID == slashedPlayerID));
			if (val2 == null || val == null)
			{
				return;
			}
			HealthHandler healthHandler = val2.data.healthHandler;
			Vector2 val3 = Vector2.op_Implicit(val.data.weaponHandler.gun.damage * val.data.weaponHandler.gun.bulletDamageMultiplier * 55f * val.data.weaponHandler.gun.shootPosition.forward);
			Vector2 val4 = Vector2.op_Implicit(((Component)val2).transform.position);
			Color white = Color.white;
			CharacterData data = val.data;
			object obj;
			if (data == null)
			{
				obj = null;
			}
			else
			{
				WeaponHandler weaponHandler = data.weaponHandler;
				if (weaponHandler == null)
				{
					obj = null;
				}
				else
				{
					Gun gun = weaponHandler.gun;
					if (gun == null)
					{
						obj = null;
					}
					else
					{
						Transform transform = ((Component)gun).transform;
						if (transform == null)
						{
							obj = null;
						}
						else
						{
							Transform child = transform.GetChild(1);
							if (child == null)
							{
								obj = null;
							}
							else
							{
								Transform obj2 = child.Find("Lightsaber(Clone)");
								obj = ((obj2 != null) ? ((Component)obj2).gameObject : null);
							}
						}
					}
				}
			}
			healthHandler.DoDamage(val3, val4, white, (GameObject)obj, val, false, true, true);
		}
	}
}
namespace ChaosPoppycarsCards.Lightsaber.Patches
{
	internal class AttackPatch
	{
		[HarmonyPatch(typeof(Gun), "Attack")]
		private class GunPatchAttack
		{
			private static bool Prefix(Gun __instance)
			{
				return !__instance.GetData().disabled;
			}
		}
	}
}
namespace ChaosPoppycarsCards.Lightsaber.Extensions
{
	public class GunAdditionalData
	{
		public bool disabled = false;
	}
	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;
		}
	}
	internal 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);
			}
		}
	}
}
namespace ChaosPoppycarsCards.MonoBehaviours
{
	public class WarpathMono : MonoBehaviour
	{
		private CharacterData data;

		private Player player;

		private Block block;

		private WeaponHandler weaponHandler;

		private Gun gun;

		private void Start()
		{
			data = ((Component)this).gameObject.GetComponentInParent<CharacterData>();
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)player) && data != null)
			{
				player = data.player;
				block = data.block;
				weaponHandler = data.weaponHandler;
				gun = weaponHandler.gun;
				Gun obj = gun;
				obj.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(obj.ShootPojectileAction, new Action<GameObject>(OnShootProjectileAction));
			}
		}

		private void OnShootProjectileAction(GameObject obj)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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)
			Vector2 val = (Vector2)ExtensionMethods.GetFieldValue((object)data.playerVel, "velocity");
			Vector2 val2 = Vector2.op_Implicit(data.input.aimDirection);
			float num = Vector2.Angle(((Vector2)(ref val)).normalized, ((Vector2)(ref val2)).normalized);
			float num2 = (90f - num) / 90f;
			float num3 = ((Vector2)(ref val)).magnitude / 17f;
			ProjectileHit component = obj.GetComponent<ProjectileHit>();
			component.damage *= num3 + num2 * num3;
		}
	}
	public class SpeedstersGunMono : MonoBehaviour
	{
		private CharacterData data;

		private Player player;

		private Block block;

		private WeaponHandler weaponHandler;

		private Gun gun;

		private void Start()
		{
			data = ((Component)this).gameObject.GetComponentInParent<CharacterData>();
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)player) && data != null)
			{
				player = data.player;
				block = data.block;
				weaponHandler = data.weaponHandler;
				gun = weaponHandler.gun;
				Gun obj = gun;
				obj.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(obj.ShootPojectileAction, new Action<GameObject>(OnShootProjectileAction));
			}
		}

		private void OnShootProjectileAction(GameObject obj)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			MoveTransform move = obj.GetComponentInChildren<MoveTransform>();
			Vector2 val = (Vector2)ExtensionMethods.GetFieldValue((object)data.playerVel, "velocity");
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)ChaosPoppycarsCards.Instance, 1, (Action)delegate
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: 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)
				//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)
				MoveTransform obj2 = move;
				obj2.velocity += Vector2.op_Implicit((Vector2)ExtensionMethods.GetFieldValue((object)data.playerVel, "velocity"));
			});
		}
	}
	public class SpeedyHandsBUFFMono : ReversibleEffect
	{
		public float movespeed;

		public override void OnStart()
		{
			movespeed = base.player.data.stats.movementSpeed;
			if (movespeed > 1f)
			{
				GunAmmoStatModifier gunAmmoStatModifier = base.gunAmmoStatModifier;
				gunAmmoStatModifier.reloadTimeMultiplier_mult *= 1f / (movespeed / 2f) * 0.3f * 3f;
			}
		}

		public override void OnOnDisable()
		{
			((ReversibleEffect)this).Destroy();
		}
	}
	public class SpeedyHandsMono : MonoBehaviour
	{
		private readonly float updateDelay = 0.1f;

		public float startTime = Time.time;

		public SpeedyHandsBUFFMono prevBuff;

		public float movespeed;

		public void Update()
		{
			if (Time.time >= startTime + updateDelay)
			{
				ResetTimer();
				if ((Object)(object)((Component)((Component)this).GetComponent<Player>()).GetComponent<SpeedyHandsBUFFMono>() != (Object)null)
				{
					((ReversibleEffect)((Component)((Component)this).GetComponent<Player>()).GetComponent<SpeedyHandsBUFFMono>()).Destroy();
				}
				((Component)((Component)((Component)this).GetComponent<Player>()).transform).gameObject.AddComponent<SpeedyHandsBUFFMono>();
			}
		}

		private void ResetTimer()
		{
			startTime = Time.time;
		}
	}
	public class TriggerFingerBUFFMono : ReversibleEffect
	{
		public float movespeed;

		public override void OnStart()
		{
			movespeed = base.player.data.stats.movementSpeed;
			if (movespeed > 1f)
			{
				GunStatModifier gunStatModifier = base.gunStatModifier;
				gunStatModifier.attackSpeed_mult *= 1f / (movespeed / 2.5f) * 0.5f * 1.5f;
			}
		}

		public override void OnOnDisable()
		{
			((ReversibleEffect)this).Destroy();
		}
	}
	public class TriggerFingerMono : MonoBehaviour
	{
		private readonly float updateDelay = 0.1f;

		public float startTime = Time.time;

		public TriggerFingerBUFFMono prevBuff;

		public float movespeed;

		public void Update()
		{
			if (Time.time >= startTime + updateDelay)
			{
				ResetTimer();
				if ((Object)(object)((Component)((Component)this).GetComponent<Player>()).GetComponent<TriggerFingerBUFFMono>() != (Object)null)
				{
					((ReversibleEffect)((Component)((Component)this).GetComponent<Player>()).GetComponent<TriggerFingerBUFFMono>()).Destroy();
				}
				((Component)((Component)((Component)this).GetComponent<Player>()).transform).gameObject.AddComponent<TriggerFingerBUFFMono>();
			}
		}

		private void ResetTimer()
		{
			startTime = Time.time;
		}
	}
	[DisallowMultipleComponent]
	public class CriticalHitBehaviour : MonoBehaviour
	{
		private float critMultiplier = 1f;

		private static bool isCriticalHit;

		private static bool isDoubleCrit;

		private int shoots;

		private float consecutiveCritDamage = 0f;

		private Gun gun;

		private Player player;

		private SpawnedAttack spawnedAttack;

		private HealthHandler healthHandler;

		private const string MessageEvent = "YourMod_MessageEvent";

		public void Start()
		{
			player = ((Component)this).GetComponentInParent<Player>();
			gun = player.data.weaponHandler.gun;
			Gun obj = gun;
			obj.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(obj.ShootPojectileAction, new Action<GameObject>(OnShootProjectileAction));
			healthHandler = player.data.healthHandler;
			isCriticalHit = false;
			isDoubleCrit = false;
		}

		[UnboundRPC]
		public static void SyncCriticalHit(bool ISCRIT)
		{
			isCriticalHit = ISCRIT;
		}

		[UnboundRPC]
		public static void SyncDoubleCrit(bool ISDOUBLECRIT)
		{
			isDoubleCrit = ISDOUBLECRIT;
		}

		public void OnShootProjectileAction(GameObject obj)
		{
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			spawnedAttack = obj.GetComponent<SpawnedAttack>();
			if (!Object.op_Implicit((Object)(object)spawnedAttack))
			{
				spawnedAttack = obj.AddComponent<SpawnedAttack>();
			}
			ProjectileHit bullet = obj.GetComponent<ProjectileHit>();
			MoveTransform move = obj.GetComponent<MoveTransform>();
			if (PhotonNetwork.IsMasterClient)
			{
				isCriticalHit = Random.value < gun.GetAdditionalData().criticalHitChance1;
				if (gun.GetAdditionalData().guranteedCrits)
				{
					isCriticalHit = true;
					critMultiplier = 0f;
				}
				NetworkingManager.RPC(typeof(CriticalHitBehaviour), "SyncCriticalHit", new object[1] { isCriticalHit });
				if (!gun.GetAdditionalData().guranteedCrits && gun.GetAdditionalData().criticalHitChance1 > 1f)
				{
					float num = (gun.GetAdditionalData().criticalHitChance1 - 1f) % 1f;
					isDoubleCrit = Random.value < num;
					NetworkingManager.RPC(typeof(CriticalHitBehaviour), "SyncDoubleCrit", new object[1] { isDoubleCrit });
				}
			}
			if (shoots > 0)
			{
				shoots--;
			}
			critMultiplier = 0f;
			if (isCriticalHit)
			{
				spawnedAttack.SetColor(gun.GetAdditionalData().CritColor);
				if ((gun.GetAdditionalData().criticalHitChance1 >= 1.1f) & !gun.GetAdditionalData().guranteedCrits)
				{
					int num2 = (int)Math.Round(gun.GetAdditionalData().criticalHitChance1);
					if (isDoubleCrit)
					{
						critMultiplier += (float)num2 + 1f;
						spawnedAttack.SetColor(gun.GetAdditionalData().DoubleCritColor);
					}
					else
					{
						critMultiplier += num2;
						if (gun.GetAdditionalData().consecutiveCrits)
						{
							consecutiveCritDamage = 0f;
						}
					}
				}
				else
				{
					critMultiplier = 0f;
				}
				RayCastTrail component = obj.GetComponent<RayCastTrail>();
				if (gun.GetAdditionalData().CritColor == Color.clear)
				{
					component.mask = component.ignoreWallsMask;
				}
				bullet.unblockable = gun.GetAdditionalData().unblockableCrits;
				if (critMultiplier > 1.1f)
				{
					if (gun.GetAdditionalData().criticalBulletSpeed > 1f)
					{
						MoveTransform obj2 = move;
						obj2.localForce *= gun.GetAdditionalData().criticalBulletSpeed * critMultiplier;
					}
				}
				else
				{
					MoveTransform obj3 = move;
					obj3.localForce *= gun.GetAdditionalData().criticalBulletSpeed;
				}
				if (gun.GetAdditionalData().criticalHitBounces >= 1)
				{
					if (gun.reflects <= 0)
					{
						RayHitReflect val = obj.gameObject.AddComponent<RayHitReflect>();
						if (critMultiplier > 1.1f)
						{
							val.reflects += gun.GetAdditionalData().criticalHitBounces * (int)Math.Round(critMultiplier) - 1;
							val.dmgM += gun.GetAdditionalData().criticalHitDamageOnBounce;
						}
						else
						{
							val.reflects += gun.GetAdditionalData().criticalHitBounces - 1;
							val.dmgM += gun.GetAdditionalData().criticalHitDamageOnBounce;
						}
					}
					if (gun.reflects >= 1)
					{
						RayHitReflect component2 = obj.gameObject.GetComponent<RayHitReflect>();
						if (critMultiplier > 1.1f)
						{
							component2.reflects += gun.GetAdditionalData().criticalHitBounces * (int)Math.Round(critMultiplier);
							component2.dmgM += gun.GetAdditionalData().criticalHitDamageOnBounce;
						}
						else
						{
							component2.reflects += gun.GetAdditionalData().criticalHitBounces;
							component2.dmgM += gun.GetAdditionalData().criticalHitDamageOnBounce;
						}
					}
				}
			}
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)ChaosPoppycarsCards.Instance, 3, (Action)delegate
			{
				//IL_0026: 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_0363: Unknown result type (might be due to invalid IL or missing references)
				//IL_037d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0382: Unknown result type (might be due to invalid IL or missing references)
				//IL_028e: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
				if (isCriticalHit)
				{
					spawnedAttack.SetColor(gun.GetAdditionalData().CritColor);
					if (isDoubleCrit)
					{
						spawnedAttack.SetColor(gun.GetAdditionalData().DoubleCritColor);
					}
				}
				if (isCriticalHit)
				{
					if (critMultiplier > 1.1f)
					{
						if (gun.GetAdditionalData().criticalHitDamage1 > 0f)
						{
							ProjectileHit obj4 = bullet;
							obj4.damage *= gun.GetAdditionalData().criticalHitDamage1 * critMultiplier;
						}
						if (gun.GetAdditionalData().consecutiveCrits)
						{
							ProjectileHit obj5 = bullet;
							obj5.damage += consecutiveCritDamage;
						}
					}
					else
					{
						if (gun.GetAdditionalData().criticalHitDamage1 > 0f)
						{
							ProjectileHit obj6 = bullet;
							obj6.damage *= gun.GetAdditionalData().criticalHitDamage1;
						}