Decompiled source of RoundsCombatOverhaul v1.0.1

RoundsCombatOverhaul.dll

Decompiled a day 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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using InControl;
using Jotunn.Utils;
using Photon.Pun;
using RCO.Extensions;
using RCO.MonoBehaviours;
using RCO.VFX;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RoundsCombatOverhaul")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RoundsCombatOverhaul")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("51e474ab-3930-476c-9d1f-1f2512ab5426")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RCO
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("Rounds.exe")]
	[BepInPlugin("pudassassin.and.root.RoundsCombatOverhaul", "Rounds Combat Overhaul", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		public static GameObject playerMonitor;

		public static GameObject playerObj;

		public const string ModId = "pudassassin.and.root.RoundsCombatOverhaul";

		public const string ModName = "Rounds Combat Overhaul";

		public const string Version = "1.0.0";

		public static readonly AssetBundle RCOAsset = AssetUtils.LoadAssetBundleFromResources("rco_asset", typeof(Main).Assembly);

		public static GameObject GrapplingRopePrefab = RCOAsset.LoadAsset<GameObject>("GrapplingSource");

		public static GameObject LoseControlVFXPrefab = RCOAsset.LoadAsset<GameObject>("VFX_Confused");

		public static GameObject DisarmedVFXPrefab = RCOAsset.LoadAsset<GameObject>("VFX_Disarmed");

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("pudassassin.and.root.RoundsCombatOverhaul");
			val.PatchAll();
		}

		private void Start()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			LevelManager.RegisterMaps(AssetUtils.LoadAssetBundleFromResources("rco_maps", typeof(Main).Assembly), "RCO");
			playerMonitor = new GameObject("[RCO] PlayerMonitor");
			playerMonitor.AddComponent<LoseControlMonitor>();
			Object.DontDestroyOnLoad((Object)(object)playerMonitor);
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 5, (Action)delegate
			{
				List<string> list = (List<string>)typeof(LevelManager).GetField("categories", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
				list.ForEach(delegate(string c)
				{
					if (c != "RCO")
					{
						LevelManager.DisableCategory(c);
					}
				});
			});
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 95, (Action)delegate
			{
				GameObject[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[];
				GameObject[] array2 = array;
				foreach (GameObject val in array2)
				{
					if (((Object)val).name == "Player" && val.CompareTag("Player"))
					{
						playerObj = val;
						break;
					}
				}
				GeneralInput component = playerObj.GetComponent<GeneralInput>();
				SilenceHandler component2 = playerObj.GetComponent<SilenceHandler>();
				if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null)
				{
					LoseControlHandler loseControlHandler = playerObj.AddComponent<LoseControlHandler>();
					playerObj.AddComponent<RCO_RPCA_Handler>();
				}
			});
		}

		private void Update()
		{
		}
	}
}
namespace RCO.VFX
{
	public class GrapplingRopeVFX : MonoBehaviour
	{
		public float vertexPerUnit = 5f;

		public GameObject targetObject = null;

		public float ropeAmpScaling = 0.1f;

		public float ropeWaveRate = 0.2f;

		public float ropeSwingRate = 25f;

		public float ropeSnapTime = 0.15f;

		public float ropeOvershotTime = 0.1f;

		public float ropeOvershotFactor = 1.25f;

		public float ropeSpeed = 150f;

		private int ropeVertexCount = 0;

		private List<Vector3> ropeVertexList;

		private float ropeCurrentAmpMult = 1f;

		private float ropeCurrentAmpMax;

		private float ropeSwingTimer = 0f;

		private float ropeLatchTimer = 0f;

		private bool isRopeLatched = false;

		private bool isRopeRetracting = false;

		private bool isAnimationDone = false;

		private LineRenderer lineRenderer;

		public Vector3 targetLastPos;

		private Vector3 ropeEndPos;

		private Vector3 ropeLine;

		private Vector3 ropeWaveVector;

		private void Start()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			lineRenderer = ((Component)this).gameObject.GetComponent<LineRenderer>();
			if (!((Object)(object)targetObject == (Object)null))
			{
				targetLastPos = targetObject.transform.position;
			}
			ropeEndPos = ((Component)this).transform.position;
		}

