Decompiled source of BladesOfChaos v1.0.1

BladesOfChaos.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BladesOfChaos")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BladesOfChaos")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4e4d067a-b54f-479b-9e26-57690bcf2d36")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BladesOfChaos
{
	[BepInPlugin("com.michi.BladesOfChaos", "BladesOfChaos", "1.0.0")]
	public class BladesOfChaosPlugin : BaseUnityPlugin
	{
		private const string MyGUID = "com.michi.BladesOfChaos";

		private const string PluginName = "BladesOfChaos";

		private const string VersionString = "1.0.0";

		private static readonly Harmony Harmony = new Harmony("com.michi.BladesOfChaos");

		public static ManualLogSource Log = new ManualLogSource("BladesOfChaos");

		private GameObject blades;

		public static GameObject bladeModel;

		private GameObject bladesofthechaos;

		public static ConfigEntry<KeyCode> NemeanCrush;

		public static ConfigEntry<KeyCode> MeteoricSlam;

		private void Awake()
		{
			NemeanCrush = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "Nemean Crush", (KeyCode)122, (ConfigDescription)null);
			MeteoricSlam = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "Meteoric Slam", (KeyCode)120, (ConfigDescription)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: BladesOfChaos, VersionString: 1.0.0 is loading...");
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: BladesOfChaos, VersionString: 1.0.0 is loaded.");
			Log = ((BaseUnityPlugin)this).Logger;
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			AssetBundle val = AssetBundle.LoadFromStream(executingAssembly.GetManifestResourceStream("BladesOfChaos.bladesofchaos"));
			blades = val.LoadAsset<GameObject>("V1RageFinal");
			bladeModel = val.LoadAsset<GameObject>("Blade");
			SceneManager.sceneLoaded += SceneManager_sceneLoaded;
		}

		private void Update()
		{
			if ((Object)(object)bladesofthechaos == (Object)null)
			{
				bladesofthechaos = MakeGun(5, blades);
			}
		}

		private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
		{
		}

		public static GameObject MakeGun(int var, GameObject original)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MonoSingleton<GunControl>.Instance == (Object)null || (Object)(object)MonoSingleton<StyleHUD>.Instance == (Object)null)
			{
				return null;
			}
			if (!((Behaviour)MonoSingleton<GunControl>.Instance).enabled || !((Behaviour)MonoSingleton<StyleHUD>.Instance).enabled)
			{
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(original);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			Vector3 position = val.transform.position;
			Quaternion rotation = val.transform.rotation;
			val.transform.parent = ((Component)MonoSingleton<GunControl>.Instance).transform;
			val.transform.localPosition = position;
			val.transform.localRotation = rotation;
			MonoSingleton<GunControl>.Instance.slots[var].Add(val);
			MonoSingleton<GunControl>.Instance.allWeapons.Add(val);
			MonoSingleton<GunControl>.Instance.slotDict.Add(val, var);
			MonoSingleton<StyleHUD>.Instance.weaponFreshness.Add(val, 10f);
			val.SetActive(false);
			MonoSingleton<GunControl>.Instance.noWeapons = false;
			MonoSingleton<GunControl>.Instance.YesWeapon();
			for (int i = 0; i < ((Component)MonoSingleton<GunControl>.Instance).transform.childCount; i++)
			{
				((Component)((Component)MonoSingleton<GunControl>.Instance).transform.GetChild(i)).gameObject.SetActive(false);
			}
			return val;
		}
	}
}
namespace BladesOfChaos.Utils
{
	internal static class ModUtils
	{
		public static Transform GetPlayerTransform()
		{
			return ((Component)MonoSingleton<NewMovement>.Instance).transform;
		}
	}
}
namespace BladesOfChaos.MonoBehaviours
{
	internal class BladesOfChaosComponent : MonoBehaviour
	{
		[Header("Configuration")]
		public float baseHitColSize = 5f;

		public float chargedHitColSize = 35f;

		public float scalingFactor = 10f;

		[Header("References")]
		public LineRenderer lineL;

		public LineRenderer lineR;

		public Transform bladeR;

		public Transform bladeL;

		public GameObject meteoricSlam;

		public GameObject explosion;

		public Transform positionToSpawnExplosion;

