Decompiled source of HuntSnipersGift v1.0.0

HuntSnipersGift.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace BitWizrd.HuntSnipersGift
{
	[BepInPlugin("BitWizrd.HuntSnipersGift", "HuntSnipersGift", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class HuntSnipersGiftPlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "BitWizrd.HuntSnipersGift");
			OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntSnipersGift", "", "snipersgift", "", "");
		}
	}
}
public class BloodBondSR : MonoBehaviour
{
	private void Awake()
	{
		string name = "Ammo_69_CashMoney_D100(Clone)";
		((Object)((Component)this).gameObject).name = name;
		Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			((Object)((Component)componentsInChildren[i]).gameObject).name = name;
		}
	}
}
public class ComponentActivateRandomRuntime : MonoBehaviour
{
	public float Probability;

	public int Group;

	public float SelectionStart;

	[NonSerialized]
	private bool rollResolved;

	[NonSerialized]
	private float sharedRoll;

	private void Awake()
	{
		if (Probability >= 1f)
		{
			return;
		}
		bool flag;
		if (Group != 0)
		{
			if (!rollResolved)
			{
				ResolveGroupRollsForRoot();
			}
			flag = sharedRoll >= SelectionStart && sharedRoll <= SelectionStart + Probability;
		}
		else
		{
			flag = Random.value <= Probability;
		}
		if (!flag)
		{
			((Component)this).gameObject.SetActive(false);
		}
	}

	private void ResolveGroupRollsForRoot()
	{
		ComponentActivateRandomRuntime[] componentsInChildren = ((Component)((Component)this).transform.root).GetComponentsInChildren<ComponentActivateRandomRuntime>(true);
		Dictionary<int, float> dictionary = new Dictionary<int, float>();
		foreach (ComponentActivateRandomRuntime componentActivateRandomRuntime in componentsInChildren)
		{
			if (componentActivateRandomRuntime.Group != 0 && !componentActivateRandomRuntime.rollResolved)
			{
				if (!dictionary.TryGetValue(componentActivateRandomRuntime.Group, out var value))
				{
					value = Random.value;
					dictionary[componentActivateRandomRuntime.Group] = value;
				}
				componentActivateRandomRuntime.sharedRoll = value;
				componentActivateRandomRuntime.rollResolved = true;
			}
		}
	}
}
public class CooldownSound : MonoBehaviour
{
	public ClosedBoltWeapon weapon;

	public AudioClip[] audioClips;

	public float volume = 1f;

	public int minShots = 5;

	public int maxShots = 10;

	public float minDelay = 0.5f;

	public float maxDelay = 2f;

	public float resetTime = 1.5f;

	private AudioSource audioSource;

	private int shotCounter = 0;

	private float lastShotTime;

	private bool lastRoundSpent;

	private int nextShotThreshold;

	private bool isPlayingSound = false;

	private void Start()
	{
		if ((Object)(object)weapon == (Object)null)
		{
			weapon = ((Component)this).GetComponent<ClosedBoltWeapon>();
		}
		if ((Object)(object)weapon == (Object)null)
		{
			Debug.LogError((object)"CooldownSound: Weapon reference is missing. Attach this script to a ClosedBoltWeapon.");
			return;
		}
		audioSource = ((Component)weapon).gameObject.GetComponent<AudioSource>();
		if ((Object)(object)audioSource == (Object)null)
		{
			audioSource = ((Component)weapon).gameObject.AddComponent<AudioSource>();
		}
		audioSource.spatialBlend = 1f;
		audioSource.playOnAwake = false;
		audioSource.rolloffMode = (AudioRolloffMode)0;
		lastRoundSpent = weapon.Chamber.IsSpent;
		SetNewShotThreshold();
	}

	private void Update()
	{
		DetectFiring();
	}

	private void DetectFiring()
	{
		if (weapon.Chamber.IsFull && weapon.Chamber.IsSpent && !lastRoundSpent)
		{
			OnWeaponFired();
		}
		lastRoundSpent = weapon.Chamber.IsSpent;
	}

	private void OnWeaponFired()
	{
		float num = Time.time - lastShotTime;
		if (num > resetTime)
		{
			shotCounter = 0;
			SetNewShotThreshold();
		}
		shotCounter++;
		lastShotTime = Time.time;
		if (shotCounter >= nextShotThreshold)
		{
			((MonoBehaviour)this).StartCoroutine(PlaySoundWithDelay());
			shotCounter = 0;
			SetNewShotThreshold();
		}
	}

	private IEnumerator PlaySoundWithDelay()
	{
		if (!isPlayingSound)
		{
			isPlayingSound = true;
			float delay = Random.Range(minDelay, maxDelay);
			yield return (object)new WaitForSeconds(delay);
			if (audioClips.Length > 0)
			{
				int index = Random.Range(0, audioClips.Length);
				audioSource.clip = audioClips[index];
				audioSource.PlayOneShot(audioSource.clip, volume);
				yield return (object)new WaitForSeconds(audioSource.clip.length);
			}
			isPlayingSound = false;
		}
	}

	private void SetNewShotThreshold()
	{
		nextShotThreshold = Random.Range(minShots, maxShots + 1);
	}
}
[ExecuteInEditMode]
public class CryErosionDriver : MonoBehaviour
{
	private static readonly int ErosionValueId = Shader.PropertyToID("_ErosionValue");

	[Range(0f, 1f)]
	public float Burn = 0f;

	public Renderer[] Renderers;

	public bool HideWhenGone = true;

	private MaterialPropertyBlock _block;

	private float _burnRate;

	private float _lastApplied = -1f;

	public void BurnOver(float seconds)
	{
		_burnRate = ((!(seconds > 0.0001f)) ? 0f : ((1f - Burn) / seconds));
		if (_burnRate <= 0f)
		{
			Burn = 1f;
		}
	}

	public void Restore()
	{
		_burnRate = 0f;
		Burn = 0f;
		Apply(force: true);
	}

	private void LateUpdate()
	{
		if (_burnRate > 0f && Application.isPlaying)
		{
			Burn = Mathf.Min(1f, Burn + _burnRate * Time.deltaTime);
			if (Burn >= 1f)
			{
				_burnRate = 0f;
			}
		}
		Apply(force: false);
	}

	private void OnValidate()
	{
		Apply(force: true);
	}

	private void Apply(bool force)
	{
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Expected O, but got Unknown
		float num = Mathf.Clamp01(Burn);
		if (!force && Mathf.Approximately(num, _lastApplied))
		{
			return;
		}
		_lastApplied = num;
		if (Renderers == null || Renderers.Length == 0)
		{
			Renderers = ((Component)this).GetComponentsInChildren<Renderer>(true);
		}
		if (_block == null)
		{
			_block = new MaterialPropertyBlock();
		}
		bool flag = HideWhenGone && num >= 1f;
		for (int i = 0; i < Renderers.Length; i++)
		{
			Renderer val = Renderers[i];
			if (!((Object)(object)val == (Object)null))
			{
				val.GetPropertyBlock(_block);
				_block.SetFloat(ErosionValueId, 1f - num);
				val.SetPropertyBlock(_block);
				if (HideWhenGone)
				{
					val.enabled = !flag;
				}
			}
		}
	}
}
public class CustomWaggleJoint : MonoBehaviour
{
	public float distanceLimit = 0.25f;

	public float angleLimitLeft = 45f;

	public float angleLimitRight = 45f;

	public float gravityScale = 1f;

	public bool useSpring;

	public float springApproachRate = 0.95f;

	public float damping;

	public Transform hingeGraphic;

	public Vector3 hingeGraphicRotationOffset;

	public bool invertWaggleAxis;

	public bool ManualExecution;

	public float onHitLimitCooldown = 0.05f;

	public Vector3 waggleAxis = Vector3.up;

	public Vector3 rotationAxis = Vector3.up;

	[Header("Gizmo Options")]
	public bool debugGizmos = false;

	public bool showRotationExtremes = false;

	public bool showRotationDirectionArrows = false;

	private Vector3 particlePos;

	private Vector3 particleVel;

	private bool leftCatchState;

	private bool rightCatchState;

	private float lastTouchTime = float.MinValue;