		private void Update()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: 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_0246: 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_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			if (isAnimationDone)
			{
				return;
			}
			if ((Object)(object)targetObject != (Object)null)
			{
				targetLastPos = targetObject.transform.position;
			}
			ropeLine = ropeEndPos - ((Component)this).transform.position;
			ropeLine.z = 0f;
			Vector3 val = RotateVector(ropeLine, 90f);
			ropeWaveVector = ((Vector3)(ref val)).normalized;
			ropeCurrentAmpMax = ropeAmpScaling * ((Vector3)(ref ropeLine)).magnitude;
			ropeVertexCount = Mathf.CeilToInt(((Vector3)(ref ropeLine)).magnitude * vertexPerUnit);
			ropeVertexList = new List<Vector3>();
			for (int i = 0; i <= ropeVertexCount; i++)
			{
				float num = (float)i / (float)ropeVertexCount;
				float num2 = Mathf.Sin((float)Math.PI * num) * ropeCurrentAmpMax * ropeCurrentAmpMult;
				float num3 = ((Vector3)(ref ropeLine)).magnitude * ropeWaveRate;
				float num4 = ropeSwingTimer * ropeSwingRate;
				float num5 = Mathf.Sin((float)Math.PI * num3 * num - num4) * num2;
				Vector3 item = ((Component)this).transform.position + ropeLine * (float)i / (float)ropeVertexCount + ropeWaveVector * num5;
				ropeVertexList.Add(item);
			}
			lineRenderer.positionCount = ropeVertexList.Count;
			lineRenderer.SetPositions(ropeVertexList.ToArray());
			if (!isRopeLatched)
			{
				float num6 = ropeSpeed * TimeHandler.deltaTime;
				val = targetLastPos - ropeEndPos;
				if (((Vector3)(ref val)).magnitude < num6)
				{
					ropeEndPos = targetLastPos;
					isRopeLatched = true;
				}
				else
				{
					Vector3 val2 = ropeEndPos;
					val = targetLastPos - ropeEndPos;
					ropeEndPos = val2 + ((Vector3)(ref val)).normalized * num6;
				}
			}
			if (!isRopeRetracting)
			{
				ropeSwingTimer += TimeHandler.deltaTime;
				ropeCurrentAmpMult = 1f;
			}
			else
			{
				float num7 = ropeSpeed * TimeHandler.deltaTime;
				val = ((Component)this).transform.position - ropeEndPos;
				if (((Vector3)(ref val)).magnitude < num7)
				{
					isAnimationDone = true;
					((Renderer)lineRenderer).enabled = false;
					Object.Destroy((Object)(object)((Component)this).gameObject);
					return;
				}
				Vector3 val3 = ropeEndPos;
				val = ((Component)this).transform.position - ropeEndPos;
				ropeEndPos = val3 + ((Vector3)(ref val)).normalized * num7;
			}
			if (isRopeLatched)
			{
				ropeLatchTimer = Mathf.Clamp(ropeLatchTimer + TimeHandler.deltaTime, 0f, ropeSnapTime + ropeOvershotTime);
				if (ropeLatchTimer < ropeSnapTime)
				{
					ropeCurrentAmpMult = (ropeSnapTime - ropeLatchTimer) / ropeSnapTime;
				}
				else
				{
					float num8 = ropeLatchTimer - ropeSnapTime;
					ropeCurrentAmpMult = (0f - Mathf.Sin((float)Math.PI * (num8 / ropeOvershotTime))) * ropeCurrentAmpMax * ropeOvershotFactor;
				}
				if (ropeLatchTimer + TimeHandler.deltaTime > ropeOvershotTime)
				{
					isRopeRetracting = true;
				}
			}
		}

		private static Vector3 RotateVector(Vector3 vector, float degree)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Sin(degree * ((float)Math.PI / 180f));
			float num2 = Mathf.Cos(degree * ((float)Math.PI / 180f));
			float x = vector.x;
			float y = vector.y;
			vector.x = num2 * x - num * y;
			vector.y = num * x + num2 * y;
			return vector;
		}
	}
	public class SimpleStatusVFX : MonoBehaviour
	{
		public static float FadeTime = 0.05f;

		public static float FadeMinScale = 0.01f;

		private float animTimer = 0f;

		public bool visible = false;

		public GameObject targetObject = null;

		public Vector3 originalScale = Vector3.one;

		private void Start()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)targetObject != (Object)null)
			{
				originalScale = targetObject.transform.localScale;
			}
		}

		private void Update()
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)targetObject != (Object)null))
			{
				return;
			}
			if (visible)
			{
				animTimer += TimeHandler.deltaTime;
				if (animTimer > FadeTime)
				{
					animTimer = FadeTime;
				}
				if (animTimer > 0f)
				{
					targetObject.SetActive(true);
				}
			}
			else
			{
				animTimer -= TimeHandler.deltaTime;
				if (animTimer < 0f)
				{
					animTimer = 0f;
					targetObject.transform.localScale = Vector3.one * FadeMinScale;
					targetObject.SetActive(false);
					return;
				}
			}
			targetObject.transform.localScale = originalScale * animTimer / FadeTime;
		}
	}
}
namespace RCO.Patches
{
	[HarmonyPatch]
	public class BulletsPassThroughTeam
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(ProjectileHit), "Hit")]
		public static bool ProjectileHitPrefixHit(HitInfo hit, ProjectileHit __instance)
		{
			if (Object.op_Implicit((Object)(object)hit.transform))
			{
				HealthHandler component = ((Component)hit.transform).GetComponent<HealthHandler>();
				if ((Object)(object)component == (Object)null)
				{
					return true;
				}
				return ((Component)component).GetComponent<Player>().teamID != __instance.ownPlayer.teamID && ((Component)component).GetComponent<CharacterData>().GetOverhaulData().dashTime <= 0f;
			}
			return true;
		}
	}
	[HarmonyPatch]
	public class DefaultStatChanges
	{
		[HarmonyPatch(typeof(Player), "Start")]
		[HarmonyPostfix]
		public static void ResetPlayerOnStart(Player __instance)
		{
			ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Unbound.Instance, 5, (Action)delegate
			{
				ExtensionMethods.InvokeMethod((object)__instance, "FullReset", Array.Empty<object>());
			});
		}

		[HarmonyPatch(typeof(Player), "FullReset")]
		[HarmonyPostfix]
		public static void BasePlayerStats(Player __instance)
		{
			Gun gun = __instance.data.weaponHandler.gun;
			((Component)gun).GetComponentInChildren<GunAmmo>().maxAmmo = 6;
			((Component)gun).GetComponentInChildren<GunAmmo>().ReDrawTotalBullets();
			gun.projectileSpeed = 2.5f;
			__instance.data.jumps = 2;
			__instance.data.jump.upForce = 6600f;
			__instance.data.block.cooldown = 0.5f;
		}

		[HarmonyPatch(typeof(CharacterStatModifiers), "ConfigureMassAndSize")]
		[HarmonyPostfix]
		public static void LockSize(CharacterStatModifiers __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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)
			((Component)__instance).transform.localScale = Vector3.one * 1.2f * Mathf.Pow(2.4f, 0.2f);
		}

		[HarmonyPatch(typeof(PlayerJump), "Jump")]
		[HarmonyPrefix]
		public static bool SlowJump(PlayerJump __instance)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return ((CharacterData)ExtensionMethods.GetFieldValue((object)__instance, "data")).sinceJump > 0.1f;
		}
	}
	[HarmonyPatch(typeof(GeneralInput))]
	internal class GeneralInput_Patch
	{
		[HarmonyPrefix]
		[HarmonyPriority(800)]
		[HarmonyPatch("Update")]
		private static bool Update_Prefix(CharacterData ___data, GeneralInput __instance)
		{
			if (__instance.controlledElseWhere)
			{
				return true;
			}
			if (___data.GetOverhaulData().isLostControl)
			{
				try
				{
					__instance.ResetInput();
					ExtensionMethods.InvokeMethod((object)__instance, "DoUIInput", Array.Empty<object>());
				}
				catch (Exception ex)
				{
					Debug.LogWarning((object)"GeneralInput::Update_Prefix : ResetInput failed");
					Debug.LogWarning((object)(ex.Message ?? ""));
				}
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPriority(800)]
		[HarmonyPatch("Update")]
		private static void Update_Postfix(CharacterData ___data, GeneralInput __instance)
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: 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_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0580: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_0596: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_064c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0651: Unknown result type (might be due to invalid IL or missing references)
			//IL_0664: Unknown result type (might be due to invalid IL or missing references)
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0672: Expected O, but got Unknown
			//IL_0684: Unknown result type (might be due to invalid IL or missing references)
			//IL_0689: Unknown result type (might be due to invalid IL or missing references)
			//IL_069a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d09: Invalid comparison between Unknown and I4
			//IL_0b37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b54: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b56: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5d: Expected O, but got Unknown
			//IL_0b6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b74: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b85: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b99: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c06: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c94: Unknown result type (might be due to invalid IL or missing references)
			//IL_0949: Unknown result type (might be due to invalid IL or missing references)
			//IL_094e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0961: Unknown result type (might be due to invalid IL or missing references)
			//IL_0966: Unknown result type (might be due to invalid IL or missing references)
			//IL_0968: Unknown result type (might be due to invalid IL or missing references)
			//IL_096f: Expected O, but got Unknown
			//IL_0981: Unknown result type (might be due to invalid IL or missing references)
			//IL_0986: Unknown result type (might be due to invalid IL or missing references)
			//IL_0997: Unknown result type (might be due to invalid IL or missing references)
			//IL_099c: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09be: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0775: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_075e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Unknown result type (might be due to invalid IL or missing references)
			//IL_0768: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_080e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dda: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddf: Unknown result type (might be due to invalid IL or missing references)
			//IL_10b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_10bc: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.controlledElseWhere)
			{
				return;
			}
			if (___data.GetOverhaulData().isGrappled)
			{
				___data.GetOverhaulData().grappleTimer += TimeHandler.deltaTime;
				if (___data.GetOverhaulData().grappleTimer > 1.5f)
				{
					___data.view.RPC("RPCA_GrappleState", (RpcTarget)0, new object[2]
					{
						___data.player.playerID,
						false
					});
				}
			}
			else
			{
				___data.GetOverhaulData().grappleTimer = 0f;
			}
			bool flag = (((int)__instance.inputType != 0) ? (((OneAxisInputControl)((PlayerActionSet)((Component)__instance).GetComponent<CharacterData>().playerActions)["Grapple"]).IsPressed && !((OneAxisInputControl)((PlayerActionSet)((Component)__instance).GetComponent<CharacterData>().playerActions)["Grapple"]).WasReleased) : (__instance.shootIsPressed && !__instance.shootWasReleased));
			bool flag2 = (((int)__instance.inputType == 0) ? __instance.shootWasReleased : ((OneAxisInputControl)((PlayerActionSet)((Component)__instance).GetComponent<CharacterData>().playerActions)["Grapple"]).WasReleased);
			___data.GetOverhaulData().grapleWasPressed = flag;
			___data.GetOverhaulData().grapleWasReleased = flag2;
			if (___data.GetOverhaulData().isImmobile)
			{
				__instance.direction = Vector3.zero;
				__instance.jumpIsPressed = false;
				__instance.jumpWasPressed = false;
			}
			if (___data.GetOverhaulData().isDisarmed)
			{
				__instance.shootIsPressed = false;
				__instance.shootWasPressed = false;
				__instance.shootWasReleased = false;
			}
			if (___data.GetOverhaulData().dashTime > 0f)
			{
				___data.GetOverhaulData().dashTime -= TimeHandler.deltaTime;
				___data.sinceGrounded = 0.05f;
				ExtensionMethods.InvokeMethod((object)___data.playerVel, "AddForce", new Type[2]
				{
					typeof(Vector2),
					typeof(ForceMode2D)
				}, new object[2]
				{
					___data.GetOverhaulData().dashDirection * TimeHandler.deltaTime * 8800000f,
					(object)(ForceMode2D)0
				});
				__instance.direction = Vector3.zero;
				___data.block.counter = 0f;
			}
			else
			{
				___data.GetOverhaulData().groundedSinceDash = ___data.GetOverhaulData().groundedSinceDash || ___data.isGrounded;
			}
			((Behaviour)((Component)___data).GetComponent<Gravity>()).enabled = ___data.GetOverhaulData().dashTime <= 0f && !___data.GetOverhaulData().isGrappled;
			if (___data.GetOverhaulData().isThrowing)
			{
				((Behaviour)((Component)___data).GetComponent<PlayerVelocity>()).enabled = false;
				((Behaviour)((Component)___data).GetComponent<Gravity>()).enabled = false;
			}
			else
			{
				((Behaviour)((Component)___data).GetComponent<PlayerVelocity>()).enabled = true;
				((Behaviour)((Component)___data).GetComponent<Gravity>()).enabled = true;
			}
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(((TwoAxisInputControl)___data.playerActions.Aim).X, ((TwoAxisInputControl)___data.playerActions.Aim).Y);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(((TwoAxisInputControl)___data.playerActions.Move).X, ((TwoAxisInputControl)___data.playerActions.Move).Y);
			if (flag && ___data.GetOverhaulData().groundedSinceGrapple && !___data.GetOverhaulData().isGrappling)
			{
				__instance.ResetInput();
				__instance.aimDirection = Vector2.op_Implicit(val);
				return;
			}
			if (flag2 && ___data.GetOverhaulData().groundedSinceGrapple && !___data.GetOverhaulData().isGrappling)
			{
				___data.GetOverhaulData().isGrappling = true;
				___data.GetOverhaulData().groundedSinceGrapple = ___data.isGrounded;
				___data.isGrounded = false;
				ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)Unbound.Instance, 1.5f, (Action)delegate
				{
					___data.GetOverhaulData().isGrappling = false;
				});
				float orthographicSize = MainCam.instance.cam.orthographicSize;
				int num = 3073;
				RaycastHit2D hit = Physics2D.Raycast(Vector2.op_Implicit(((Component)___data.weaponHandler.gun).transform.position), Vector2.op_Implicit(__instance.lastAimDirection), orthographicSize, num);
				if ((Object)(object)((RaycastHit2D)(ref hit)).collider == (Object)null || ((Component)((RaycastHit2D)(ref hit)).collider).gameObject.layer == 0)
				{
					ExtensionMethods.GetOrAddComponent<LoseControlHandler>(((Component)___data.player).gameObject, false);
					ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)Unbound.Instance, 0.2f, (Action)delegate
					{
						___data.view.RPC("RPCA_AddDisarmed", (RpcTarget)0, new object[1] { 0.8f });
					});
					PlayerSkinParticle componentInChildren = ((Component)___data).gameObject.GetComponentInChildren<PlayerSkinParticle>();
					Color value = Traverse.Create((object)componentInChildren).Field("startColor1").GetValue<Color>();
					Color value2 = Traverse.Create((object)componentInChildren).Field("startColor2").GetValue<Color>();
					Gradient val3 = new Gradient();
					GradientAlphaKey[] array = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
					{
						new GradientAlphaKey(1f, 0f),
						new GradientAlphaKey(1f, 1f)
					};
					GradientColorKey[] array2 = (GradientColorKey[])(object)new GradientColorKey[2]
					{
						new GradientColorKey(value, 0f),
						new GradientColorKey(value2, 1f)
					};
					val3.SetKeys(array2, array);
					GameObject val4 = Object.Instantiate<GameObject>(Main.GrapplingRopePrefab);
					val4.transform.parent = ((Component)___data.weaponHandler.gun).transform;
					val4.transform.localPosition = Vector3.zero;
					val4.GetComponent<LineRenderer>().colorGradient = val3;
					GrapplingRopeVFX grapplingRopeVFX = val4.AddComponent<GrapplingRopeVFX>();
					Vector3 val5;
					if ((Object)(object)((RaycastHit2D)(ref hit)).collider != (Object)null)
					{
						val5 = Vector2.op_Implicit(((RaycastHit2D)(ref hit)).point);
					}
					else
					{
						Vector3 position = val4.transform.position;
						Vector3 val6 = new Vector3(__instance.lastAimDirection.x, __instance.lastAimDirection.y, 0f);
						val5 = position + ((Vector3)(ref val6)).normalized * orthographicSize;
					}
					grapplingRopeVFX.targetLastPos = val5;
					___data.view.RPC("RPCA_DisplayHook", (RpcTarget)1, new object[2]
					{
						___data.player.playerID,
						val5
					});
				}
				else if ((Object)(object)((Component)((RaycastHit2D)(ref hit)).collider).GetComponent<Player>() != (Object)null)
				{
					ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)Unbound.Instance, 1.1f, (Action)delegate
					{
						___data.GetOverhaulData().isThrowing = false;
					});
					___data.sinceGrounded = 0.05f;
					Player targetPlayer = ((Component)((RaycastHit2D)(ref hit)).collider).GetComponent<Player>();
					ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)Unbound.Instance, 0.1f, (Action)delegate
					{
						//IL_0016: Unknown result type (might be due to invalid IL or missing references)
						//IL_0030: Unknown result type (might be due to invalid IL or missing references)
						//IL_0035: Unknown result type (might be due to invalid IL or missing references)
						//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)
						//IL_007b: 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)
						Vector2 val12 = Vector2.op_Implicit(((Component)__instance).transform.position - ((Component)((RaycastHit2D)(ref hit)).collider).transform.position);
						targetPlayer.data.view.RPC("RPCA_TakeForce", (RpcTarget)0, new object[3]
						{
							targetPlayer.data.player.playerID,
							val12 * 2750f,
							1
						});
						targetPlayer.data.view.RPC("RPCA_AddLoseControl", (RpcTarget)0, new object[1] { 0.1f });
					});
					ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)Unbound.Instance, 0.175f, (Action)delegate
					{
						targetPlayer.data.view.RPC("RPCA_SetStun", (RpcTarget)0, new object[1] { 0.825f });
						targetPlayer.data.view.RPC("RPCA_GrappleState", (RpcTarget)0, new object[2]
						{
							targetPlayer.data.player.playerID,
							true
						});
						___data.view.RPC("RPCA_SetImmobile", (RpcTarget)0, new object[1] { 0.825f });
						___data.view.RPC("RPCA_SetDisarm", (RpcTarget)0, new object[1] { 0.825f });
						___data.GetOverhaulData().isThrowing = true;
					});
					((MonoBehaviour)Unbound.Instance).StartCoroutine(DoGrapple(___data.player, targetPlayer));
					PlayerSkinParticle componentInChildren2 = ((Component)___data).gameObject.GetComponentInChildren<PlayerSkinParticle>();
					Color value3 = Traverse.Create((object)componentInChildren2).Field("startColor1").GetValue<Color>();
					Color value4 = Traverse.Create((object)componentInChildren2).Field("startColor2").GetValue<Color>();
					Gradient val7 = new Gradient();
					GradientAlphaKey[] array3 = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
					{
						new GradientAlphaKey(1f, 0f),
						new GradientAlphaKey(1f, 1f)
					};
					GradientColorKey[] array4 = (GradientColorKey[])(object)new GradientColorKey[2]
					{
						new GradientColorKey(value3, 0f),
						new GradientColorKey(value4, 1f)
					};
					val7.SetKeys(array4, array3);
					GameObject val8 = Object.Instantiate<GameObject>(Main.GrapplingRopePrefab);
					val8.transform.parent = ((Component)___data.weaponHandler.gun).transform;
					val8.transform.localPosition = Vector3.zero;
					val8.GetComponent<LineRenderer>().colorGradient = val7;
					GrapplingRopeVFX grapplingRopeVFX2 = val8.AddComponent<GrapplingRopeVFX>();
					grapplingRopeVFX2.targetObject = ((Component)targetPlayer).gameObject;
					grapplingRopeVFX2.ropeSnapTime = 0.035f;
					grapplingRopeVFX2.ropeOvershotTime = 0.035f;
					___data.view.RPC("RPCA_DisplayHook", (RpcTarget)1, new object[2]
					{
						___data.player.playerID,
						((Component)targetPlayer).gameObject.transform.position
					});
				}
				else
				{
					___data.sinceGrounded = 0.05f;
					ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)Unbound.Instance, 0.1f, (Action)delegate
					{
						//IL_0011: Unknown result type (might be due to invalid IL or missing references)
						//IL_0026: Unknown result type (might be due to invalid IL or missing references)
						//IL_002b: Unknown result type (might be due to invalid IL or missing references)
						//IL_0030: Unknown result type (might be due to invalid IL or missing references)
						//IL_0035: 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_0079: Unknown result type (might be due to invalid IL or missing references)
						Vector2 val11 = Vector2.op_Implicit(((Component)((RaycastHit2D)(ref hit)).collider).transform.position - ((Component)__instance).transform.position);
						ExtensionMethods.InvokeMethod((object)___data.playerVel, "AddForce", new Type[2]
						{
							typeof(Vector2),
							typeof(ForceMode2D)
						}, new object[2]
						{
							val11 * 2750f,
							(object)(ForceMode2D)1
						});
					});
					PlayerSkinParticle componentInChildren3 = ((Component)___data).gameObject.GetComponentInChildren<PlayerSkinParticle>();
					Color value5 = Traverse.Create((object)componentInChildren3).Field("startColor1").GetValue<Color>();
					Color value6 = Traverse.Create((object)componentInChildren3).Field("startColor2").GetValue<Color>();
					Gradient val9 = new Gradient();
					GradientAlphaKey[] array5 = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
					{
						new GradientAlphaKey(1f, 0f),
						new GradientAlphaKey(1f, 1f)
					};
					GradientColorKey[] array6 = (GradientColorKey[])(object)new GradientColorKey[2]
					{
						new GradientColorKey(value5, 0f),
						new GradientColorKey(value6, 1f)
					};
					val9.SetKeys(array6, array5);
					GameObject val10 = Object.Instantiate<GameObject>(Main.GrapplingRopePrefab);
					val10.transform.parent = ((Component)___data.weaponHandler.gun).transform;
					val10.transform.localPosition = Vector3.zero;
					val10.GetComponent<LineRenderer>().colorGradient = val9;
					GrapplingRopeVFX grapplingRopeVFX3 = val10.AddComponent<GrapplingRopeVFX>();
					grapplingRopeVFX3.targetObject = ((Component)((RaycastHit2D)(ref hit)).collider).gameObject;
					___data.view.RPC("RPCA_DisplayHook", (RpcTarget)1, new object[2]
					{
						___data.player.playerID,
						((Component)((RaycastHit2D)(ref hit)).collider).gameObject.transform.position
					});
				}
			}
			else
			{
				___data.GetOverhaulData().groundedSinceGrapple = ___data.GetOverhaulData().groundedSinceGrapple || ___data.isGrounded;
			}
			if (__instance.jumpWasPressed)
			{
				___data.GetOverhaulData().isGrappling = false;
			}
			if ((int)__instance.inputType == 0)
			{
				__instance.shootWasPressed = false;
				__instance.shootIsPressed = false;
				__instance.shootWasReleased = false;
				bool flag3 = !___data.GetOverhaulData().isGrappling && !___data.GetOverhaulData().isDisarmed && !___data.GetOverhaulData().isLostControl && !___data.isStunned && !___data.isSilenced;
				if (((Vector2)(ref val)).magnitude > 0.6f && flag3)
				{
					__instance.aimDirection = Vector2.op_Implicit(val);
					__instance.shootWasPressed = true;
					___data.weaponHandler.gun.shootPosition.rotation = Quaternion.LookRotation(Vector2.op_Implicit(val));
					ExtensionMethods.InvokeMethod((object)___data.weaponHandler, "Attack", Array.Empty<object>());
				}
			}
			if (___data.isGrounded && ((OneAxisInputControl)___data.playerActions.Block).IsPressed && ((Vector2)(ref val2)).magnitude < 0.1f && !__instance.jumpIsPressed && (!___data.block.IsOnCD() || (___data.block.counter <= TimeHandler.deltaTime && !___data.GetOverhaulData().isGrappling)))
			{
				___data.block.sinceBlock = 0f;
				___data.block.counter = 0f;
				___data.block.reloadParticle.Play();
				___data.block.reloadParticle.time = 0f;
				___data.view.RPC("RPCA_AddDisarmed", (RpcTarget)0, new object[1] { 0.5f });
				___data.view.RPC("RPCA_DisplayBlock", (RpcTarget)1, new object[2]
				{
					___data.player.playerID,
					true
				});
			}
			if (___data.block.reloadParticle.time > 0f && ___data.block.reloadParticle.isPlaying)
			{
				ExtensionMethods.GetOrAddComponent<LoseControlHandler>(((Component)___data.player).gameObject, false);
				___data.view.RPC("RPCA_AddDisarmed", (RpcTarget)0, new object[1] { 0.5f });
				___data.view.RPC("RPCA_DisplayBlock", (RpcTarget)1, new object[2]
				{
					___data.player.playerID,
					false
				});
			}
			if (((OneAxisInputControl)___data.playerActions.Block).IsPressed && ((Vector2)(ref val2)).magnitude > 0.1f && !___data.block.IsOnCD() && ___data.GetOverhaulData().groundedSinceDash && !___data.GetOverhaulData().isImmobile)
			{
				___data.block.counter = 0f;
				___data.GetOverhaulData().dashTime = 0.1f;
				___data.GetOverhaulData().dashDirection = ((Vector2)(ref val2)).normalized;
				___data.GetOverhaulData().groundedSinceDash = ___data.isGrounded;
				___data.isGrounded = false;
				___data.block.particle.Play();
			}
		}

		public static IEnumerator DoGrapple(Player Holder, Player Gappled)
		{
			float time = 0f;
			do
			{
				yield return null;
				time += TimeHandler.deltaTime;
				if (Holder.data.GetOverhaulData().grapleWasPressed && time > 0.2f)
				{
					Vector2 move = (Vector2)(((int)Holder.data.input.inputType == 0) ? new Vector2(((TwoAxisInputControl)Holder.data.playerActions.Move).X, ((TwoAxisInputControl)Holder.data.playerActions.Move).Y) : Vector2.op_Implicit(Holder.data.input.lastAimDirection));
					Gappled.data.view.RPC("RPCA_GrappleState", (RpcTarget)0, new object[2]
					{
						Gappled.data.player.playerID,
						false
					});
					ExtensionMethods.GetOrAddComponent<LoseControlHandler>(((Component)Gappled).gameObject, false);
					Gappled.data.view.RPC("RPCA_SetStun", (RpcTarget)0, new object[1] { 0f });
					Gappled.data.view.RPC("RPCA_AddLoseControl", (RpcTarget)0, new object[1] { 0.4f });
					Holder.data.view.RPC("RPCA_SetImmobile", (RpcTarget)0, new object[1] { 0f });
					Holder.data.view.RPC("RPCA_SetDisarm", (RpcTarget)0, new object[1] { 0.05f });
					Holder.data.GetOverhaulData().isThrowing = false;
					Gappled.data.view.RPC("RPCA_TakeForce", (RpcTarget)0, new object[3]
					{
						Gappled.data.player.playerID,
						((Vector2)(ref move)).normalized * 30000f,
						1
					});
					yield break;
				}
			}
			while (time <= 1f || !Holder.data.GetOverhaulData().isGrappling);
			Gappled.data.view.RPC("RPCA_GrappleState", (RpcTarget)0, new object[2]
			{
				Gappled.data.player.playerID,
				false
			});
			Holder.data.GetOverhaulData().isThrowing = false;
		}
	}
	[HarmonyPatch(typeof(HealthHandler))]
	internal class HealthHandler_Patch
	{
		[HarmonyPrefix]
		[HarmonyPriority(800)]
		[HarmonyPatch("RPCA_Die")]
		private static void RPCA_Die_Prefix(CharacterData ___data)
		{
			if (___data.isPlaying && !___data.dead)
			{
				Main.playerMonitor.GetComponent<LoseControlMonitor>().watchList.Add(((Component)___data).gameObject);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerActions), "CreateWithControllerBindings")]
	public class PlayerActionsPatchControler
	{
		public static bool Prefix(ref PlayerActions __result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			PlayerActions val = new PlayerActions();
			val.Fire.AddDefaultBinding((InputControlType)16);
			val.Block.AddDefaultBinding((InputControlType)15);
			val.Jump.AddDefaultBinding((InputControlType)18);
			val.Start.AddDefaultBinding((InputControlType)101);
			val.Left.AddDefaultBinding((InputControlType)3);
			val.Right.AddDefaultBinding((InputControlType)4);
			val.Up.AddDefaultBinding((InputControlType)1);
			val.Down.AddDefaultBinding((InputControlType)2);
			val.AimLeft.AddDefaultBinding((InputControlType)8);
			val.AimRight.AddDefaultBinding((InputControlType)9);
			val.AimUp.AddDefaultBinding((InputControlType)6);
			val.AimDown.AddDefaultBinding((InputControlType)7);
			ExtensionMethods.InvokeMethod((object)val, "CreatePlayerAction", new object[1] { "Grapple" });
			__result = val;
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerActions), "CreateWithKeyboardBindings")]
	public class PlayerActionsPatchKeyboard
	{
		public static void Postfix(ref PlayerActions __result)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			((PlayerAction)ExtensionMethods.InvokeMethod((object)__result, "CreatePlayerAction", new object[1] { "Grapple" })).AddDefaultBinding((Key[])(object)new Key[1] { (Key)40 });
		}
	}
	[HarmonyPatch(typeof(PlayerVelocity), "FixedUpdate")]
	public class PlayerVelocityPatch
	{
		public static void Prefix(CharacterData ___data, bool ___simulated, bool ___isKinematic, ref Vector2 ___velocity, PlayerVelocity __instance)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_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 (___simulated && !___isKinematic && ___data.isPlaying && (___data.GetOverhaulData().dashTime >= 0f || ___data.GetOverhaulData().isGrappled))
			{
				___velocity += Vector2.up * Time.fixedDeltaTime * TimeHandler.timeScale * 20f;
			}
		}
	}
}
namespace RCO.MonoBehaviours
{
	public class GraplePoint
	{
	}
	public class LoseControlHandler : MonoBehaviour
	{
		private Player player;