		public static Material chainMat;

		private float hitColSize;

		private InputManager inputManager;

		private GunControl gc;

		private Animator animator;

		public static bool isThrowing;

		public static bool shouldThrow;

		public bool wasThrowing;

		private float nomanCrushCooldown = 30f;

		private float meteoricSlamCooldown = 90f;

		private float lastNomanCrushTime = -999f;

		private float lastMeteoricSlamTime = -999f;

		public static BladesOfChaosComponent Instance { get; private set; }

		private void Awake()
		{
			animator = ((Component)this).GetComponent<Animator>();
			inputManager = MonoSingleton<InputManager>.Instance;
			gc = MonoSingleton<GunControl>.Instance;
			chainMat = ((Renderer)lineL).material;
			Instance = this;
		}

		private void Update()
		{
			HandleInput();
			UpdateLineRenderers();
		}

		public bool CanUseGrapple()
		{
			return ((Object)((AnimatorClipInfo)(ref animator.GetCurrentAnimatorClipInfo(0)[0])).clip).name == "feedbacker_viewmodel_ARM_Idle";
		}

		private void HandleInput()
		{
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			if (!gc.activated)
			{
				return;
			}
			if (inputManager.InputSource.Fire2.IsPressed)
			{
				SetChargeState(isCharging: true);
			}
			else if (inputManager.InputSource.Fire1.IsPressed)
			{
				SetAttackState(isAttacking: true);
			}
			else
			{
				ResetStates();
			}
			if (!isThrowing && wasThrowing)
			{
				Debug.Log((object)"Stop Grappling");
				animator.SetBool("Grappling", false);
				Debug.Log((object)$"Animator speed before setting: {animator.speed}");
				animator.speed = 1f;
				Debug.Log((object)$"Animator speed after setting: {animator.speed}");
				wasThrowing = false;
			}
			if (Input.GetKeyDown(BladesOfChaosPlugin.MeteoricSlam.Value) && Time.time >= lastMeteoricSlamTime + meteoricSlamCooldown)
			{
				if (!NoWeaponCooldown.NoCooldown)
				{
					lastMeteoricSlamTime = Time.time;
				}
				animator.SetTrigger("MeteoricSlam");
			}
			else if (Input.GetKeyDown(BladesOfChaosPlugin.MeteoricSlam.Value))
			{
				Debug.Log((object)"Meteoric Slam is on cooldown!");
			}
			if (Input.GetKeyDown(BladesOfChaosPlugin.NemeanCrush.Value) && Time.time >= lastNomanCrushTime + nomanCrushCooldown)
			{
				if (!NoWeaponCooldown.NoCooldown)
				{
					lastNomanCrushTime = Time.time;
				}
				animator.SetTrigger("NomanCrush");
			}
			else if (Input.GetKeyDown(BladesOfChaosPlugin.NemeanCrush.Value))
			{
				Debug.Log((object)"Nemean Crush is on cooldown!");
			}
		}

