Decompiled source of ARC Complex v1.3.0

BepInEx/plugins/ARC_Complex/DOOM Plugin.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AK;
using Agents;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using FX_EffectSystem;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DOOM Plugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+77a91a42749698cd500c1e6edab0eeb72b2cacd1")]
[assembly: AssemblyProduct("DOOM Plugin")]
[assembly: AssemblyTitle("DOOM Plugin")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace DOOMPlugin
{
	[BepInPlugin("DOOMPlugin", "DOOMPlugin", "1.0.0")]
	internal class EntryPoint : BasePlugin
	{
		private Harmony _Harmony;

		public override void Load()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_Harmony = new Harmony("DOOMPlugin.GUID.Harmony");
			ClassInjector.RegisterTypeInIl2Cpp<BloodPunchMeter>();
			_Harmony.PatchAll();
		}

		public override bool Unload()
		{
			_Harmony.UnpatchSelf();
			return ((BasePlugin)this).Unload();
		}
	}
	public enum ParryType
	{
		Tentacle,
		Projectile,
		Bullet,
		Melee
	}
	[HarmonyPatch]
	internal class Parry
	{
		public static bool parryEnabled = true;

		public static float parryDuration = 0.3f;

		public static float parryExplosionDamage = 40.01f;

		public static float parryExplosionRadius = 3f;

		public static float parryBulletDamage = 150.01f;

		public static float parryBulletPrecisionMultiplier = 1f;

		public static float parryBulletStaggerMultiplier = 1f;

		public static float parryBulletFalloffStart = 60f;

		public static float parryBulletFalloffEnd = 100f;

		public static float parryHealMulti = 1f;

		public static float parryMainAmmoMulti = 1f;

		public static float parrySpecAmmoMulti = 1f;

		public static float parryToolMulti = 1f;

		public static float parryFriendlyBulletMulti = 4f;

		private static float shoveTime;

		private static bool SuccessfullyParry(Agent damagingAgent, float damageTaken, ParryType parried)
		{
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Expected O, but got Unknown
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: 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_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: 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_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: 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_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: 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_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			if (!parryEnabled)
			{
				return true;
			}
			PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
			localPlayerAgent.Sound.Post(1256202815u, true);
			Vector3 val2;
			RaycastHit rayHit;
			switch (parried)
			{
			case ParryType.Tentacle:
				if (SNet.IsMaster)
				{
					localPlayerAgent.GiveHealth(localPlayerAgent, damageTaken * parryHealMulti);
				}
				else
				{
					localPlayerAgent.GiveHealth(localPlayerAgent, damageTaken * parryHealMulti + damageTaken);
				}
				localPlayerAgent.GiveAmmoRel(localPlayerAgent, damageTaken * parryMainAmmoMulti / 5f, damageTaken * parrySpecAmmoMulti / 5f, damageTaken * parryToolMulti / 5f);
				if ((Object)(object)damagingAgent != (Object)null)
				{
					DoExplosionDamage(damagingAgent.Position, parryExplosionRadius, parryExplosionDamage, 1500f);
				}
				BloodPunchMeter.instance.updateMeter(damageTaken * 500f);
				break;
			case ParryType.Projectile:
			{
				if (SNet.IsMaster)
				{
					localPlayerAgent.GiveHealth(localPlayerAgent, damageTaken * parryHealMulti);
				}
				else
				{
					localPlayerAgent.GiveHealth(localPlayerAgent, damageTaken * parryHealMulti + damageTaken);
				}
				localPlayerAgent.GiveAmmoRel(localPlayerAgent, damageTaken * parryMainAmmoMulti / 5f, damageTaken * parrySpecAmmoMulti / 5f, damageTaken * parryToolMulti / 5f);
				WeaponHitData val = new WeaponHitData
				{
					randomSpread = 0f,
					maxRayDist = 100f
				};
				Vector3 position = localPlayerAgent.FPSCamera.Position;
				WeaponHitData obj = val;
				val2 = localPlayerAgent.FPSCamera.CameraRayPos - position;
				obj.fireDir = ((Vector3)(ref val2)).normalized;
				val.owner = localPlayerAgent;
				val.damage = parryBulletDamage;
				val.staggerMulti = parryBulletStaggerMultiplier;
				val.precisionMulti = parryBulletPrecisionMultiplier;
				val.damageFalloff = new Vector2(parryBulletFalloffStart, parryBulletFalloffEnd);
				if (Weapon.CastWeaponRay(((Component)localPlayerAgent.FPSCamera).transform, ref val, position, -1))
				{
					BulletWeapon.BulletHit(val, true, 0f, 0u, true);
					rayHit = val.rayHit;
					FX_Manager.EffectTargetPosition = ((RaycastHit)(ref rayHit)).point;
				}
				else
				{
					FX_Manager.EffectTargetPosition = localPlayerAgent.FPSCamera.CameraRayPos;
				}
				FX_Manager.PlayLocalVersion = false;
				((FX_EffectBase)BulletWeapon.s_tracerPool.AquireEffect()).Play((FX_Trigger)null, ((Agent)localPlayerAgent).EyePosition, Quaternion.LookRotation(val.fireDir));
				BloodPunchMeter.instance.updateMeter(damageTaken * 500f);
				break;
			}
			case ParryType.Bullet:
			{
				if (!SNet.IsMaster)
				{
					localPlayerAgent.GiveHealth(localPlayerAgent, damageTaken);
				}
				WeaponHitData val3 = new WeaponHitData
				{
					randomSpread = 0f,
					maxRayDist = 100f
				};
				Vector3 position2 = localPlayerAgent.FPSCamera.Position;
				WeaponHitData obj2 = val3;
				val2 = localPlayerAgent.FPSCamera.CameraRayPos - position2;
				obj2.fireDir = ((Vector3)(ref val2)).normalized;
				val3.owner = localPlayerAgent;
				val3.damage = damageTaken * 50f * parryFriendlyBulletMulti;
				val3.staggerMulti = 1f;
				val3.precisionMulti = 2f;
				val3.damageFalloff = new Vector2(80f, 100f);
				if (Weapon.CastWeaponRay(((Component)localPlayerAgent.FPSCamera).transform, ref val3, position2, -1))
				{
					BulletWeapon.BulletHit(val3, true, 0f, 0u, true);
					rayHit = val3.rayHit;
					FX_Manager.EffectTargetPosition = ((RaycastHit)(ref rayHit)).point;
				}
				else
				{
					FX_Manager.EffectTargetPosition = localPlayerAgent.FPSCamera.CameraRayPos;
				}
				FX_Manager.PlayLocalVersion = false;
				((FX_EffectBase)BulletWeapon.s_tracerPool.AquireEffect()).Play((FX_Trigger)null, ((Agent)localPlayerAgent).EyePosition, Quaternion.LookRotation(val3.fireDir));
				BloodPunchMeter.instance.updateMeter(damageTaken * 500f);
				break;
			}
			case ParryType.Melee:
				localPlayerAgent.Sound.Post(2062878866u, true);
				if (SNet.IsMaster)
				{
					localPlayerAgent.GiveHealth(localPlayerAgent, damageTaken * parryHealMulti);
				}
				else
				{
					localPlayerAgent.GiveHealth(localPlayerAgent, damageTaken * parryHealMulti + damageTaken);
				}
				localPlayerAgent.GiveAmmoRel(localPlayerAgent, damageTaken * parryMainAmmoMulti / 5f, damageTaken * parrySpecAmmoMulti / 5f, damageTaken * parryToolMulti / 5f);
				DoExplosionDamage(((Agent)localPlayerAgent).EyePosition - Vector3.up * 0.5f, BloodPunch.punchExplosionRadius, BloodPunch.punchExplosionDamage, 5000f);
				BloodPunchMeter.instance.ResetMeter();
				break;
			}
			return false;
		}

		public static void DoExplosionDamage(Vector3 sourcePos, float radius, float damage, float explosionForce)
		{
			//IL_0001: 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_00c6: 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)
			//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_00d3: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			int num = Physics.OverlapSphereNonAlloc(sourcePos, radius, DamageUtil.s_tempColliders, LayerManager.MASK_EXPLOSION_TARGETS);
			if (num < 1)
			{
				return;
			}
			DamageUtil.IncrementSearchID();
			RaycastHit val3 = default(RaycastHit);
			for (int i = 0; i < num; i++)
			{
				Collider val = ((Il2CppArrayBase<Collider>)(object)DamageUtil.s_tempColliders)[i];
				if (Object.op_Implicit((Object)(object)((Component)val).GetComponent<Dam_PlayerDamageBase>()) || Object.op_Implicit((Object)(object)((Component)val).GetComponent<Dam_PlayerDamageLimb>()))
				{
					continue;
				}
				Rigidbody component = ((Component)val).GetComponent<Rigidbody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.AddExplosionForce(explosionForce, sourcePos, radius, 3f);
				}
				IDamageable component2 = ((Component)val).GetComponent<IDamageable>();
				if (component2 == null)
				{
					continue;
				}
				IDamageable baseDamagable = component2.GetBaseDamagable();
				if (baseDamagable != null && baseDamagable.TempSearchID != DamageUtil.SearchID)
				{
					Vector3 val2 = component2.DamageTargetPos - sourcePos;
					if (!Physics.Raycast(sourcePos, ((Vector3)(ref val2)).normalized, ref val3, ((Vector3)(ref val2)).magnitude, LayerManager.MASK_EXPLOSION_BLOCKERS) || (Object)(object)((RaycastHit)(ref val3)).collider == (Object)(object)val)
					{
						baseDamagable.TempSearchID = DamageUtil.SearchID;
						component2.ExplosionDamage(damage, sourcePos, Vector3.up * explosionForce, 0u);
					}
				}
			}
		}

		[HarmonyPatch(typeof(MWS_Push), "Enter")]
		[HarmonyPostfix]
		public static void ParryEnter()
		{
			shoveTime = Clock.Time;
		}

		[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveShooterProjectileDamage")]
		[HarmonyPrefix]
		public static bool ParryShooterProjectileDamage(pMediumDamageData data)
		{
			float time = Clock.Time;
			if (time > shoveTime && time - shoveTime < parryDuration)
			{
				return SuccessfullyParry(null, ((UFloat16)(ref data.damage)).Get(1f), ParryType.Projectile);
			}
			return true;
		}

		[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveTentacleAttackDamage")]
		[HarmonyPrefix]
		public static bool ParryTentacleAttackDamage(pMediumDamageData data)
		{
			float time = Clock.Time;
			if (time > shoveTime && time - shoveTime < parryDuration)
			{
				Agent damagingAgent = default(Agent);
				((pAgent)(ref data.source)).TryGet(ref damagingAgent);
				return SuccessfullyParry(damagingAgent, ((UFloat16)(ref data.damage)).Get(1f), ParryType.Tentacle);
			}
			return true;
		}

		[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveMeleeDamage")]
		[HarmonyPrefix]
		public static bool ParryMeleeAttackDamage(pMediumDamageData data)
		{
			if (!BloodPunchMeter.punchReady)
			{
				return true;
			}
			float time = Clock.Time;
			if (time > shoveTime && time - shoveTime < parryDuration)
			{
				Agent damagingAgent = default(Agent);
				((pAgent)(ref data.source)).TryGet(ref damagingAgent);
				return SuccessfullyParry(damagingAgent, ((UFloat16)(ref data.damage)).Get(1f), ParryType.Melee);
			}
			return true;
		}

		[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveBulletDamage")]
		[HarmonyPrefix]
		public static bool ParryBulletAttackDamage(pBulletDamageData data)
		{
			float time = Clock.Time;
			if (time > shoveTime && time - shoveTime < parryDuration)
			{
				return SuccessfullyParry(null, ((UFloat16)(ref data.damage)).Get(1f), ParryType.Bullet);
			}
			return true;
		}

		[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveSetDead")]
		[HarmonyPrefix]
		public static bool ParrySetDead()
		{
			float time = Clock.Time;
			if (time > shoveTime && time - shoveTime < parryDuration)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch]
	internal class Meathook
	{
		private static float lastGrapple = 0f;

		public static float grappleCD = 2f;

		[HarmonyPatch(typeof(PlayerInventoryLocal), "CheckInput")]
		[HarmonyPrefix]
		public static bool ActivateMeathook(PlayerInventoryLocal __instance)
		{
			//IL_0009: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0076: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: 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)
			if (InputMapper.GetButtonDownKeyMouseGamepad((InputAction)31, ((PlayerInventoryBase)__instance).Owner.InputFilter))
			{
				float time = Clock.Time;
				if (time - lastGrapple > grappleCD)
				{
					PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
					WeaponHitData val = new WeaponHitData
					{
						randomSpread = 0f,
						maxRayDist = 100f
					};
					Vector3 position = localPlayerAgent.FPSCamera.Position;
					WeaponHitData obj = val;
					Vector3 val2 = localPlayerAgent.FPSCamera.CameraRayPos - position;
					obj.fireDir = ((Vector3)(ref val2)).normalized;
					val.owner = localPlayerAgent;
					if (Weapon.CastWeaponRay(((Component)localPlayerAgent.FPSCamera).transform, ref val, position, -1))
					{
						BulletWeapon.BulletHit(val, false, 0f, 0u, true);
						RaycastHit rayHit = val.rayHit;
						if (((Component)((RaycastHit)(ref rayHit)).collider).gameObject.GetComponent<IDamageable>() != null)
						{
							lastGrapple = time;
							localPlayerAgent.Sound.Post(220841553u, true);
							Vector3 position2 = ((Agent)localPlayerAgent).Position;
							rayHit = val.rayHit;
							Vector3 val3 = position2 - ((RaycastHit)(ref rayHit)).point;
							float magnitude = ((Vector3)(ref val3)).magnitude;
							Vector3 val4 = val3 / magnitude;
							Vector3 val5 = val4 * -1.5f * magnitude;
							Vector3 val6 = Vector3.up * 0.25f * magnitude;
							localPlayerAgent.Locomotion.AddExternalPushForce(val5);
							if (((Agent)localPlayerAgent).Alive)
							{
								localPlayerAgent.Locomotion.ChangeState((PLOC_State)3, true);
								localPlayerAgent.Locomotion.VerticalVelocity = val5 + val6 + Vector3.up * 10f;
							}
						}
						else
						{
							localPlayerAgent.Sound.Post(401606156u, true);
						}
						rayHit = val.rayHit;
						FX_Manager.EffectTargetPosition = ((RaycastHit)(ref rayHit)).point;
					}
					else
					{
						FX_Manager.EffectTargetPosition = localPlayerAgent.FPSCamera.CameraRayPos;
					}
					FX_Manager.PlayLocalVersion = false;
					((FX_EffectBase)BulletWeapon.s_tracerPool.AquireEffect()).Play((FX_Trigger)null, ((Agent)localPlayerAgent).EyePosition, Quaternion.LookRotation(val.fireDir));
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch]
	internal class GroundSlam
	{
		private static bool slamming = false;

		private static float lastSlamStart = Clock.Time;

		private static float lastSlamEnd = Clock.Time;

		private static float slamStorageTimeInAir = 0.3f;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PLOC_Fall), "Update")]
		public static void Update(PLOC_Fall __instance)
		{
			//IL_000e: 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)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (InputMapper.GetButtonDown.Invoke((InputAction)10, ((PLOC_Base)__instance).m_owner.InputFilter) && !slamming)
			{
				PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
				((PLOC_Base)__instance).ResetAllVelocity();
				localPlayerAgent.Locomotion.VerticalVelocity = Vector3.up * -20f;
				slamming = true;
				lastSlamStart = Clock.Time;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PLOC_Jump), "Update")]
		public static void Update(PLOC_Jump __instance)
		{
			//IL_000e: 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)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (InputMapper.GetButtonDown.Invoke((InputAction)10, ((PLOC_Base)__instance).m_owner.InputFilter) && !slamming)
			{
				PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
				((PLOC_Base)__instance).ResetAllVelocity();
				localPlayerAgent.Locomotion.VerticalVelocity = Vector3.up * -20f;
				slamming = true;
				lastSlamStart = Clock.Time;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PLOC_Crouch), "Enter")]
		public static void Enter(PLOC_Crouch __instance)
		{
			//IL_0086: 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_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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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)
			if (slamming)
			{
				slamming = false;
				lastSlamEnd = Clock.Time;
				PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
				if (lastSlamEnd - lastSlamStart > slamStorageTimeInAir)
				{
					Parry.DoExplosionDamage(((Agent)localPlayerAgent).EyePosition - Vector3.up * 0.5f, 5f, 150.01f, 1500f);
					localPlayerAgent.Sound.Post(982870292u, ((Agent)localPlayerAgent).Position);
				}
				else
				{
					Parry.DoExplosionDamage(((Agent)localPlayerAgent).EyePosition - Vector3.up * 0.5f, 3f, 8.01f, 1500f);
					localPlayerAgent.Sound.Post(EVENTS.FRAGGRENADEEXPLODE, ((Agent)localPlayerAgent).Position);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PLOC_Run), "Enter")]
		public static void Enter(PLOC_Run __instance)
		{
			//IL_0086: 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_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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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)
			if (slamming)
			{
				slamming = false;
				lastSlamEnd = Clock.Time;
				PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
				if (lastSlamEnd - lastSlamStart > slamStorageTimeInAir)
				{
					Parry.DoExplosionDamage(((Agent)localPlayerAgent).EyePosition - Vector3.up * 0.5f, 5f, 150.01f, 1500f);
					localPlayerAgent.Sound.Post(982870292u, ((Agent)localPlayerAgent).Position);
				}
				else
				{
					Parry.DoExplosionDamage(((Agent)localPlayerAgent).EyePosition - Vector3.up * 0.5f, 3f, 8.01f, 1500f);
					localPlayerAgent.Sound.Post(EVENTS.FRAGGRENADEEXPLODE, ((Agent)localPlayerAgent).Position);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PLOC_Stand), "Enter")]
		public static void Enter(PLOC_Stand __instance)
		{
			//IL_0086: 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_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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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)
			if (slamming)
			{
				slamming = false;
				lastSlamEnd = Clock.Time;
				PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
				if (lastSlamEnd - lastSlamStart > slamStorageTimeInAir)
				{
					Parry.DoExplosionDamage(((Agent)localPlayerAgent).EyePosition - Vector3.up * 0.5f, 5f, 150.01f, 1500f);
					localPlayerAgent.Sound.Post(982870292u, ((Agent)localPlayerAgent).Position);
				}
				else
				{
					Parry.DoExplosionDamage(((Agent)localPlayerAgent).EyePosition - Vector3.up * 0.5f, 3f, 8.01f, 1500f);
					localPlayerAgent.Sound.Post(EVENTS.FRAGGRENADEEXPLODE, ((Agent)localPlayerAgent).Position);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PLOC_Jump), "Enter")]
		public static void Enter(PLOC_Jump __instance)
		{
			//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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			float time = Clock.Time;
			if (!(time - lastSlamEnd > 0.3f))
			{
				int num = (int)((PLOC_Base)__instance).m_owner.Sound.Post(EVENTS.IMPLANTSMALLJUMPBOOSTTRIGGER, true);
				PlayerLocomotion locomotion = ((PLOC_Base)__instance).m_owner.Locomotion;
				locomotion.VerticalVelocity += Vector3.up * 10f;
			}
		}
	}
	[HarmonyPatch]
	internal class BloodPunch
	{
		private static float punchDamage = 150.1f;

		private static float punchStaggerMulti = 3f;

		public static float punchExplosionDamage = 150.1f;

		public static float punchExplosionRadius = 5f;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MeleeWeaponFirstPerson), "DoAttackDamage")]
		public static bool Punch(MeleeWeaponDamageData data, bool isPush, MeleeWeaponFirstPerson __instance)
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			if (isPush && BloodPunchMeter.punchReady)
			{
				if ((Object)(object)data.damageGO == (Object)null)
				{
					return false;
				}
				ColliderMaterial component = data.damageGO.GetComponent<ColliderMaterial>();
				IDamageable val = null;
				if ((Object)(object)component != (Object)null)
				{
					val = component.Damageable;
				}
				if (val == null)
				{
					val = data.damageGO.GetComponent<IDamageable>();
				}
				if (val == null)
				{
					return false;
				}
				((ItemEquippable)__instance).Sound.Post(2062878866u, true);
				PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
				localPlayerAgent.GiveHealth(localPlayerAgent, 0.2f);
				localPlayerAgent.FPSCamera.AddHitReact(0.6f, Vector3.up, 0f, true, true);
				val.MeleeDamage(punchDamage, (Agent)(object)((Item)__instance).Owner, data.hitPos, data.hitPos - data.sourcePos, punchStaggerMulti, 1f, 1f, 1f, 1f, false, (DamageNoiseLevel)0, 0u);
				Parry.DoExplosionDamage(((Agent)localPlayerAgent).EyePosition - Vector3.up * 0.5f, punchExplosionRadius, punchExplosionDamage, 5000f);
				BloodPunchMeter.instance.ResetMeter();
				return false;
			}
			return true;
		}
	}
	public class BloodPunchMeter : MonoBehaviour
	{
		[HarmonyPatch(typeof(CM_PageRundown_New), "PlaceRundown")]
		public class PrepareInjection
		{
			public static bool InjectedFlag;

			private static bool _isInjected;

			[HarmonyPostfix]
			public static void PostFix()
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Expected O, but got Unknown
				if (!InjectedFlag)
				{
					InjectedFlag = true;
					GameObject val = new GameObject();
					val.AddComponent<BloodPunchMeter>();
					Object.DontDestroyOnLoad((Object)(object)val);
				}
			}
		}

		private static float charge;

		public static bool punchReady;

		public TextMeshPro bloodMeter { get; set; }

		public static BloodPunchMeter instance { get; set; }

		public void Awake()
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			instance = this;
			PUI_Inventory inventory = GuiManager.Current.m_playerLayer.Inventory;
			foreach (RectTransform componentsInChild in ((Component)inventory.m_iconDisplay).GetComponentsInChildren<RectTransform>(true))
			{
				if (!(((Object)componentsInChild).name == "Background Fade"))
				{
					continue;
				}
				TextMeshPro slim_archetypeName = inventory.m_inventorySlots[(InventorySlot)10].m_slim_archetypeName;
				GameObject val = Object.Instantiate<GameObject>(((Component)componentsInChild).gameObject, ((Transform)componentsInChild).parent);
				RectTransform component = val.GetComponent<RectTransform>();
				val.gameObject.SetActive(true);
				foreach (Transform componentsInChild2 in val.GetComponentsInChildren<Transform>(true))
				{
					if (((Object)componentsInChild2).name == "TimerShowObject")
					{
						((Component)componentsInChild2).gameObject.active = false;
					}
				}
				val.transform.localPosition = new Vector3(-825f, -950f, 0f);
				bloodMeter = Object.Instantiate<TextMeshPro>(slim_archetypeName);
				GameObject val2 = new GameObject($"Blood Punch");
				val2.layer = 5;
				((Object)val2).hideFlags = (HideFlags)61;
				GameObject val3 = val2;
				val3.transform.SetParent(((Component)component).transform, false);
				TextMeshPro obj = bloodMeter;
				((TMP_Text)obj).m_width = ((TMP_Text)obj).m_width * 2f;
				bloodMeter.transform.SetParent(val3.transform, false);
				((Component)bloodMeter).GetComponent<RectTransform>().anchoredPosition = new Vector2(-5f, 9f);
				ResetMeter();
				break;
			}
		}

		public void updateMeter(float chargeAmount)
		{
			//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)
			if (!punchReady)
			{
				charge += chargeAmount;
				if (charge >= 100f)
				{
					((TMP_Text)bloodMeter).SetFaceColor(Color32.op_Implicit(Color.red));
					((TMP_Text)bloodMeter).SetText("Ready - BLOOD PUNCH - Ready", true);
					punchReady = true;
				}
				else
				{
					((TMP_Text)bloodMeter).SetText(string.Format("{0}% - BLOOD PUNCH - {0}%", (int)charge + 1), true);
				}
				((TMP_Text)bloodMeter).ForceMeshUpdate(false, false);
			}
		}

		public void ResetMeter()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)bloodMeter).SetText("0% - Blood Punch - 0%", true);
			((TMP_Text)bloodMeter).SetFaceColor(Color32.op_Implicit(Color.white));
			((TMP_Text)bloodMeter).ForceMeshUpdate(false, false);
			charge = 0f;
			punchReady = false;
		}
	}
}