		private CharacterData data;

		private CharacterStatModifiers stats;

		private StunHandler stunHandler;

		public SimpleStatusVFX LoseControlVFX = null;

		public SimpleStatusVFX DisarmedVFX = null;

		private void Start()
		{
			player = ((Component)this).GetComponent<Player>();
			data = player.data;
			stunHandler = ((Component)this).GetComponent<StunHandler>();
		}

		private void Update()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)LoseControlVFX == (Object)null)
			{
				GameObject val = new GameObject("LoseControl_VFX");
				val.transform.parent = ((Component)this).gameObject.transform;
				val.transform.localPosition = Vector3.zero;
				GameObject val2 = Object.Instantiate<GameObject>(Main.LoseControlVFXPrefab);
				val2.transform.parent = val.transform;
				val2.transform.localPosition = Vector3.zero + new Vector3(0f, -1f, 0f);
				val2.transform.localScale = Vector3.one * 2f;
				val2.SetActive(false);
				LoseControlVFX = val.AddComponent<SimpleStatusVFX>();
				LoseControlVFX.targetObject = val2;
			}
			if ((Object)(object)DisarmedVFX == (Object)null)
			{
				GameObject val3 = new GameObject("Disarmed_VFX");
				val3.transform.parent = ((Component)this).gameObject.transform;
				val3.transform.localPosition = Vector3.zero;
				GameObject val4 = Object.Instantiate<GameObject>(Main.DisarmedVFXPrefab);
				val4.transform.parent = val3.transform;
				val4.transform.localPosition = Vector3.zero + new Vector3(0f, 1.5f, 0f);
				val4.transform.localScale = Vector3.one * 2f;
				val4.SetActive(false);
				DisarmedVFX = val3.AddComponent<SimpleStatusVFX>();
				DisarmedVFX.targetObject = val4;
			}
			if (data.GetOverhaulData().loseControlTimer > 0f)
			{
				data.GetOverhaulData().loseControlTimer -= TimeHandler.deltaTime;
				if (!data.GetOverhaulData().isLostControl)
				{
					StartLoseControl();
				}
			}
			else if (data.GetOverhaulData().isLostControl)
			{
				StopLoseControl();
			}
			if (data.GetOverhaulData().disarmedTimer > 0f)
			{
				data.GetOverhaulData().disarmedTimer -= TimeHandler.deltaTime;
				if (!data.GetOverhaulData().isDisarmed)
				{
					StartDisarmed();
				}
			}
			else if (data.GetOverhaulData().isDisarmed)
			{
				StopDisarmed();
			}
			if (data.GetOverhaulData().immobileTimer > 0f)
			{
				data.GetOverhaulData().immobileTimer -= TimeHandler.deltaTime;
				if (!data.GetOverhaulData().isImmobile)
				{
					StartImmobile();
				}
			}
			else if (data.GetOverhaulData().isImmobile)
			{
				StopImmobile();
			}
		}

		private void StartLoseControl()
		{
			LoseControlVFX.visible = true;
			data.GetOverhaulData().isLostControl = true;
		}

		public void StopLoseControl()
		{
			LoseControlVFX.visible = false;
			data.GetOverhaulData().isLostControl = false;
			data.GetOverhaulData().loseControlTimer = 0f;
		}

		private void StartDisarmed()
		{
			DisarmedVFX.visible = true;
			data.GetOverhaulData().isDisarmed = true;
		}

		public void StopDisarmed()
		{
			DisarmedVFX.visible = false;
			data.GetOverhaulData().isDisarmed = false;
			data.GetOverhaulData().disarmedTimer = 0f;
		}

		private void StartImmobile()
		{
			data.GetOverhaulData().isImmobile = true;
		}

		public void StopImmobile()
		{
			data.GetOverhaulData().isImmobile = false;
			data.GetOverhaulData().immobileTimer = 0f;
		}

		private void OnDisable()
		{
			StopLoseControl();
			StopDisarmed();
			StopImmobile();
		}

		[PunRPC]
		public void RPCA_AddLoseControl(float time)
		{
			if (time > data.GetOverhaulData().loseControlTimer)
			{
				data.GetOverhaulData().loseControlTimer = time;
			}
			if (!data.GetOverhaulData().isLostControl)
			{
				StartLoseControl();
			}
		}

		[PunRPC]
		public void RPCA_AddDisarmed(float time)
		{
			if (time > data.GetOverhaulData().disarmedTimer)
			{
				data.GetOverhaulData().disarmedTimer = time;
			}
			if (!data.GetOverhaulData().isDisarmed)
			{
				StartDisarmed();
			}
		}

		[PunRPC]
		public void RPCA_AddImmobile(float time)
		{
			if (time > data.GetOverhaulData().immobileTimer)
			{
				data.GetOverhaulData().immobileTimer = time;
			}
			if (!data.GetOverhaulData().isImmobile)
			{
				StartImmobile();
			}
		}

		[PunRPC]
		public void RPCA_SetImmobile(float time)
		{
			data.GetOverhaulData().immobileTimer = time;
			if (!data.GetOverhaulData().isImmobile && time > 0f)
			{
				StartImmobile();
			}
			else if (time <= 0f)
			{
				data.GetOverhaulData().immobileTimer = 0f;
				StopImmobile();
			}
		}

		[PunRPC]
		public void RPCA_SetDisarm(float time)
		{
			data.GetOverhaulData().disarmedTimer = time;
			if (!data.GetOverhaulData().isDisarmed && time > 0f)
			{
				StartDisarmed();
			}
			else if (time <= 0f)
			{
				data.GetOverhaulData().disarmedTimer = 0f;
				StopDisarmed();
			}
		}

		[PunRPC]
		public void RPCA_SetStun(float time)
		{
			data.stunTime = time;
			if (!data.isStunned && time > 0f)
			{
				ExtensionMethods.InvokeMethod((object)stunHandler, "StartStun", Array.Empty<object>());
			}
			else if (time <= 0f)
			{
				data.stunTime = 0f;
				stunHandler.StopStun();
			}
		}
	}
	internal class LoseControlMonitor : MonoBehaviour
	{
		public List<GameObject> watchList = new List<GameObject>();

		private void Update()
		{
			if (watchList.Count <= 0)
			{
				return;
			}
			foreach (GameObject watch in watchList)
			{
				CharacterData component = watch.GetComponent<CharacterData>();
				component.GetOverhaulData().isLostControl = false;
				component.GetOverhaulData().loseControlTimer = 0f;
				component.GetOverhaulData().isDisarmed = false;
				component.GetOverhaulData().disarmedTimer = 0f;
				component.GetOverhaulData().isImmobile = false;
				component.GetOverhaulData().immobileTimer = 0f;
			}
			watchList.Clear();
		}
	}
	public class RCO_RPCA_Handler : MonoBehaviour
	{
		private Player player;

		private CharacterData data;

		public bool RCO_Blocking = false;

		private bool RCO_WasBlocking = false;

		private void Start()
		{
			player = ((Component)this).GetComponent<Player>();
			data = player.data;
		}

		private void Update()
		{
			if (RCO_Blocking && !RCO_WasBlocking)
			{
				data.block.reloadParticle.Play();
				RCO_WasBlocking = true;
			}
			else if (!RCO_Blocking && RCO_WasBlocking)
			{
				RCO_WasBlocking = false;
			}
			if (RCO_Blocking)
			{
				data.block.sinceBlock = 0f;
				data.block.counter = 0f;
				data.block.reloadParticle.time = 0f;
			}
		}

		[PunRPC]
		public void RPCA_GrappleState(int targetID, bool state)
		{
			Player component = ((Component)this).gameObject.GetComponent<Player>();
			if (component.playerID == targetID)
			{
				component.data.GetOverhaulData().isGrappled = state;
			}
		}

		[PunRPC]
		public void RPCA_TakeForce(int targetID, Vector2 force, int forceMode)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			Player component = ((Component)this).gameObject.GetComponent<Player>();
			if (component.playerID == targetID)
			{
				ExtensionMethods.InvokeMethod((object)component.data.playerVel, "AddForce", new Type[2]
				{
					typeof(Vector2),
					typeof(ForceMode2D)
				}, new object[2] { force, forceMode });
			}
		}

		[PunRPC]
		public void RPCA_DisplayBlock(int playerIDfrom, bool state)
		{
			Predicate<Player> match = (Player item) => item.playerID == playerIDfrom;
			Player val = null;
			if (PlayerManager.instance.players.Exists(match))
			{
				val = PlayerManager.instance.players.Find(match);
				RCO_Blocking = state;
			}
		}

		[PunRPC]
		public void RPCA_DisplayHook(int playerIDfrom, Vector3 pos)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			Predicate<Player> match = (Player item) => item.playerID == playerIDfrom;
			Player val = null;
			if (PlayerManager.instance.players.Exists(match))
			{
				val = PlayerManager.instance.players.Find(match);
				CharacterData val2 = val.data;
				PlayerSkinParticle componentInChildren = ((Component)val2).gameObject.GetComponentInChildren<PlayerSkinParticle>();
				Color value = Traverse.Create((object)componentInChildren).Field("startColor1").GetValue<Color>();
				Color value2 = Traverse.Create((object)componentInChildren).Field("startColor2").GetValue<Color>();
				Gradient val3 = new Gradient();
				GradientAlphaKey[] array = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
				{
					new GradientAlphaKey(1f, 0f),
					new GradientAlphaKey(1f, 1f)
				};
				GradientColorKey[] array2 = (GradientColorKey[])(object)new GradientColorKey[2]
				{
					new GradientColorKey(value, 0f),
					new GradientColorKey(value2, 1f)
				};
				val3.SetKeys(array2, array);
				GameObject val4 = Object.Instantiate<GameObject>(Main.GrapplingRopePrefab);
				val4.transform.parent = ((Component)val2.weaponHandler.gun).transform;
				val4.transform.localPosition = Vector3.zero;
				val4.GetComponent<LineRenderer>().colorGradient = val3;
				GrapplingRopeVFX grapplingRopeVFX = val4.AddComponent<GrapplingRopeVFX>();
				grapplingRopeVFX.targetLastPos = new Vector3(pos.x, pos.y, 0f);
				grapplingRopeVFX.ropeSnapTime = 0.035f;
				grapplingRopeVFX.ropeOvershotTime = 0.035f;
			}
		}
	}
}
namespace RCO.Extensions
{
	public class CharacterData_OverhaulData
	{
		internal CharacterData data;