	private Vector3 EffectiveWaggleDir()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: 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)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		return ((Component)this).transform.TransformDirection((!invertWaggleAxis) ? waggleAxis : (-waggleAxis));
	}

	private void GetEffectiveAngleLimits(out float effectiveAngleMin, out float effectiveAngleMax)
	{
		if (invertWaggleAxis)
		{
			effectiveAngleMin = 0f - angleLimitLeft;
			effectiveAngleMax = angleLimitRight;
		}
		else
		{
			effectiveAngleMin = 0f - angleLimitRight;
			effectiveAngleMax = angleLimitLeft;
		}
	}

	public void ResetParticlePos()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_0023: 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)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		particlePos = ((Component)this).transform.position + EffectiveWaggleDir() * distanceLimit;
		particleVel = Vector3.zero;
	}

	private void OnHitLimit(float angularVelocity)
	{
	}

	public void Execute()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//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)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0051: 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)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: 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_007a: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: 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_00e4: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: 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_0101: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: 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_0137: 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_0141: Unknown result type (might be due to invalid IL or missing references)
		float deltaTime = Time.deltaTime;
		Transform transform = ((Component)this).transform;
		Vector3 val = Physics.gravity * gravityScale;
		Vector3 val2 = particlePos;
		Vector3 val3 = particleVel * Mathf.Pow(1f - damping, deltaTime) + val * deltaTime;
		Vector3 val4 = val2 + val3 * deltaTime;
		Vector3 val5 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized);
		Vector3 val6 = EffectiveWaggleDir();
		Vector3 position = transform.position;
		if (useSpring)
		{
			val4 = Vector3.Lerp(val4, position + val6 * distanceLimit, 1f - Mathf.Pow(1f - springApproachRate, deltaTime));
		}
		GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax);
		particlePos = ProjectOnHinge(val4, position, val5, val6, distanceLimit, effectiveAngleMin, effectiveAngleMax);
		particleVel = (particlePos - val2) / deltaTime;
		if ((Object)(object)hingeGraphic != (Object)null)
		{
			hingeGraphic.rotation = Quaternion.LookRotation(particlePos - transform.position, val5) * Quaternion.Euler(hingeGraphicRotationOffset);
		}
	}

	private Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: 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)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: 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_0021: 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_0027: 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_002f: 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_003b: Unknown result type (might be due to invalid IL or missing references)
		float num = ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection);
		num = Mathf.Clamp(num, angleMin, angleMax);
		Vector3 val = Quaternion.AngleAxis(num, hingeAxis) * hingeDirection;
		return val * distanceLimit + hingePivot;
	}

	private float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = point - hingePivot;
		Vector3 val2 = Vector3.ProjectOnPlane(val, hingeAxis);
		Vector3 normalized = ((Vector3)(ref val2)).normalized;
		return SignedAngle(hingeDirection, normalized, hingeAxis);
	}

	private float SignedAngle(Vector3 from, Vector3 to, Vector3 axis)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		float num = Vector3.Angle(from, to);
		return num * Mathf.Sign(Vector3.Dot(axis, Vector3.Cross(from, to)));
	}

	private void Start()
	{
		ResetParticlePos();
	}

	private void Update()
	{
		if (!ManualExecution)
		{
			Execute();
		}
	}
}
namespace BitWizrd.Revolver.DoubleAction
{
	public class DoubleActionEjectorRod : FVRInteractiveObject
	{
		public DoubleActionLoadingGateRevolver revolver;
	}
	public class DoubleActionLoadingGateEjectorRod : FVRInteractiveObject
	{
		public DoubleActionLoadingGateRevolver Revolver;

		public override void SimpleInteraction(FVRViveHand hand)
		{
			((FVRInteractiveObject)this).SimpleInteraction(hand);
			Revolver.EjectPrevCylinder();
		}
	}
	public class DoubleActionLoadingGateRevolver : FVRFireArm
	{
		public enum RotAxis
		{
			X,
			Y,
			Z
		}

		public enum CylinderRotAxis
		{
			Authored,
			X,
			Y,
			Z
		}

		[Header("Single Action Revolver")]
		public bool AllowsSuppressor;

		public Transform Hammer;

		public Transform LoadingGate;

		public Transform Trigger;

		public Transform EjectorRod;

		public SingleActionRevolverCylinder Cylinder;

		public CylinderRotAxis CylinderAxis = CylinderRotAxis.Authored;

		public bool InvertCylinderSpin;

		public bool InvertCylinderTranslate;

		public bool TranslateFromRealTrigger;

		public bool CylinderTranslateRelative;

		private Vector3 m_cylinderRestPos;

		public bool InvertHammerRot;

		public bool InvertLoadingGateRot;

		public bool InvertTriggerRot;

		public bool InvertSpinRot;

		public Transform HammerFanDir;

		private int m_curChamber;

		private float m_curChamberLerp;

		private float m_tarChamberLerp;

		[Header("Component Movement Params")]
		public float Hammer_Rot_Uncocked;

		public float Hammer_Rot_Halfcocked;

		public float Hammer_Rot_Cocked;

		public float LoadingGate_Rot_Closed;

		public float LoadingGate_Rot_Open;

		public float Trigger_Rot_Forward;

		public float Trigger_Rot_Rearward;

		public Vector3 EjectorRod_Pos_Forward;

		public Vector3 EjectorRod_Pos_Rearward;

		public bool DoesCylinderTranslateForward;

		public bool IsAccessTwoChambersBack;

		public Vector3 CylinderBackPos;

		public Vector3 CylinderFrontPos;

		public RotAxis HammerAxis = RotAxis.X;

		public RotAxis LoadingGateAxis = RotAxis.Z;

		public RotAxis TriggerAxis = RotAxis.X;

		[Header("Spinning Config")]
		public Transform PoseSpinHolder;

		public bool CanSpin = true;

		public bool CanFan = true;

		public RotAxis SpinAxis = RotAxis.X;

		private bool m_isSpinning;

		[Header("StateToggling")]
		public bool StateToggles = true;

		private bool m_isStateToggled;

		public Transform Pose_Main;

		public Transform Pose_Toggled;

		public float TriggerThreshold = 0.9f;

		public float TriggerResetThreshold = 0.3f;

		private float m_hammerTranslate;

		private float m_firedTriggerPeak;

		private float m_translateLerp;

		private float m_camFloor;

		private readonly List<FVRFireArmRound> m_hoveredRounds = new List<FVRFireArmRound>();

		private float m_triggerFloat;

		private float xSpinRot;

		private float xSpinVel;

		private float timeSinceColFire;

		[Header("DoubleAction Config")]
		private float m_tarTriggerFloat;

		private float m_tarRealTriggerFloat;

		private float m_triggerCurrentRot;

		private float m_curTriggerFloat;

		private float m_curRealTriggerFloat;

		private float lastTriggerRot;

		private RecockingState m_recockingState;

		private float m_recockingLerp;

		private bool m_shouldRecock;

		[SerializeField]
		private bool DoesFiringRecock = false;

		private bool m_hasTriggerCycled;

		public bool CanManuallyCockHammer;

		private bool m_isHammerLocked;

		private float m_hammerCurrentRot;

		private Vector2 RecockingSpeeds = new Vector2(8f, 3f);

		public Transform RecockingPiece;

		public Transform RecockingPoint_Forward;

		public Transform RecockingPoint_Rearward;

		public float ejectedRoundOffset;

		public bool doesToggleStateHalfRotatesCylinder;

		public int CurChamber
		{
			get
			{
				return m_curChamber;
			}
			set
			{
				m_curChamber = value % Cylinder.NumChambers;
			}
		}

		public int NextChamber => (m_curChamber + 1) % Cylinder.NumChambers;

		public int PrevChamber
		{
			get
			{
				int num = m_curChamber - 1;
				return (num >= 0) ? num : (Cylinder.NumChambers - 1);
			}
		}

		public int PrevChamber2
		{
			get
			{
				int num = m_curChamber - 2;
				return (num >= 0) ? num : (Cylinder.NumChambers + num);
			}
		}

