using System;
using Cpp2IlInjected;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x020004DB RID: 1243
	[Token(Token = "0x20004DB")]
	public class Recoil : OffsetModifier
	{
		// Token: 0x170002C5 RID: 709
		// (get) Token: 0x06002BCB RID: 11211 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x170002C5")]
		public bool isFinished
		{
			[Token(Token = "0x6002BCB")]
			[Address(RVA = "0x504D60", Offset = "0x503D60", VA = "0x180504D60")]
			get
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}
		}

		// Token: 0x06002BCC RID: 11212 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002BCC")]
		[Address(RVA = "0x504CC0", Offset = "0x503CC0", VA = "0x180504CC0")]
		public void SetHandRotations(Quaternion leftHandRotation, Quaternion rightHandRotation)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002BCD RID: 11213 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002BCD")]
		[Address(RVA = "0x503A50", Offset = "0x502A50", VA = "0x180503A50")]
		public void Fire(float magnitude)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002BCE RID: 11214 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002BCE")]
		[Address(RVA = "0x503E00", Offset = "0x502E00", VA = "0x180503E00", Slot = "4")]
		protected override void OnModifyOffset()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002BCF RID: 11215 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002BCF")]
		[Address(RVA = "0x5038A0", Offset = "0x5028A0", VA = "0x1805038A0")]
		private void AfterFBBIK()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002BD0 RID: 11216 RVA: 0x00061520 File Offset: 0x0005F720
		[Token(Token = "0x6002BD0")]
		[Address(RVA = "0x503850", Offset = "0x502850", VA = "0x180503850")]
		private void AfterAimIK()
		{
			if (this.aimIKSolvedLast)
			{
				IKSolverAim solver = this.aimIK.solver;
				float z = this.aimIKAxis.z;
				solver.axis.z = z;
			}
		}

		// Token: 0x170002C6 RID: 710
		// (get) Token: 0x06002BD1 RID: 11217 RVA: 0x00061560 File Offset: 0x0005F760
		[Token(Token = "0x170002C6")]
		private IKEffector primaryHandEffector
		{
			[Token(Token = "0x6002BD1")]
			[Address(RVA = "0x504D80", Offset = "0x503D80", VA = "0x180504D80")]
			get
			{
				FullBodyBipedIK ik = this.ik;
				if (this.handedness != Recoil.Handedness.Right)
				{
					return ik.solver.leftHandEffector;
				}
				return ik.solver.rightHandEffector;
			}
		}

		// Token: 0x170002C7 RID: 711
		// (get) Token: 0x06002BD2 RID: 11218 RVA: 0x0006159C File Offset: 0x0005F79C
		[Token(Token = "0x170002C7")]
		private IKEffector secondaryHandEffector
		{
			[Token(Token = "0x6002BD2")]
			[Address(RVA = "0x504E20", Offset = "0x503E20", VA = "0x180504E20")]
			get
			{
				FullBodyBipedIK ik = this.ik;
				if (this.handedness != Recoil.Handedness.Right)
				{
					return ik.solver.rightHandEffector;
				}
				return ik.solver.leftHandEffector;
			}
		}

		// Token: 0x170002C8 RID: 712
		// (get) Token: 0x06002BD3 RID: 11219 RVA: 0x000615D8 File Offset: 0x0005F7D8
		[Token(Token = "0x170002C8")]
		private Transform primaryHand
		{
			[Token(Token = "0x6002BD3")]
			[Address(RVA = "0x504DD0", Offset = "0x503DD0", VA = "0x180504DD0")]
			get
			{
				FullBodyBipedIK ik = this.ik;
				if (this.handedness != Recoil.Handedness.Right)
				{
					IKEffector leftHandEffector = ik.solver.leftHandEffector;
				}
				return ik.solver.rightHandEffector.bone;
			}
		}

		// Token: 0x170002C9 RID: 713
		// (get) Token: 0x06002BD4 RID: 11220 RVA: 0x00061618 File Offset: 0x0005F818
		[Token(Token = "0x170002C9")]
		private Transform secondaryHand
		{
			[Token(Token = "0x6002BD4")]
			[Address(RVA = "0x504E70", Offset = "0x503E70", VA = "0x180504E70")]
			get
			{
				FullBodyBipedIK ik = this.ik;
				if (this.handedness != Recoil.Handedness.Right)
				{
					IKEffector rightHandEffector = ik.solver.rightHandEffector;
				}
				return ik.solver.leftHandEffector.bone;
			}
		}

		// Token: 0x06002BD5 RID: 11221 RVA: 0x00061658 File Offset: 0x0005F858
		[Token(Token = "0x6002BD5")]
		[Address(RVA = "0x503BF0", Offset = "0x502BF0", VA = "0x180503BF0", Slot = "6")]
		protected override void OnDestroy()
		{
			base.OnDestroy();
			FullBodyBipedIK ik = this.ik;
			int num = 0;
			if (ik != num && this.initiated)
			{
				IKSolverFullBodyBiped solver = this.ik.solver;
				IKSolver.UpdateDelegate onPostUpdate = solver.OnPostUpdate;
				IKSolver.UpdateDelegate updateDelegate = new IKSolver.UpdateDelegate(this.AfterFBBIK);
				Delegate @delegate = Delegate.Remove(onPostUpdate, updateDelegate);
				int num2 = 0;
				if (@delegate == 0 || @delegate != 0)
				{
					solver.OnPostUpdate = num2;
					AimIK aimIK = this.aimIK;
					int num3 = 0;
					if (!(aimIK != num3))
					{
						return;
					}
					IKSolverAim solver2 = this.aimIK.solver;
					IKSolver.UpdateDelegate onPostUpdate2 = solver2.OnPostUpdate;
					IKSolver.UpdateDelegate updateDelegate2 = new IKSolver.UpdateDelegate(this.AfterAimIK);
					Delegate delegate2 = Delegate.Remove(onPostUpdate2, updateDelegate2);
					if (delegate2 == 0 || delegate2 != 0)
					{
						solver2.OnPostUpdate = delegate2;
						return;
					}
				}
				throw new InvalidCastException();
			}
		}

		// Token: 0x06002BD6 RID: 11222 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002BD6")]
		[Address(RVA = "0x504CF0", Offset = "0x503CF0", VA = "0x180504CF0")]
		public Recoil()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x04003529 RID: 13609
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x4003529")]
		[Tooltip("Reference to the AimIK component. Optional, only used to getting the aiming direction.")]
		public AimIK aimIK;

		// Token: 0x0400352A RID: 13610
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x400352A")]
		[Tooltip("Set this true if you are using IKExecutionOrder.cs or a custom script to force AimIK solve after FBBIK.")]
		public bool aimIKSolvedLast;

		// Token: 0x0400352B RID: 13611
		[FieldOffset(Offset = "0x3C")]
		[Token(Token = "0x400352B")]
		[Tooltip("Which hand is holding the weapon?")]
		public Recoil.Handedness handedness;

		// Token: 0x0400352C RID: 13612
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x400352C")]
		[Tooltip("Check for 2-handed weapons.")]
		public bool twoHanded;

		// Token: 0x0400352D RID: 13613
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x400352D")]
		[Tooltip("Weight curve for the recoil offsets. Recoil procedure is as long as this curve.")]
		public AnimationCurve recoilWeight;

		// Token: 0x0400352E RID: 13614
		[FieldOffset(Offset = "0x50")]
		[Token(Token = "0x400352E")]
		[Tooltip("How much is the magnitude randomized each time Recoil is called?")]
		public float magnitudeRandom;

		// Token: 0x0400352F RID: 13615
		[FieldOffset(Offset = "0x54")]
		[Token(Token = "0x400352F")]
		[Tooltip("How much is the rotation randomized each time Recoil is called?")]
		public Vector3 rotationRandom;

		// Token: 0x04003530 RID: 13616
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x4003530")]
		[Tooltip("Rotating the primary hand bone for the recoil (in local space).")]
		public Vector3 handRotationOffset;

		// Token: 0x04003531 RID: 13617
		[FieldOffset(Offset = "0x6C")]
		[Token(Token = "0x4003531")]
		[Tooltip("Time of blending in another recoil when doing automatic fire.")]
		public float blendTime;

		// Token: 0x04003532 RID: 13618
		[FieldOffset(Offset = "0x70")]
		[Token(Token = "0x4003532")]
		[Space]
		[Space(10f)]
		[Tooltip("FBBIK effector position offsets for the recoil (in aiming direction space).")]
		public Recoil.RecoilOffset[] offsets;

		// Token: 0x04003533 RID: 13619
		[FieldOffset(Offset = "0x78")]
		[Token(Token = "0x4003533")]
		[HideInInspector]
		public Quaternion rotationOffset;

		// Token: 0x04003534 RID: 13620
		[FieldOffset(Offset = "0x88")]
		[Token(Token = "0x4003534")]
		private float magnitudeMlp;

		// Token: 0x04003535 RID: 13621
		[FieldOffset(Offset = "0x8C")]
		[Token(Token = "0x4003535")]
		private float endTime;

		// Token: 0x04003536 RID: 13622
		[FieldOffset(Offset = "0x90")]
		[Token(Token = "0x4003536")]
		private Quaternion handRotation;

		// Token: 0x04003537 RID: 13623
		[FieldOffset(Offset = "0xA0")]
		[Token(Token = "0x4003537")]
		private Quaternion secondaryHandRelativeRotation;

		// Token: 0x04003538 RID: 13624
		[FieldOffset(Offset = "0xB0")]
		[Token(Token = "0x4003538")]
		private Quaternion randomRotation;

		// Token: 0x04003539 RID: 13625
		[FieldOffset(Offset = "0xC0")]
		[Token(Token = "0x4003539")]
		private float length;

		// Token: 0x0400353A RID: 13626
		[FieldOffset(Offset = "0xC4")]
		[Token(Token = "0x400353A")]
		private bool initiated;

		// Token: 0x0400353B RID: 13627
		[FieldOffset(Offset = "0xC8")]
		[Token(Token = "0x400353B")]
		private float blendWeight;

		// Token: 0x0400353C RID: 13628
		[FieldOffset(Offset = "0xCC")]
		[Token(Token = "0x400353C")]
		private float w;

		// Token: 0x0400353D RID: 13629
		[FieldOffset(Offset = "0xD0")]
		[Token(Token = "0x400353D")]
		private Quaternion primaryHandRotation;

		// Token: 0x0400353E RID: 13630
		[FieldOffset(Offset = "0xE0")]
		[Token(Token = "0x400353E")]
		private bool handRotationsSet;

		// Token: 0x0400353F RID: 13631
		[FieldOffset(Offset = "0xE4")]
		[Token(Token = "0x400353F")]
		private Vector3 aimIKAxis;

		// Token: 0x020004DC RID: 1244
		[Token(Token = "0x20004DC")]
		[Serializable]
		public class RecoilOffset
		{
			// Token: 0x06002BD7 RID: 11223 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002BD7")]
			[Address(RVA = "0x69BA80", Offset = "0x69AA80", VA = "0x18069BA80")]
			public void Start()
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002BD8 RID: 11224 RVA: 0x000020D3 File Offset: 0x000002D3
			[Token(Token = "0x6002BD8")]
			[Address(RVA = "0x69B7D0", Offset = "0x69A7D0", VA = "0x18069B7D0")]
			public void Apply(IKSolverFullBodyBiped solver, Quaternion rotation, float masterWeight, float length, float timeLeft)
			{
				throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
			}

			// Token: 0x06002BD9 RID: 11225 RVA: 0x00061734 File Offset: 0x0005F934
			[Token(Token = "0x6002BD9")]
			[Address(RVA = "0x69BB30", Offset = "0x69AB30", VA = "0x18069BB30")]
			public RecoilOffset()
			{
			}

			// Token: 0x04003540 RID: 13632
			[FieldOffset(Offset = "0x10")]
			[Token(Token = "0x4003540")]
			[Tooltip("Offset vector for the associated effector when doing recoil.")]
			public Vector3 offset;

			// Token: 0x04003541 RID: 13633
			[FieldOffset(Offset = "0x1C")]
			[Token(Token = "0x4003541")]
			[Range(0f, 1f)]
			[Tooltip("When firing before the last recoil has faded, how much of the current recoil offset will be maintained?")]
			public float additivity = 1f;

			// Token: 0x04003542 RID: 13634
			[FieldOffset(Offset = "0x20")]
			[Token(Token = "0x4003542")]
			[Tooltip("Max additive recoil for automatic fire.")]
			public float maxAdditiveOffsetMag = 0.2f;

			// Token: 0x04003543 RID: 13635
			[FieldOffset(Offset = "0x28")]
			[Token(Token = "0x4003543")]
			[Tooltip("Linking this recoil offset to FBBIK effectors.")]
			public Recoil.RecoilOffset.EffectorLink[] effectorLinks;

			// Token: 0x04003544 RID: 13636
			[FieldOffset(Offset = "0x30")]
			[Token(Token = "0x4003544")]
			private Vector3 additiveOffset;

			// Token: 0x04003545 RID: 13637
			[FieldOffset(Offset = "0x3C")]
			[Token(Token = "0x4003545")]
			private Vector3 lastOffset;

			// Token: 0x020004DD RID: 1245
			[Token(Token = "0x20004DD")]
			[Serializable]
			public class EffectorLink
			{
				// Token: 0x06002BDA RID: 11226 RVA: 0x0003DF9B File Offset: 0x0003C19B
				[Token(Token = "0x6002BDA")]
				[Address(RVA = "0x36ABD0", Offset = "0x369BD0", VA = "0x18036ABD0")]
				public EffectorLink()
				{
				}

				// Token: 0x04003546 RID: 13638
				[FieldOffset(Offset = "0x10")]
				[Token(Token = "0x4003546")]
				[Tooltip("Type of the FBBIK effector to use")]
				public FullBodyBipedEffector effector;

				// Token: 0x04003547 RID: 13639
				[FieldOffset(Offset = "0x14")]
				[Token(Token = "0x4003547")]
				[Tooltip("Weight of using this effector")]
				public float weight;
			}
		}

		// Token: 0x020004DE RID: 1246
		[Token(Token = "0x20004DE")]
		[Serializable]
		public enum Handedness
		{
			// Token: 0x04003549 RID: 13641
			[Token(Token = "0x4003549")]
			Right,
			// Token: 0x0400354A RID: 13642
			[Token(Token = "0x400354A")]
			Left
		}
	}
}