		public bool isLostControl;

		public float loseControlTimer;

		public bool isDisarmed;

		public float disarmedTimer;

		public bool isImmobile;

		public float immobileTimer;

		public float dashTime;

		public Vector2 dashDirection;

		public bool groundedSinceDash;

		private bool _isGrappled = false;

		public bool grapleWasPressed = false;

		public bool grapleWasReleased = false;

		public bool isGrappling;

		public bool groundedSinceGrapple;

		public bool isThrowing;

		public float grappleTimer;

		public bool isGrappled
		{
			get
			{
				return _isGrappled;
			}
			set
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				if (_isGrappled != value)
				{
					Transform transform = ((Component)data).transform;
					transform.localScale *= -1f;
					_isGrappled = value;
				}
			}
		}

		public CharacterData_OverhaulData()
		{
			isLostControl = false;
			loseControlTimer = 0f;
			isDisarmed = false;
			disarmedTimer = 0f;
			isImmobile = false;
			immobileTimer = 0f;
			dashTime = 0f;
			groundedSinceDash = true;
			isGrappled = false;
			isGrappling = false;
			groundedSinceGrapple = true;
			isThrowing = false;
			grappleTimer = 0f;
		}
	}
	public static class CharacterData_Extensions
	{
		public static readonly ConditionalWeakTable<CharacterData, CharacterData_OverhaulData> data = new ConditionalWeakTable<CharacterData, CharacterData_OverhaulData>();

		public static CharacterData_OverhaulData GetOverhaulData(this CharacterData characterStat)
		{
			CharacterData_OverhaulData orCreateValue = data.GetOrCreateValue(characterStat);
			orCreateValue.data = characterStat;
			return orCreateValue;
		}

		public static void AddData(this CharacterData characterData, CharacterData_OverhaulData value)
		{
			try
			{
				data.Add(characterData, value);
			}
			catch (Exception)
			{
			}
		}
	}
}
namespace RCO.Dev
{
	internal class LoseControlDevCard : CustomCard
	{
		public static GameObject objectToSpawn;