		private static Vector3 AxisVector(RotAxis axis, float angle)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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)
			return (Vector3)(axis switch
			{
				RotAxis.Y => new Vector3(0f, angle, 0f), 
				RotAxis.Z => new Vector3(0f, 0f, angle), 
				_ => new Vector3(angle, 0f, 0f), 
			});
		}

		private static float AxisValue(Vector3 euler, RotAxis axis)
		{
			return axis switch
			{
				RotAxis.Y => euler.y, 
				RotAxis.Z => euler.z, 
				_ => euler.x, 
			};
		}

		private Quaternion GetCylinderRotation(int chamberIndex)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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)
			//IL_007e: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			Quaternion localRotationFromCylinder = Cylinder.GetLocalRotationFromCylinder(chamberIndex);
			if (CylinderAxis == CylinderRotAxis.Authored)
			{
				return localRotationFromCylinder;
			}
			float num = 2f * Mathf.Atan2(localRotationFromCylinder.z, localRotationFromCylinder.w) * 57.29578f;
			if (InvertCylinderSpin)
			{
				num = 0f - num;
			}
			Vector3 val = Vector3.forward;
			if (CylinderAxis == CylinderRotAxis.X)
			{
				val = Vector3.right;
			}
			else if (CylinderAxis == CylinderRotAxis.Y)
			{
				val = Vector3.up;
			}
			return Quaternion.AngleAxis(num, val);
		}

		public override void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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)
			((FVRFireArm)this).Awake();
			m_cylinderRestPos = ((Component)Cylinder).transform.localPosition;
			FVRFireArmChamber[] chambers = Cylinder.Chambers;
			foreach (FVRFireArmChamber item in chambers)
			{
				base.FChambers.Add(item);
			}
			if ((Object)(object)((FVRInteractiveObject)this).PoseOverride_Touch != (Object)null)
			{
				Pose_Main.localPosition = ((FVRInteractiveObject)this).PoseOverride_Touch.localPosition;
				Pose_Main.localRotation = ((FVRInteractiveObject)this).PoseOverride_Touch.localRotation;
			}
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			//IL_00a2: 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_0030: 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_00e0: 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)
			//IL_006e: 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)
			((FVRFireArm)this).BeginInteraction(hand);
			if (((FVRPhysicalObject)this).IsAltHeld)
			{
				return;
			}
			if (!m_isStateToggled)
			{
				((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition;
				((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation;
				if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null)
				{
					((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition;
					((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation;
				}
			}
			else
			{
				((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition;
				((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation;
				if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null)
				{
					((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition;
					((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation;
				}
			}
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: 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_004d: 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_01cb: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			m_isSpinning = false;
			if (!((FVRPhysicalObject)this).IsAltHeld)
			{
				if (!m_isStateToggled)
				{
					if (hand.Input.TouchpadPressed && !hand.IsInStreamlinedMode && (double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45.0)
					{
						m_isSpinning = true;
					}
					if (hand.IsInStreamlinedMode)
					{
						if (hand.Input.BYButtonDown && StateToggles)
						{
							ToggleState();
							((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
						}
					}
					else if (hand.Input.TouchpadDown && (double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45.0 && StateToggles)
					{
						ToggleState();
						((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
					}
				}
				else
				{
					if (hand.IsInStreamlinedMode)
					{
						if (hand.Input.AXButtonDown)
						{
							AdvanceCylinder();
						}
						if (hand.Input.BYButtonDown && StateToggles)
						{
							ToggleState();
							((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f);
						}
					}
					else if (hand.Input.TouchpadDown)
					{
						if ((double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45.0 && StateToggles)
						{
							ToggleState();
							((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f);
						}
						else if ((double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45.0)
						{
							AdvanceCylinder();
						}
					}
					if (hand.Input.TriggerDown)
					{
						EjectPrevCylinder();
					}
				}
			}
			UpdateTriggerHammer();
			UpdateCylinderRot();
			if (!((FVRInteractiveObject)this).IsHeld || ((FVRPhysicalObject)this).IsAltHeld || (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null)
			{
				m_isSpinning = false;
			}
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			//IL_00df: 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)
			m_triggerFloat = 0f;
			m_hasTriggerCycled = false;
			m_curTriggerFloat = 0f;
			m_curRealTriggerFloat = 0f;
			m_firedTriggerPeak = 0f;
			m_triggerCurrentRot = Trigger_Rot_Forward;
			lastTriggerRot = m_triggerCurrentRot;
			if ((Object)(object)Trigger != (Object)null)
			{
				Trigger.localEulerAngles = AxisVector(TriggerAxis, (!InvertTriggerRot) ? m_triggerCurrentRot : (0f - m_triggerCurrentRot));
			}
			m_hammerTranslate = ((!m_isHammerLocked) ? 0f : 1f);
			m_camFloor = 0f;
			UpdateCylinderTranslate(snap: true);
			((FVRFireArm)this).EndInteraction(hand);
			((FVRPhysicalObject)this).RootRigidbody.AddRelativeTorque(new Vector3(xSpinVel, 0f, 0f), (ForceMode)1);
		}

		public override void FVRUpdate()
		{
			((FVRFireArm)this).FVRUpdate();
			UpdateRecocking();
		}

		public override void FVRFixedUpdate()
		{
			UpdateSpinning();
			if ((double)timeSinceColFire < 3.0)
			{
				timeSinceColFire += Time.deltaTime;
			}
			((FVRFireArm)this).FVRFixedUpdate();
			UpdateHoveredRounds();
		}

		private void UpdateHoveredRounds()
		{
			//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_0098: 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_00a4: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			FVRFireArmChamber val = null;
			if (m_isStateToggled)
			{
				for (int i = 0; i < Cylinder.Chambers.Length; i++)
				{
					if (Cylinder.Chambers[i].IsAccessible)
					{
						val = Cylinder.Chambers[i];
						break;
					}
				}
			}
			Collider val2 = ((!((Object)(object)val != (Object)null) || val.IsFull) ? null : ((Component)val).GetComponent<Collider>());
			List<FVRFireArmRound> list = null;
			if ((Object)(object)val2 != (Object)null)
			{
				Bounds bounds = val2.bounds;
				Collider[] array = Physics.OverlapBox(((Bounds)(ref bounds)).center, ((Bounds)(ref bounds)).extents, Quaternion.identity, -1, (QueryTriggerInteraction)2);
				for (int j = 0; j < array.Length; j++)
				{
					FVRFireArmRound componentInParent = ((Component)array[j]).GetComponentInParent<FVRFireArmRound>();
					if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.IsSpent && componentInParent.isManuallyChamberable && componentInParent.RoundType == val.RoundType && !((Object)(object)componentInParent.m_hoverOverReloadTrigger != (Object)null))
					{
						if (list == null)
						{
							list = new List<FVRFireArmRound>();
						}
						if (!list.Contains(componentInParent))
						{
							list.Add(componentInParent);
						}
					}
				}
			}
			for (int num = m_hoveredRounds.Count - 1; num >= 0; num--)
			{
				FVRFireArmRound val3 = m_hoveredRounds[num];
				if ((Object)(object)val3 == (Object)null)
				{
					m_hoveredRounds.RemoveAt(num);
				}
				else if (list == null || !list.Contains(val3))
				{
					if ((Object)(object)val3.HoveredOverChamber != (Object)null && IsOurChamber(val3.HoveredOverChamber))
					{
						val3.HoveredOverChamber = null;
					}
					m_hoveredRounds.RemoveAt(num);
				}
			}
			if (list == null)
			{
				return;
			}
			for (int k = 0; k < list.Count; k++)
			{
				FVRFireArmRound val4 = list[k];
				if ((Object)(object)val4.HoveredOverChamber == (Object)null)
				{
					val4.HoveredOverChamber = val;
					if (!m_hoveredRounds.Contains(val4))
					{
						m_hoveredRounds.Add(val4);
					}
				}
			}
		}

		private bool IsOurChamber(FVRFireArmChamber chamber)
		{
			for (int i = 0; i < Cylinder.Chambers.Length; i++)
			{
				if ((Object)(object)Cylinder.Chambers[i] == (Object)(object)chamber)
				{
					return true;
				}
			}
			return false;
		}

		private void UpdateRecocking()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//IL_0085: 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_009b: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			RecockingState recockingState = m_recockingState;
			if ((int)recockingState != 1)
			{
				if ((int)recockingState == 2)
				{
					m_recockingLerp -= Time.deltaTime * RecockingSpeeds.y;
					if ((double)m_recockingLerp <= 0.0)
					{
						m_recockingState = (RecockingState)0;
					}
					m_recockingLerp = Mathf.Clamp(m_recockingLerp, 0f, 1f);
					RecockingPiece.position = Vector3.Lerp(RecockingPoint_Forward.position, RecockingPoint_Rearward.position, m_recockingLerp);
				}
			}
			else
			{
				m_recockingLerp += Time.deltaTime * RecockingSpeeds.x;
				if ((double)m_recockingLerp >= 1.0)
				{
					m_recockingState = (RecockingState)2;
					m_isHammerLocked = true;
				}
				m_recockingLerp = Mathf.Clamp(m_recockingLerp, 0f, 1f);
				RecockingPiece.position = Vector3.Lerp(RecockingPoint_Forward.position, RecockingPoint_Rearward.position, m_recockingLerp);
			}
		}

		private void InitiateRecock()
		{
			//IL_0002: 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)
			if ((int)m_recockingState == 0)
			{
				m_recockingLerp = 0f;
				m_recockingState = (RecockingState)1;
			}
		}

		private void UpdateCylinderTranslate()
		{
			UpdateCylinderTranslate(snap: false);
		}

		private void UpdateCylinderTranslate(bool snap)
		{
			//IL_00e3: 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_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_0118: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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)
			if (DoesCylinderTranslateForward)
			{
				m_hammerTranslate = Mathf.MoveTowards(m_hammerTranslate, (!m_isHammerLocked) ? 0f : 1f, Time.deltaTime * 14f);
				float num = ((!TranslateFromRealTrigger) ? m_curTriggerFloat : m_curRealTriggerFloat);
				if (m_hasTriggerCycled)
				{
					num = m_curRealTriggerFloat / Mathf.Max(m_firedTriggerPeak, 0.01f);
				}
				num = Mathf.Max(num, m_hammerTranslate);
				m_translateLerp = ((!snap) ? Mathf.MoveTowards(m_translateLerp, num, Time.deltaTime * 20f) : num);
				float num2 = ((!InvertCylinderTranslate) ? m_translateLerp : (1f - m_translateLerp));
				Vector3 val = Vector3.Lerp(CylinderBackPos, CylinderFrontPos, num2);
				if (CylinderTranslateRelative)
				{
					val += m_cylinderRestPos;
				}
				((Component)Cylinder).transform.localPosition = val;
			}
		}

		private void UpdateTriggerHammer()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_0089: 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_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Invalid comparison between Unknown and I4
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Invalid comparison between Unknown and I4
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			if (CanFan && ((FVRInteractiveObject)this).IsHeld && !m_isStateToggled && !m_isHammerLocked && (Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand != (Object)null)
			{
				Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld;
				if (Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, HammerFanDir.position) < 0.15f && Vector3.Angle(velLinearWorld, HammerFanDir.forward) < 60f && ((Vector3)(ref velLinearWorld)).magnitude > 1f)
				{
					CockHammer(10f);
				}
			}
			if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !m_isSpinning && !m_isStateToggled && !((FVRPhysicalObject)this).IsAltHeld)
			{
				m_tarTriggerFloat = ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat;
				m_tarRealTriggerFloat = ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat;
			}
			else
			{
				m_tarTriggerFloat = 0f;
				m_tarRealTriggerFloat = 0f;
			}
			if (m_isHammerLocked)
			{
				m_tarTriggerFloat += 0.8f;
				m_triggerCurrentRot = Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, m_curTriggerFloat);
			}
			else
			{
				m_triggerCurrentRot = Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, m_curTriggerFloat);
			}
			m_curTriggerFloat = Mathf.MoveTowards(m_curTriggerFloat, m_tarTriggerFloat, Time.deltaTime * 14f);
			m_curRealTriggerFloat = Mathf.MoveTowards(m_curRealTriggerFloat, m_tarRealTriggerFloat, Time.deltaTime * 14f);
			if (m_hasTriggerCycled)
			{
				m_firedTriggerPeak = Mathf.Max(m_firedTriggerPeak, m_curRealTriggerFloat);
			}
			else
			{
				m_firedTriggerPeak = 0f;
			}
			if (m_hasTriggerCycled)
			{
				m_camFloor = 1f;
			}
			else
			{
				m_camFloor = Mathf.Min(m_camFloor, m_curTriggerFloat);
			}
			UpdateCylinderTranslate();
			if (Mathf.Abs(m_triggerCurrentRot - lastTriggerRot) > 0.01f && (Object)(object)Trigger != (Object)null)
			{
				Trigger.localEulerAngles = AxisVector(TriggerAxis, (!InvertTriggerRot) ? m_triggerCurrentRot : (0f - m_triggerCurrentRot));
			}
			lastTriggerRot = m_triggerCurrentRot;
			if (m_shouldRecock)
			{
				m_shouldRecock = false;
				InitiateRecock();
			}
			if (!m_hasTriggerCycled)
			{
				if ((!DoesFiringRecock || (int)m_recockingState == 0) && m_curTriggerFloat >= 0.95f && !((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed)
				{
					if (!m_isStateToggled)
					{
						m_hasTriggerCycled = true;
						m_isHammerLocked = false;
						CurChamber++;
						m_curChamberLerp = 0f;
						m_tarChamberLerp = 0f;
						Fire();
						if (DoesFiringRecock)
						{
							m_shouldRecock = true;
						}
					}
				}
				else if (m_curTriggerFloat <= 0.14f && !m_isHammerLocked && CanManuallyCockHammer)
				{
					bool flag = DoesFiringRecock && (int)m_recockingState != 0;
					if (!((FVRPhysicalObject)this).IsAltHeld && !flag && !m_isStateToggled)
					{
						if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode)
						{
							if (((FVRInteractiveObject)this).m_hand.Input.AXButtonDown)
							{
								CockHammer(5f);
							}
						}
						else if (((FVRInteractiveObject)this).m_hand.Input.TouchpadDown && Vector2.Angle(((FVRInteractiveObject)this).m_hand.Input.TouchpadAxes, Vector2.down) < 45f)
						{
							CockHammer(5f);
						}
					}
				}
			}
			else if (m_hasTriggerCycled && m_curRealTriggerFloat <= Mathf.Min(TriggerResetThreshold, Mathf.Max(m_firedTriggerPeak - 0.1f, 0.05f)))
			{
				m_hasTriggerCycled = false;
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f);
			}
			if (m_isStateToggled)
			{
				m_hammerCurrentRot = Hammer_Rot_Halfcocked;
			}
			else
			{
				m_hammerCurrentRot = (m_hasTriggerCycled ? (m_isHammerLocked ? Mathf.Lerp(m_hammerCurrentRot, Hammer_Rot_Cocked, Time.deltaTime * 10f) : Hammer_Rot_Uncocked) : (m_isHammerLocked ? Mathf.Lerp(m_hammerCurrentRot, Hammer_Rot_Cocked, Time.deltaTime * 10f) : Mathf.Lerp(Hammer_Rot_Uncocked, Hammer_Rot_Cocked, GetCamTrigger())));
			}
			if ((Object)(object)Hammer != (Object)null)
			{
				Hammer.localEulerAngles = AxisVector(HammerAxis, (!InvertHammerRot) ? m_hammerCurrentRot : (0f - m_hammerCurrentRot));
			}
			if ((Object)(object)LoadingGate != (Object)null)
			{
				float num = ((!m_isStateToggled) ? LoadingGate_Rot_Closed : LoadingGate_Rot_Open);
				if (InvertLoadingGateRot)
				{
					num = 0f - num;
				}
				LoadingGate.localEulerAngles = AxisVector(LoadingGateAxis, num);
			}
		}

		private float GetCamTrigger()
		{
			return Mathf.Clamp01((m_curTriggerFloat - m_camFloor) / Mathf.Max(1f - m_camFloor, 0.05f));
		}

		private void UpdateCylinderRelease()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			if (m_isHammerLocked)
			{
				m_tarChamberLerp = 1f;
			}
			else if (!m_hasTriggerCycled)
			{
				m_tarChamberLerp = GetCamTrigger() * 1.4f;
			}
			m_curChamberLerp = Mathf.Lerp(m_curChamberLerp, m_tarChamberLerp, Time.deltaTime * 16f);
			int chamberIndex = (CurChamber + 1) % Cylinder.NumChambers;
			((Component)Cylinder).transform.localRotation = Quaternion.Slerp(GetCylinderRotation(CurChamber), GetCylinderRotation(chamberIndex), m_curChamberLerp);
		}

		private void AdvanceCylinder()
		{
			CurChamber++;
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
		}

		public void EjectPrevCylinder()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if (m_isStateToggled)
			{
				int num = PrevChamber;
				if (IsAccessTwoChambersBack)
				{
					num = PrevChamber2;
				}
				FVRFireArmChamber val = Cylinder.Chambers[num];
				if (val.IsFull)
				{
					((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f);
				}
				val.EjectRound(((Component)val).transform.position + ((Component)val).transform.forward * ejectedRoundOffset, -((Component)val).transform.forward, Vector3.zero, false);
			}
		}

		private void Fire()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
			if (Cylinder.Chambers[CurChamber].Fire())
			{
				FVRFireArmChamber val = Cylinder.Chambers[CurChamber];
				((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
				((FVRFireArm)this).FireMuzzleSmoke();
				FVRFireArmRound round = val.GetRound();
				if (round.IsHighPressure)
				{
					((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f);
				}
				((FVRFireArm)this).PlayAudioGunShot(round, GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
				if (round.IsCaseless)
				{
					val.SetRound((FVRFireArmRound)null, false);
				}
				else if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo)
				{
					val.IsSpent = false;
					val.UpdateProxyDisplay();
				}
			}
		}

		private void UpdateCylinderRot()
		{
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			if (m_isStateToggled)
			{
				int num = PrevChamber;
				if (IsAccessTwoChambersBack)
				{
					num = PrevChamber2;
				}
				for (int i = 0; i < Cylinder.Chambers.Length; i++)
				{
					Cylinder.Chambers[i].IsAccessible = i == num;
				}
				int chamberIndex = (CurChamber + 1) % Cylinder.NumChambers;
				float num2 = (m_tarChamberLerp = (m_curChamberLerp = ((!doesToggleStateHalfRotatesCylinder) ? 0f : 0.5f)));
				((Component)Cylinder).transform.localRotation = ((!(num2 > 0f)) ? GetCylinderRotation(CurChamber) : Quaternion.Slerp(GetCylinderRotation(CurChamber), GetCylinderRotation(chamberIndex), num2));
			}
			else
			{
				for (int j = 0; j < Cylinder.Chambers.Length; j++)
				{
					Cylinder.Chambers[j].IsAccessible = false;
				}
				UpdateCylinderRelease();
			}
		}

		private void UpdateSpinning()
		{
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0062: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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)
			if (!((FVRInteractiveObject)this).IsHeld || ((FVRPhysicalObject)this).IsAltHeld || (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null)
			{
				m_isSpinning = false;
			}
			if (m_isSpinning)
			{
				Vector3 val = Vector3.zero;
				if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
				{
					val = ((FVRInteractiveObject)this).m_hand.Input.VelLinearLocal;
				}
				float num = Mathf.Clamp(Vector3.Dot(((Vector3)(ref val)).normalized, ((Component)this).transform.up), 0f - ((Vector3)(ref val)).magnitude, ((Vector3)(ref val)).magnitude);
				if (Mathf.Abs(xSpinVel) < 90f)
				{
					xSpinVel += num * Time.deltaTime * 600f;
				}
				else if (Mathf.Sign(num) == Mathf.Sign(xSpinVel))
				{
					xSpinVel += num * Time.deltaTime * 600f;
				}
				if (Mathf.Abs(xSpinVel) < 90f)
				{
					if (Vector3.Dot(((Component)this).transform.up, Vector3.down) >= 0f && Mathf.Sign(xSpinVel) == 1f)
					{
						xSpinVel += Time.deltaTime * 50f;
					}
					if (Vector3.Dot(((Component)this).transform.up, Vector3.down) < 0f && Mathf.Sign(xSpinVel) == -1f)
					{
						xSpinVel -= Time.deltaTime * 50f;
					}
				}
				xSpinVel = Mathf.Clamp(xSpinVel, -500f, 500f);
				xSpinRot += xSpinVel * Time.deltaTime * 5f;
				PoseSpinHolder.localEulerAngles = AxisVector(SpinAxis, (!InvertSpinRot) ? xSpinRot : (0f - xSpinRot));
				xSpinVel = Mathf.Lerp(xSpinVel, 0f, Time.deltaTime * 0.6f);
			}
			else
			{
				xSpinRot = 0f;
				xSpinVel = 0f;
				PoseSpinHolder.localRotation = Quaternion.RotateTowards(PoseSpinHolder.localRotation, Quaternion.identity, Time.deltaTime * 500f);
				PoseSpinHolder.localEulerAngles = AxisVector(SpinAxis, AxisValue(PoseSpinHolder.localEulerAngles, SpinAxis));
			}
		}

		private void CockHammer(float speed)
		{
			if (!m_isHammerLocked && !m_isStateToggled)
			{
				m_isHammerLocked = true;
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
			}
		}

		private void ToggleState()
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			m_isHammerLocked = false;
			m_isStateToggled = !m_isStateToggled;
			if (((FVRPhysicalObject)this).IsAltHeld)
			{
				return;
			}
			if (!m_isStateToggled)
			{
				((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition;
				((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation;
				if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null)
				{
					((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition;
					((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation;
				}
			}
			else
			{
				((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition;
				((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation;
				if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null)
				{
					((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition;
					((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation;
				}
			}
		}

		public override List<FireArmRoundClass> GetChamberRoundList()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			List<FireArmRoundClass> list = new List<FireArmRoundClass>();
			for (int i = 0; i < Cylinder.Chambers.Length; i++)
			{
				if (Cylinder.Chambers[i].IsFull)
				{
					list.Add(Cylinder.Chambers[i].GetRound().RoundClass);
					flag = true;
				}
			}
			return (!flag) ? null : list;
		}

		public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (rounds.Count <= 0)
			{
				return;
			}
			for (int i = 0; i < Cylinder.Chambers.Length; i++)
			{
				if (i < rounds.Count)
				{
					Cylinder.Chambers[i].Autochamber(rounds[i]);
				}
			}
		}
	}
}
public class FireLightFlicker : MonoBehaviour
{
	public Light Light;

	public float BaseIntensity = 1f;

	public float FlickerMin = 1f;

	public float FlickerMax = 1f;

	public float FlickerSpeed = 1f;

	private float noiseOffset;

	private void Awake()
	{
		if ((Object)(object)Light == (Object)null)
		{
			Light = ((Component)this).GetComponent<Light>();
		}
		noiseOffset = Random.value * 1000f;
	}

	private void Update()
	{
		if (!((Object)(object)Light == (Object)null))
		{
			float num = Mathf.PerlinNoise(Time.time * FlickerSpeed + noiseOffset, 0f);
			Light.intensity = BaseIntensity * Mathf.Lerp(FlickerMin, FlickerMax, num);
		}
	}
}
public class GunStockLace : MonoBehaviour
{
	public float length = 0.5f;

	public float gravity = 9.81f;

	public float damping = 0.05f;

	public float maxDeviationAngle = 45f;

	public LayerMask collisionMask;

	public bool showGizmos = false;

	private Vector3 pendulumDirection;

	private Vector3 angularVelocity;

	private Quaternion baseRotation;

	private Vector3 restDirection;

	private Vector3 previousPosition;

	private void Start()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//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)
		//IL_0023: 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)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: 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)
		baseRotation = ((Component)this).transform.rotation;
		restDirection = baseRotation * -Vector3.up;
		pendulumDirection = restDirection;
		previousPosition = ((Component)this).transform.position;
	}

	private void FixedUpdate()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//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)
		//IL_0017: 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_0024: 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_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: 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_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: 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_00b6: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: 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_00d0: 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_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: 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)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: 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)
		Vector3 val = ((Component)this).transform.position - previousPosition;
		previousPosition = ((Component)this).transform.position;
		float fixedDeltaTime = Time.fixedDeltaTime;
		Vector3 val2 = Vector3.Cross(((Vector3)(ref pendulumDirection)).normalized, Vector3.down) * gravity / length;
		Vector3 val3 = val * 10f / fixedDeltaTime;
		angularVelocity += (val2 + val3) * fixedDeltaTime;
		angularVelocity *= Mathf.Clamp01(1f - damping * fixedDeltaTime);
		Quaternion val4 = Quaternion.Euler(angularVelocity * fixedDeltaTime * 57.29578f);
		pendulumDirection = val4 * pendulumDirection;
		HandleCollisionLimits();
		ClampToMaxAngle();
		((Component)this).transform.rotation = Quaternion.FromToRotation(-Vector3.up, pendulumDirection) * baseRotation;
	}

	private void HandleCollisionLimits()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: 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_0053: 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_0062: 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_007c: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit val = default(RaycastHit);
		if (Physics.Raycast(((Component)this).transform.position, pendulumDirection, ref val, length, LayerMask.op_Implicit(collisionMask)))
		{
			Vector3 normal = ((RaycastHit)(ref val)).normal;
			Vector3 val2 = Vector3.ProjectOnPlane(pendulumDirection, normal);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Angle(pendulumDirection, normalized);
			pendulumDirection = Vector3.RotateTowards(pendulumDirection, normalized, num * ((float)Math.PI / 180f), 0f);
			angularVelocity = Vector3.ProjectOnPlane(angularVelocity, normal);
		}
	}

	private void ClampToMaxAngle()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: 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_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		float num = Vector3.Angle(restDirection, pendulumDirection);
		if (num > maxDeviationAngle)
		{
			pendulumDirection = Vector3.RotateTowards(restDirection, pendulumDirection, maxDeviationAngle * ((float)Math.PI / 180f), 0f);
			angularVelocity *= 0.5f;
		}
	}

	private void OnDrawGizmos()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: 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_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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		if (showGizmos)
		{
			Gizmos.color = Color.yellow;
			Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + pendulumDirection * length);
			Gizmos.color = Color.red;
			Gizmos.DrawWireSphere(((Component)this).transform.position + pendulumDirection * length, 0.02f);
		}
	}
}
public class HuntDollarSR : MonoBehaviour
{
	private IEnumerator Start()
	{
		yield return (object)new WaitForSeconds(3f);
		string str = "CharcoalBriquette(Clone)";
		((Object)((Component)this).gameObject).name = str;
		Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Component val = (Component)(object)componentsInChildren[i];
			((Object)val.gameObject).name = str;
		}
	}
}
public class ParticleAffectorCoordinator : MonoBehaviour
{
	[Serializable]
	public struct BeamConfig
	{
		public Transform SourceTransform;

		public Vector3 SourceOffset;

		public Transform DestTransform;

		public Vector3 DestOffset;

		public bool HasLine;
	}

	[Serializable]
	public struct LocationOffsetEntry
	{
		public Vector3 Direction;

		public float ScaleMin;

		public float ScaleMax;
	}

	[Serializable]
	public struct VelocityExtraEntry
	{
		public Vector3 Direction;

		public float ConeAngleDeg;

		public float SpeedMin;

		public float SpeedMax;
	}

	[Serializable]
	public struct GravityEntry
	{
		public bool UseAxis;

		public float Accel;

		public float Decay;

		public Vector3 Axis;

		public Transform Target;
	}

	[Serializable]
	public struct VortexEntry
	{
		public float Speed;

		public float Decay;

		public Vector3 Axis;

		public Transform Target;

		public float Drag;
	}

	public ParticleSystem Ps;

	public bool HasBeam;

	public BeamConfig Beam;

	public LocationOffsetEntry[] LocationOffsets;

	public string[] LocationOffsetScaleCurveKeysStrs;

	[NonSerialized]
	private AnimationCurve[] _locationOffsetScaleCurves;

	public VelocityExtraEntry[] VelocityExtras;

	public GravityEntry[] GravityEntries;

	public VortexEntry[] VortexEntries;

	public bool HasGravityDrag;

	public float GravityDrag;

	public bool HasDragCurve;

	public AnimationCurve DragCurve;

	public Vector3 DragWind;

	public float MaxCameraDistance;

	[NonSerialized]
	private ParticleSystemRenderer _cullRenderer;

	public bool HasMoveRelativeToEmitter;

	public Transform MoveRelEmitter;

	public float MoveRelPositionInherit;

	public float MoveRelVelocityInherit;

	public bool HasAlignRotation;

	public Transform AlignParentTransform;

	public Vector3 AlignAxisLocal;

	[NonSerialized]
	private Vector3 _alignTargetWorldDir;

	public Quaternion ShapeAimRotation = Quaternion.identity;

	[NonSerialized]
	private Quaternion _inverseShapeAim = Quaternion.identity;

	private Particle[] buffer;

	private Vector3 beamSourceWorld;

	private Vector3 beamDestWorld;

	private Vector3 lastEmitterPos;

	private Quaternion lastEmitterRot;

	private HashSet<uint> lastFrameSeeds = new HashSet<uint>();

	private HashSet<uint> currentFrameSeeds = new HashSet<uint>();

	private static Camera s_viewerCamera;

	private void Awake()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: 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_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_0114: 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_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: 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_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_028c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: 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_029a: 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_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: 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_0169: 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_0175: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Ps == (Object)null)
		{
			Ps = ((Component)this).GetComponent<ParticleSystem>();
		}
		Quaternion val = ShapeAimRotation;
		if (val.x == 0f && val.y == 0f && val.z == 0f && val.w == 0f)
		{
			val = Quaternion.identity;
		}
		_inverseShapeAim = Quaternion.Inverse(val);
		if (LocationOffsetScaleCurveKeysStrs != null && LocationOffsetScaleCurveKeysStrs.Length > 0)
		{
			_locationOffsetScaleCurves = (AnimationCurve[])(object)new AnimationCurve[LocationOffsetScaleCurveKeysStrs.Length];
			for (int i = 0; i < LocationOffsetScaleCurveKeysStrs.Length; i++)
			{
				_locationOffsetScaleCurves[i] = ParseScaleCurveKeysStr(LocationOffsetScaleCurveKeysStrs[i]);
			}
		}
		if (HasBeam)
		{
			Vector3 val2 = ((!((Object)(object)Beam.SourceTransform != (Object)null)) ? ((Component)this).transform.position : Beam.SourceTransform.position);
			Vector3 val3 = ((!((Object)(object)Beam.DestTransform != (Object)null)) ? ((Component)this).transform.position : Beam.DestTransform.position);
			beamSourceWorld = val2 + Beam.SourceOffset;
			beamDestWorld = val3 + Beam.DestOffset;
			if (Beam.HasLine)
			{
				LineRenderer val4 = ((Component)this).GetComponent<LineRenderer>();
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = ((Component)this).gameObject.AddComponent<LineRenderer>();
				}
				ParticleSystemRenderer component = ((Component)this).GetComponent<ParticleSystemRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)val4).material = ((Renderer)component).sharedMaterial;
				}
				val4.useWorldSpace = true;
				val4.positionCount = 2;
				val4.SetPosition(0, beamSourceWorld);
				val4.SetPosition(1, beamDestWorld);
			}
		}
		if (HasMoveRelativeToEmitter)
		{
			if ((Object)(object)MoveRelEmitter == (Object)null)
			{
				MoveRelEmitter = ((Component)this).transform;
			}
			lastEmitterPos = MoveRelEmitter.position;
			lastEmitterRot = MoveRelEmitter.rotation;
		}
		if (HasAlignRotation)
		{
			Quaternion val5 = ((!((Object)(object)AlignParentTransform != (Object)null)) ? Quaternion.identity : AlignParentTransform.rotation);
			Vector3 val6 = val5 * AlignAxisLocal;
			_alignTargetWorldDir = ((Vector3)(ref val6)).normalized;
		}
	}

	private void LateUpdate()
	{
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a32: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a34: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a40: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a45: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: 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_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_0376: Unknown result type (might be due to invalid IL or missing references)
		//IL_037b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0524: Unknown result type (might be due to invalid IL or missing references)
		//IL_0526: Unknown result type (might be due to invalid IL or missing references)
		//IL_052a: Unknown result type (might be due to invalid IL or missing references)
		//IL_052f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0534: Unknown result type (might be due to invalid IL or missing references)
		//IL_059a: Unknown result type (might be due to invalid IL or missing references)
		//IL_058a: Unknown result type (might be due to invalid IL or missing references)
		//IL_06be: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_09a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_09bb: 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_07d0: 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_0756: Unknown result type (might be due to invalid IL or missing references)
		//IL_0759: 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_0760: Unknown result type (might be due to invalid IL or missing references)
		//IL_0776: Unknown result type (might be due to invalid IL or missing references)
		//IL_077b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0780: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05be: Unknown result type (might be due to invalid IL or missing references)
		//IL_0455: Unknown result type (might be due to invalid IL or missing references)
		//IL_0457: Unknown result type (might be due to invalid IL or missing references)
		//IL_0466: Unknown result type (might be due to invalid IL or missing references)
		//IL_046b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0472: Unknown result type (might be due to invalid IL or missing references)
		//IL_0477: Unknown result type (might be due to invalid IL or missing references)
		//IL_047c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0921: Unknown result type (might be due to invalid IL or missing references)
		//IL_0923: Unknown result type (might be due to invalid IL or missing references)
		//IL_0926: Unknown result type (might be due to invalid IL or missing references)
		//IL_092b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0930: Unknown result type (might be due to invalid IL or missing references)
		//IL_0935: Unknown result type (might be due to invalid IL or missing references)
		//IL_0937: Unknown result type (might be due to invalid IL or missing references)
		//IL_093c: Unknown result type (might be due to invalid IL or missing references)
		//IL_093e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0940: Unknown result type (might be due to invalid IL or missing references)
		//IL_0948: Unknown result type (might be due to invalid IL or missing references)
		//IL_094d: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d8: 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_0963: Unknown result type (might be due to invalid IL or missing references)
		//IL_0965: Unknown result type (might be due to invalid IL or missing references)
		//IL_096a: Unknown result type (might be due to invalid IL or missing references)
		//IL_096c: Unknown result type (might be due to invalid IL or missing references)
		//IL_096e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0976: Unknown result type (might be due to invalid IL or missing references)
		//IL_097b: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0803: Unknown result type (might be due to invalid IL or missing references)
		//IL_0805: Unknown result type (might be due to invalid IL or missing references)
		//IL_0807: Unknown result type (might be due to invalid IL or missing references)
		//IL_0809: 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_064b: Unknown result type (might be due to invalid IL or missing references)
		//IL_064d: Unknown result type (might be due to invalid IL or missing references)
		//IL_064f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0654: Unknown result type (might be due to invalid IL or missing references)
		//IL_0619: Unknown result type (might be due to invalid IL or missing references)
		//IL_061b: Unknown result type (might be due to invalid IL or missing references)
		//IL_061d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0622: Unknown result type (might be due to invalid IL or missing references)
		//IL_0624: Unknown result type (might be due to invalid IL or missing references)
		//IL_0626: Unknown result type (might be due to invalid IL or missing references)
		//IL_0628: Unknown result type (might be due to invalid IL or missing references)
		//IL_062a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0631: Unknown result type (might be due to invalid IL or missing references)
		//IL_0636: Unknown result type (might be due to invalid IL or missing references)
		//IL_063b: Unknown result type (might be due to invalid IL or missing references)
		//IL_063d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0642: Unknown result type (might be due to invalid IL or missing references)
		//IL_0842: Unknown result type (might be due to invalid IL or missing references)
		//IL_0844: Unknown result type (might be due to invalid IL or missing references)
		//IL_0846: Unknown result type (might be due to invalid IL or missing references)
		//IL_084b: Unknown result type (might be due to invalid IL or missing references)
		//IL_084d: Unknown result type (might be due to invalid IL or missing references)
		//IL_084f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0851: Unknown result type (might be due to invalid IL or missing references)
		//IL_0853: Unknown result type (might be due to invalid IL or missing references)
		//IL_085a: Unknown result type (might be due to invalid IL or missing references)
		//IL_085f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0864: Unknown result type (might be due to invalid IL or missing references)
		//IL_0866: Unknown result type (might be due to invalid IL or missing references)
		//IL_086b: Unknown result type (might be due to invalid IL or missing references)
		//IL_089a: Unknown result type (might be due to invalid IL or missing references)
		//IL_089f: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_08af: Unknown result type (might be due to invalid IL or missing references)
		//IL_08b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_08b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_08b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_08cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_08d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0682: Unknown result type (might be due to invalid IL or missing references)
		//IL_0686: Unknown result type (might be due to invalid IL or missing references)
		//IL_0690: Unknown result type (might be due to invalid IL or missing references)
		//IL_0695: 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)
		if ((Object)(object)Ps == (Object)null)
		{
			return;
		}
		bool flag = GravityEntries != null && GravityEntries.Length > 0;
		bool flag2 = VortexEntries != null && VortexEntries.Length > 0;
		bool flag3 = LocationOffsets != null && LocationOffsets.Length > 0;
		bool flag4 = VelocityExtras != null && VelocityExtras.Length > 0;
		if (MaxCameraDistance > 0f)
		{
			UpdateDistanceCull();
		}
		if (!HasBeam && !flag3 && !flag4 && !flag && !flag2 && !HasMoveRelativeToEmitter && !HasAlignRotation && !HasDragCurve)
		{
			return;
		}
		float num = Mathf.Max(Time.deltaTime, 0.0001f);
		Vector3 val = Vector3.zero;
		Quaternion val2 = Quaternion.identity;
		if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null)
		{
			val = MoveRelEmitter.position;
			val2 = MoveRelEmitter.rotation * Quaternion.Inverse(lastEmitterRot);
		}
		int particleCount = Ps.particleCount;
		if (particleCount > 0)
		{
			if (buffer == null || buffer.Length < particleCount)
			{
				buffer = (Particle[])(object)new Particle[Mathf.Max(particleCount, 64)];
			}
			int particles = Ps.GetParticles(buffer);
			Quaternion val3 = ((Component)this).transform.rotation * _inverseShapeAim;
			Vector3 val4 = ((!HasBeam) ? Vector3.zero : (beamDestWorld - beamSourceWorld));
			bool flag5 = false;
			float rotation = 0f;
			Camera val5 = ((!HasAlignRotation) ? null : ResolveViewerCamera());
			if ((Object)(object)val5 != (Object)null)
			{
				Transform transform = ((Component)val5).transform;
				Vector3 val6 = _alignTargetWorldDir - Vector3.Dot(_alignTargetWorldDir, transform.forward) * transform.forward;
				if (((Vector3)(ref val6)).sqrMagnitude > 1E-06f)
				{
					float num2 = Vector3.Angle(transform.up, val6);
					float num3 = Mathf.Sign(Vector3.Dot(transform.forward, Vector3.Cross(transform.up, val6)));
					rotation = num2 * num3;
					flag5 = true;
				}
			}
			currentFrameSeeds.Clear();
			for (int i = 0; i < particles; i++)
			{
				currentFrameSeeds.Add(((Particle)(ref buffer[i])).randomSeed);
			}
			int num4 = 0;
			if (HasBeam)
			{
				for (int j = 0; j < particles; j++)
				{
					if (!lastFrameSeeds.Contains(((Particle)(ref buffer[j])).randomSeed))
					{
						num4++;
					}
				}
			}
			int num5 = 0;
			for (int k = 0; k < particles; k++)
			{
				bool flag6 = !lastFrameSeeds.Contains(((Particle)(ref buffer[k])).randomSeed);
				Vector3 val7 = ((Particle)(ref buffer[k])).position;
				Vector3 val8 = ((Particle)(ref buffer[k])).velocity;
				if (HasBeam && flag6)
				{
					float num6 = ((num4 <= 1) ? 0.5f : ((float)num5 / (float)(num4 - 1)));
					val7 = beamSourceWorld + val4 * num6;
					num5++;
				}
				if (flag3 && flag6)
				{
					float value = Random.value;
					for (int l = 0; l < LocationOffsets.Length; l++)
					{
						AnimationCurve val9 = ((_locationOffsetScaleCurves == null || l >= _locationOffsetScaleCurves.Length) ? null : _locationOffsetScaleCurves[l]);
						float num7 = ((val9 == null) ? Mathf.Lerp(LocationOffsets[l].ScaleMin, LocationOffsets[l].ScaleMax, value) : val9.Evaluate(value));
						val7 += val3 * LocationOffsets[l].Direction * num7;
					}
				}
				if (flag4 && flag6)
				{
					for (int m = 0; m < VelocityExtras.Length; m++)
					{
						float value2 = Random.value;
						float value3 = Random.value;
						float value4 = Random.value;
						Vector3 val10 = val3 * RandomDirectionInCone(VelocityExtras[m].Direction, VelocityExtras[m].ConeAngleDeg, value2, value3);
						float num8 = Mathf.Lerp(VelocityExtras[m].SpeedMin, VelocityExtras[m].SpeedMax, value4);
						val8 += val10 * num8;
					}
				}
				if (flag)
				{
					for (int n = 0; n < GravityEntries.Length; n++)
					{
						GravityEntry gravityEntry = GravityEntries[n];
						Vector3 val11 = ((!((Object)(object)gravityEntry.Target != (Object)null)) ? ((Component)this).transform.position : gravityEntry.Target.position);
						Vector3 val12 = ((!(((Vector3)(ref gravityEntry.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref gravityEntry.Axis)).normalized);
						Vector3 val13 = val3 * val12;
						float num9 = ((!(gravityEntry.Decay > 0f)) ? 0f : (1f / (gravityEntry.Decay * gravityEntry.Decay)));
						Vector3 val15;
						if (gravityEntry.UseAxis)
						{
							Vector3 val14 = val7 - val11;
							val15 = val11 + val13 * Vector3.Dot(val13, val14) - val7;
						}
						else
						{
							val15 = val11 - val7;
						}
						float sqrMagnitude = ((Vector3)(ref val15)).sqrMagnitude;
						if (sqrMagnitude > 1E-08f)
						{
							float num10 = gravityEntry.Accel / (1f + num9 * sqrMagnitude);
							val8 += ((Vector3)(ref val15)).normalized * (num10 * num);
						}
					}
					if (HasGravityDrag)
					{
						val8 -= val8 * (GravityDrag * num);
					}
				}
				if (HasDragCurve && DragCurve != null)
				{
					float startLifetime = ((Particle)(ref buffer[k])).startLifetime;
					float num11 = ((!(startLifetime > 0f)) ? 0f : Mathf.Clamp01(1f - ((Particle)(ref buffer[k])).remainingLifetime / startLifetime));
					float num12 = DragCurve.Evaluate(num11);
					if (num12 > 0f)
					{
						val8 += (DragWind - val8) * (1f - Mathf.Exp((0f - num12) * num));
					}
				}
				if (flag2)
				{
					for (int num13 = 0; num13 < VortexEntries.Length; num13++)
					{
						VortexEntry vortexEntry = VortexEntries[num13];
						Vector3 val16 = ((!((Object)(object)vortexEntry.Target != (Object)null)) ? ((Component)this).transform.position : vortexEntry.Target.position);
						Vector3 val17 = ((!(((Vector3)(ref vortexEntry.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref vortexEntry.Axis)).normalized);
						Vector3 val18 = val3 * val17;
						float num14 = ((!(vortexEntry.Decay > 0f)) ? 0f : (1f / (vortexEntry.Decay * vortexEntry.Decay)));
						Vector3 val19 = val7 - val16;
						Vector3 val20 = val16 + val18 * Vector3.Dot(val18, val19) - val7;
						float sqrMagnitude2 = ((Vector3)(ref val20)).sqrMagnitude;
						if (sqrMagnitude2 > 1E-08f)
						{
							float num15 = vortexEntry.Speed / (1f + num14 * sqrMagnitude2);
							Vector3 val21 = Vector3.Cross(((Vector3)(ref val20)).normalized, val18) * num15;
							val8 += (val21 - val8) * vortexEntry.Drag * num;
						}
					}
				}
				if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null && !flag6)
				{
					if (MoveRelPositionInherit > 0f)
					{
						Vector3 val22 = val2 * (val7 - lastEmitterPos) + val;
						val7 = Vector3.Lerp(val7, val22, MoveRelPositionInherit);
					}
					if (MoveRelVelocityInherit > 0f)
					{
						Vector3 val23 = val2 * val8;
						val8 = Vector3.Lerp(val8, val23, MoveRelVelocityInherit);
					}
				}
				if (flag5)
				{
					((Particle)(ref buffer[k])).rotation = rotation;
				}
				((Particle)(ref buffer[k])).position = val7;
				((Particle)(ref buffer[k])).velocity = val8;
			}
			Ps.SetParticles(buffer, particles);
			HashSet<uint> hashSet = lastFrameSeeds;
			lastFrameSeeds = currentFrameSeeds;
			currentFrameSeeds = hashSet;
		}
		else
		{
			lastFrameSeeds.Clear();
		}
		if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null)
		{
			lastEmitterPos = val;
			lastEmitterRot = MoveRelEmitter.rotation;
		}
	}

	private void UpdateDistanceCull()
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: 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)
		if ((Object)(object)_cullRenderer == (Object)null)
		{
			_cullRenderer = ((Component)this).GetComponent<ParticleSystemRenderer>();
		}
		if (!((Object)(object)_cullRenderer == (Object)null))
		{
			Camera val = ResolveViewerCamera();
			if (!((Object)(object)val == (Object)null))
			{
				Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position;
				float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
				((Renderer)_cullRenderer).enabled = sqrMagnitude <= MaxCameraDistance * MaxCameraDistance;
			}
		}
	}

	private static Camera ResolveViewerCamera()
	{
		if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled)
		{
			return s_viewerCamera;
		}
		s_viewerCamera = Camera.main;
		if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled)
		{
			return s_viewerCamera;
		}
		s_viewerCamera = Camera.current;
		if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled)
		{
			return s_viewerCamera;
		}
		Camera[] allCameras = Camera.allCameras;
		s_viewerCamera = ((allCameras == null || allCameras.Length <= 0) ? null : allCameras[0]);
		return s_viewerCamera;
	}

	private static AnimationCurve ParseScaleCurveKeysStr(string keysStr)
	{
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Expected O, but got Unknown
		if (string.IsNullOrEmpty(keysStr))
		{
			return null;
		}
		string[] array = keysStr.Split(new char[1] { ';' });
		Keyframe[] array2 = (Keyframe[])(object)new Keyframe[array.Length];
		for (int i = 0; i < array.Length; i++)
		{
			string[] array3 = array[i].Split(new char[1] { ',' });
			float num = float.Parse(array3[0], CultureInfo.InvariantCulture);
			float num2 = float.Parse(array3[1], CultureInfo.InvariantCulture);
			ref Keyframe reference = ref array2[i];
			reference = new Keyframe(num, num2, 0f, 0f);
		}
		return new AnimationCurve(array2);
	}

	private static Vector3 RandomDirectionInCone(Vector3 axis, float halfAngleDeg, float u1, float u2)
	{
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: 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)
		//IL_00d4: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		if (halfAngleDeg >= 179.9f || ((Vector3)(ref axis)).sqrMagnitude < 1E-08f)
		{
			float num = 1f - 2f * u1;
			float num2 = Mathf.Sqrt(Mathf.Max(0f, 1f - num * num));
			float num3 = u2 * 2f * (float)Math.PI;
			return new Vector3(num2 * Mathf.Cos(num3), num2 * Mathf.Sin(num3), num);
		}
		float num4 = halfAngleDeg * ((float)Math.PI / 180f);
		float num5 = Mathf.Lerp(Mathf.Cos(num4), 1f, u1);
		float num6 = Mathf.Sqrt(Mathf.Max(0f, 1f - num5 * num5));
		float num7 = u2 * 2f * (float)Math.PI;
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(num6 * Mathf.Cos(num7), num6 * Mathf.Sin(num7), num5);
		Quaternion val2 = Quaternion.FromToRotation(Vector3.forward, ((Vector3)(ref axis)).normalized);
		return val2 * val;
	}
}
public class PlayRandomSoundOnSpawn : MonoBehaviour
{
	public AudioClip[] spawnSounds;

	public float volume = 1f;

	[Header("Pitch Settings")]
	public float minPitch = 0.9f;

	public float maxPitch = 1.1f;

	private AudioSource audioSource;

	private void Start()
	{
		if (spawnSounds.Length > 0)
		{
			audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
			audioSource.playOnAwake = false;
			audioSource.spatialBlend = 1f;
			audioSource.volume = volume;
			AudioClip val = spawnSounds[Random.Range(0, spawnSounds.Length)];
			audioSource.pitch = Random.Range(minPitch, maxPitch);
			audioSource.PlayOneShot(val);
		}
	}
}
public class RandomSpinOnSpawn : MonoBehaviour
{
	public float spinForce = 0.5f;

	public Vector3 torqueAxis = new Vector3(1f, 0f, 0f);

	private Rigidbody rb;

	private void Start()
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		rb = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)rb != (Object)null)
		{
			((Component)this).transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
			rb.AddTorque(((Vector3)(ref torqueAxis)).normalized * spinForce, (ForceMode)1);
		}
	}
}
namespace BitWizrd.Scope
{
	[RequireComponent(typeof(FVRFireArm))]
	public class ScopeEyeRelief : MonoBehaviour
	{
		private enum SightState
		{
			OnScope,
			Outside,
			Unavailable
		}

		[Header("References (auto-detected if null)")]
		public FVRFireArm Firearm;

		public PIPScope Scope;

		[Tooltip("Optional. Used for the flip-cap state and external-zero rigs.")]
		p