		private void OnGUI()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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)
			float num = Screen.width;
			float num2 = Screen.height;
			GUIStyle val = new GUIStyle();
			val.fontSize = 24;
			val.normal.textColor = Color.red;
			float num3 = Mathf.Max(0f, lastMeteoricSlamTime + meteoricSlamCooldown - Time.time);
			float num4 = Mathf.Max(0f, lastNomanCrushTime + nomanCrushCooldown - Time.time);
			if (num3 > 0f)
			{
				GUI.Label(new Rect(num / 2f - 100f, num2 - 100f, 200f, 30f), $"Meteoric Slam: {num3:F1}s", val);
			}
			if (num4 > 0f)
			{
				GUI.Label(new Rect(num / 2f - 100f, num2 - 70f, 200f, 30f), $"Nemean Crush: {num4:F1}s", val);
			}
		}

		public void SpawnExplosionInfront()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//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_0037: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			float num = 15f;
			Vector3 val = ((Component)MonoSingleton<CameraController>.instance).transform.position + ((Component)MonoSingleton<CameraController>.instance).transform.forward * num;
			Object.Instantiate<GameObject>(explosion, val, Quaternion.identity);
			Collider[] array = Physics.OverlapSphere(val, 5f);
			if (array.Length == 0)
			{
				return;
			}
			HashSet<EnemyIdentifier> alreadyHitEnemies = new HashSet<EnemyIdentifier>();
			Collider[] array2 = array;
			EnemyIdentifierIdentifier enemyId = default(EnemyIdentifierIdentifier);
			Breakable val3 = default(Breakable);
			Glass val4 = default(Glass);
			foreach (Collider val2 in array2)
			{
				GameObject gameObject = ((Component)val2).gameObject;
				if (gameObject.TryGetComponent<EnemyIdentifierIdentifier>(ref enemyId))
				{
					HandleEnemyHit(enemyId, gameObject, 4.5f, alreadyHitEnemies);
				}
				if (gameObject.TryGetComponent<Breakable>(ref val3))
				{
					val3.Burn();
					val3.Break();
				}
				if (gameObject.TryGetComponent<Glass>(ref val4) && !val4.broken)
				{
					val4.Shatter();
				}
			}
		}

		public void StartThrow()
		{
			Debug.Log((object)"Grappling");
			animator.SetBool("Grappling", true);
			animator.speed = 1f;
			wasThrowing = true;
		}

		public void Pause()
		{
			Debug.Log((object)"Doing Pause");
			animator.speed = 0f;
			shouldThrow = true;
		}

		private void SetChargeState(bool isCharging)
		{
			hitColSize = (isCharging ? chargedHitColSize : baseHitColSize);
			animator.SetBool("Mouse2Held", isCharging);
		}

		private void SetAttackState(bool isAttacking)
		{
			hitColSize = baseHitColSize;
			animator.SetBool("Mouse1Held", isAttacking);
		}

		public void slowDown(float amount)
		{
			MonoSingleton<TimeController>.instance.SlowDown(amount);
		}

		public void SpawnExplosionAtATransform()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Object.Instantiate<GameObject>(explosion, positionToSpawnExplosion.position, Quaternion.identity);
		}

		private void ResetStates()
		{
			hitColSize = baseHitColSize;
			animator.SetBool("Mouse2Held", false);
			animator.SetBool("Mouse1Held", false);
		}

		private void UpdateLineRenderers()
		{
			//IL_0013: 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_0048: 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)
			lineL.SetPosition(0, ((Component)lineL).transform.position);
			lineL.SetPosition(1, bladeL.position);
			lineR.SetPosition(0, ((Component)lineR).transform.position);
			lineR.SetPosition(1, bladeR.position);
		}

		private void OnDisable()
		{
			animator.speed = 1f;
			((Component)bladeL).gameObject.SetActive(true);
		}

		public void CheckForDamage(AttackType attackType)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			float damage = DamageBasedOnType(attackType);
			MonoSingleton<CameraController>.instance.CameraShake(0.1f);
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, hitColSize);
			if (array.Length == 0)
			{
				return;
			}
			HashSet<EnemyIdentifier> alreadyHitEnemies = new HashSet<EnemyIdentifier>();
			Collider[] array2 = array;
			EnemyIdentifierIdentifier enemyId = default(EnemyIdentifierIdentifier);
			Breakable val2 = default(Breakable);
			Glass val3 = default(Glass);
			foreach (Collider val in array2)
			{
				GameObject gameObject = ((Component)val).gameObject;
				if (gameObject.TryGetComponent<EnemyIdentifierIdentifier>(ref enemyId))
				{
					HandleEnemyHit(enemyId, gameObject, damage, alreadyHitEnemies);
				}
				if (gameObject.TryGetComponent<Breakable>(ref val2))
				{
					val2.Burn();
					val2.Break();
				}
				if (gameObject.TryGetComponent<Glass>(ref val3) && !val3.broken)
				{
					val3.Shatter();
				}
			}
		}

		private void HandleEnemyHit(EnemyIdentifierIdentifier enemyId, GameObject target, float damage, HashSet<EnemyIdentifier> alreadyHitEnemies)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			EnemyIdentifier eid = enemyId.eid;
			if (!alreadyHitEnemies.Contains(eid) && !eid.dead)
			{
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)eid).transform.position);
				float num2 = ((num > 0f) ? (scalingFactor / num) : float.MaxValue);
				MonoSingleton<TimeController>.instance.HitStop(0.1f);
				MonoSingleton<StyleHUD>.instance.AddPoints(50, "SLICED", target, eid, -1, "", "");
				eid.hitter = "Blade";
				eid.DeliverDamage(target, Vector3.zero, target.transform.position, damage, false, 0f, (GameObject)null, false, false);
				Flammable val = default(Flammable);
				if (target.TryGetComponent<Flammable>(ref val))
				{
					val.Burn(damage / 10f, false);
				}
				alreadyHitEnemies.Add(eid);
			}
		}

		public float DamageBasedOnType(AttackType type)
		{
			return type switch
			{
				AttackType.Melee => 1.5f, 
				AttackType.Ranged => 0.89f, 
				_ => 1f, 
			};
		}

		public void SpawnSlam()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)meteoricSlam != (Object)null)
			{
				Object.Instantiate<GameObject>(meteoricSlam, ((Component)this).transform.position, ((Component)this).transform.rotation);
			}
		}

		public void SetBoolFalse(string boolName)
		{
			animator.SetBool(boolName, false);
		}

		public void ResetCooldowns()
		{
			lastNomanCrushTime = -999f;
			lastMeteoricSlamTime = -999f;
		}
	}
	[HarmonyPatch(typeof(HookArm), "StopThrow")]
	public class resetOnHookStopThrow
	{
		public static void Postfix(HookArm __instance, float animationTime = 0f, bool sparks = false)
		{
			if (animationTime > 0f)
			{
				Object.Destroy((Object)(object)ReplaceHook.blade);
				BladesOfChaosComponent.isThrowing = false;
			}
		}
	}
	[HarmonyPatch(typeof(NewMovement), "Respawn")]
	public class ResetCooldownsOnRespawn
	{
		public static void Postfix()
		{
			BladesOfChaosComponent.Instance.ResetCooldowns();
		}
	}
	[HarmonyPatch(typeof(HookArm), "Update")]
	public class ReplaceHook
	{
		public static GameObject blade;

		public static bool Prefix(HookArm __instance)
		{
			//IL_0120: 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_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)BladesOfChaosComponent.Instance == (Object)null)
			{
				return true;
			}
			if (!((Component)BladesOfChaosComponent.Instance).gameObject.activeSelf)
			{
				return true;
			}
			__instance.model.SetActive(false);
			if ((Object)(object)BladesOfChaosComponent.chainMat != (Object)null && (Object)(object)((Renderer)__instance.lr).material != (Object)(object)BladesOfChaosComponent.chainMat)
			{
				((Renderer)__instance.lr).material = BladesOfChaosComponent.chainMat;
			}
			if (MonoSingleton<InputManager>.Instance.InputSource.Hook.WasPerformedThisFrame && __instance.cooldown <= 0f)
			{
				if (!BladesOfChaosComponent.Instance.CanUseGrapple())
				{
					return false;
				}
				BladesOfChaosComponent.isThrowing = true;
				((MonoBehaviour)__instance).StartCoroutine(startThrowLate(__instance));
				return false;
			}
			if ((Object)(object)blade != (Object)null)
			{
				((Component)__instance.hook).gameObject.SetActive(false);
				blade.transform.position = __instance.hookPoint;
			}
			if ((int)__instance.state == 0 && !__instance.returning && BladesOfChaosComponent.isThrowing && __instance.hookPoint == __instance.hand.position)
			{
				Object.Destroy((Object)(object)blade);
				BladesOfChaosComponent.isThrowing = false;
			}
			if (__instance.hookPoint == __instance.hand.position)
			{
				Object.Destroy((Object)(object)blade);
				BladesOfChaosComponent.isThrowing = false;
			}
			return true;
		}

		public static IEnumerator startThrowLate(HookArm __instance)
		{
			BladesOfChaosComponent.Instance.StartThrow();
			yield return (object)new WaitUntil((Func<bool>)(() => BladesOfChaosComponent.shouldThrow));
			BladesOfChaosComponent.shouldThrow = false;
			Throw(__instance);
		}

		public static void Throw(HookArm __instance)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: 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_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			__instance.cooldown = 0.5f;
			__instance.model.SetActive(true);
			if (!__instance.forcingFistControl)
			{
				if (Object.op_Implicit((Object)(object)MonoSingleton<FistControl>.Instance.currentPunch))
				{
					MonoSingleton<FistControl>.Instance.currentPunch.CancelAttack();
				}
				FistControl instance = MonoSingleton<FistControl>.Instance;
				instance.forceNoHold++;
				__instance.forcingFistControl = true;
				((Component)MonoSingleton<FistControl>.Instance).transform.localRotation = Quaternion.identity;
			}
			((Renderer)__instance.lr).enabled = true;
			__instance.hookPoint = ((Component)__instance).transform.position;
			__instance.previousHookPoint = __instance.hookPoint;
			Vector3 val;
			if (Object.op_Implicit((Object)(object)__instance.targeter.CurrentTarget) && __instance.targeter.IsAutoAimed)
			{
				Bounds bounds = __instance.targeter.CurrentTarget.bounds;
				val = ((Bounds)(ref bounds)).center - ((Component)__instance).transform.position;
				__instance.throwDirection = ((Vector3)(ref val)).normalized;
			}
			else
			{
				__instance.throwDirection = ((Component)__instance).transform.forward;
			}
			__instance.returning = false;
			if (__instance.caughtObjects.Count > 0)
			{
				foreach (Rigidbody caughtObject in __instance.caughtObjects)
				{
					if (Object.op_Implicit((Object)(object)caughtObject))
					{
						val = ((Component)MonoSingleton<NewMovement>.Instance).transform.position - ((Component)caughtObject).transform.position;
						caughtObject.velocity = ((Vector3)(ref val)).normalized * (100f + __instance.returnDistance / 2f);
					}
				}
				__instance.caughtObjects.Clear();
			}
			__instance.state = (HookState)1;
			__instance.lightTarget = false;
			__instance.throwWarp = 1f;
			__instance.anim.Play("Throw", -1, 0f);
			blade = Object.Instantiate<GameObject>(BladesOfChaosPlugin.bladeModel, __instance.hookPoint, Quaternion.identity);
			((Renderer)__instance.inspectLr).enabled = false;
			((Component)__instance.hand).transform.localPosition = new Vector3(0.09f, -0.051f, 0.045f);
			if (MonoSingleton<CameraController>.Instance.defaultFov > 105f)
			{
				Transform transform = ((Component)__instance.hand).transform;
				transform.localPosition += new Vector3(0.225f * ((MonoSingleton<CameraController>.Instance.defaultFov - 105f) / 55f), -0.25f * ((MonoSingleton<CameraController>.Instance.defaultFov - 105f) / 55f), 0.05f * ((MonoSingleton<CameraController>.Instance.defaultFov - 105f) / 55f));
			}
			__instance.caughtPoint = Vector3.zero;
			__instance.caughtTransform = null;
			__instance.caughtCollider = null;
			__instance.caughtEid = null;
			Object.Instantiate<GameObject>(__instance.throwSound);
			__instance.aud.clip = __instance.throwLoop;
			__instance.aud.panStereo = 0f;
			__instance.aud.Play();
			__instance.aud.pitch = Random.Range(0.9f, 1.1f);
			__instance.semiBlocked = 0f;
			MonoSingleton<RumbleManager>.Instance.SetVibrationTracked(RumbleProperties.WhiplashThrow, ((Component)__instance).gameObject);
		}
	}
	[HarmonyPatch(typeof(HookArm), "FixedUpdate")]
	public class DontThrowHookFixed
	{
		public static bool Prefix(HookArm __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if ((int)__instance.state == 0 && !__instance.returning && BladesOfChaosComponent.isThrowing && __instance.hookPoint == __instance.hand.position)
			{
				Object.Destroy((Object)(object)ReplaceHook.blade);
				BladesOfChaosComponent.isThrowing = false;
			}
			if (__instance.returning && Vector3.Distance(__instance.hand.position, __instance.hookPoint) <= 25f)
			{
				Object.Destroy((Object)(object)ReplaceHook.blade);
				BladesOfChaosComponent.isThrowing = false;
			}
			return true;
		}
	}
	public enum AttackType
	{
		Ranged,
		Melee
	}
}