		public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
		{
		}

		public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			if ((Object)(object)objectToSpawn == (Object)null)
			{
				objectToSpawn = new GameObject("LoseControlBullet", new Type[1] { typeof(LoseControlBullet) });
				Object.DontDestroyOnLoad((Object)(object)objectToSpawn);
			}
			List<ObjectsToSpawn> list = gun.objectsToSpawn.ToList();
			list.Add(new ObjectsToSpawn
			{
				AddToProjectile = objectToSpawn
			});
			gun.objectsToSpawn = list.ToArray();
		}

		public override void OnRemoveCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
		{
		}

		protected override string GetTitle()
		{
			return "DEV Lose Control";
		}

		protected override string GetDescription()
		{
			return "shoot player to apply [Lose Control] status effect";
		}

		protected override GameObject GetCardArt()
		{
			return null;
		}

		protected override Rarity GetRarity()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (Rarity)0;
		}

		protected override CardInfoStat[] GetStats()
		{
			return (CardInfoStat[])(object)new CardInfoStat[0];
		}

		protected override CardThemeColorType GetTheme()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (CardThemeColorType)3;
		}

		public override string GetModName()
		{
			return "DEV";
		}
	}
	public class LoseControlBullet : RayHitEffect
	{
		public static float debuffDuration = 2f;

		public override HasToReturn DoHitEffect(HitInfo hit)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)hit.transform == (Object)null)
			{
				return (HasToReturn)1;
			}
			if (((Component)hit.transform).gameObject.tag.Contains("Bullet"))
			{
				return (HasToReturn)1;
			}
			if (Object.op_Implicit((Object)(object)((Component)hit.transform).GetComponent<Player>()))
			{
				CharacterData component = ((Component)hit.transform).gameObject.GetComponent<CharacterData>();
				LoseControlHandler orAddComponent = ExtensionMethods.GetOrAddComponent<LoseControlHandler>(((Component)component.player).gameObject, false);
				orAddComponent.RPCA_AddLoseControl(debuffDuration);
			}
			return (HasToReturn)1;
		}

		public void Destroy()
		{
		}
	}
}