Decompiled source of HuntFirstAid v1.0.8

HuntFirstAid.dll

Decompiled 2 weeks 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.Configuration;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;
using UnityEngine.UI;

[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]
[BepInPlugin("MeatKit", "MeatKit Plugin", "1.0.0")]
[BepInProcess("h3vr.exe")]
public class MeatKitPlugin : 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()
	{
	}
}
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;

	private static readonly Dictionary<Transform, Dictionary<int, float>> groupRolls = new Dictionary<Transform, Dictionary<int, float>>();

	private void Awake()
	{
		if (Probability >= 1f)
		{
			return;
		}
		bool flag;
		if (Group != 0)
		{
			Transform root = ((Component)this).transform.root;
			if (!groupRolls.TryGetValue(root, out var value))
			{
				value = new Dictionary<int, float>();
				groupRolls[root] = value;
			}
			if (!value.TryGetValue(Group, out var value2))
			{
				value2 = Random.value;
				value[Group] = value2;
			}
			flag = value2 >= SelectionStart && value2 <= SelectionStart + Probability;
		}
		else
		{
			flag = Random.value <= Probability;
		}
		if (!flag)
		{
			((Component)this).gameObject.SetActive(false);
		}
	}
}
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);
	}
}
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();
		}
	}
}
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);
		}
	}
}
namespace BitWizrd.HuntFirstAid
{
	public class HealingSoundManager : MonoBehaviour
	{
		public static HealingSoundManager Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public static void PlayHealingSound(AudioEvent defaultSound, AudioEvent maleSound, AudioEvent femaleSound, Vector3 position)
		{
			//IL_00da: 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)
			if (HuntFirstAidPlugin.HealingSoundType == "Mute")
			{
				return;
			}
			AudioEvent val = maleSound;
			val = (AudioEvent)(HuntFirstAidPlugin.HealingSoundType switch
			{
				"Male" => maleSound ?? defaultSound, 
				"Female" => femaleSound ?? maleSound ?? defaultSound, 
				"Ding" => defaultSound ?? maleSound, 
				_ => maleSound ?? defaultSound, 
			});
			if (val != null)
			{
				if ((Object)(object)Camera.main != (Object)null)
				{
					SM.PlayGenericSound(val, ((Component)Camera.main).transform.position);
				}
				else
				{
					SM.PlayGenericSound(val, position);
				}
			}
		}

		public static void PlayActionSound(AudioEvent sound, Vector3 position)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (sound != null)
			{
				SM.PlayGenericSound(sound, position);
			}
		}

		public static void PlayUIFeedbackSound(AudioEvent sound, Vector3 position)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (sound != null)
			{
				SM.PlayGenericSound(sound, position);
			}
		}
	}
}
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;
		}
	}
}
namespace BitWizrd.HuntFirstAid
{
	[BepInPlugin("BitWizrd.HuntFirstAid", "HuntFirstAid", "1.0.8")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class HuntFirstAidPlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		public static ConfigEntry<string> configHealingSoundType;

		public static ConfigEntry<bool> configSyringeNoHealingSound;

		public static ConfigEntry<bool> configSyringeDespawnAfterUse;

		public static ConfigEntry<bool> configFirstAidDespawnAfterUse;

		public static ConfigEntry<bool> configEnableHaptics;

		public static string HealingSoundType => (configHealingSoundType == null) ? "Male" : configHealingSoundType.Value;

		public static bool SyringeNoHealingSound => configSyringeNoHealingSound != null && configSyringeNoHealingSound.Value;

		public static bool SyringeDespawnAfterUse => configSyringeDespawnAfterUse == null || configSyringeDespawnAfterUse.Value;

		public static bool FirstAidDespawnAfterUse => configFirstAidDespawnAfterUse == null || configFirstAidDespawnAfterUse.Value;

		public static bool EnableHaptics => configEnableHaptics == null || configEnableHaptics.Value;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Loading Hunt First Aid Plugin");
			SetupConfiguration();
			LoadAssets();
		}

		private void SetupConfiguration()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			configHealingSoundType = ((BaseUnityPlugin)this).Config.Bind<string>("Sound Settings", "HealingSoundType", "Male", new ConfigDescription("Type of healing sound to play when using medical items", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[4] { "Male", "Female", "Ding", "Mute" }), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 10,
					Category = "Audio Settings"
				}
			}));
			configSyringeNoHealingSound = ((BaseUnityPlugin)this).Config.Bind<bool>("Syringe Settings", "SyringeNoHealingSound", false, new ConfigDescription("Disable healing sounds for regen-enabled syringes only (heal-over-time shots that should be silent). Disabled is accurate to Hunt: Showdown", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 20,
					Category = "Syringe Behavior"
				}
			}));
			configSyringeDespawnAfterUse = ((BaseUnityPlugin)this).Config.Bind<bool>("Syringe Settings", "SyringeDespawnAfterUse", true, new ConfigDescription("Whether syringes should automatically despawn after being used", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 21,
					Category = "Syringe Behavior"
				}
			}));
			configFirstAidDespawnAfterUse = ((BaseUnityPlugin)this).Config.Bind<bool>("First Aid Settings", "FirstAidDespawnAfterUse", true, new ConfigDescription("Whether first aid kits should automatically despawn when all charges are depleted", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 30,
					Category = "First Aid Behavior"
				}
			}));
			configEnableHaptics = ((BaseUnityPlugin)this).Config.Bind<bool>("General Settings", "EnableHaptics", true, new ConfigDescription("Enable haptic feedback (controller vibration) when using medical items", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 5,
					Category = "General Behavior"
				}
			}));
			Logger.LogInfo((object)"Hunt First Aid Plugin loaded successfully");
			Logger.LogInfo((object)"Configuration loaded - check F1 menu (ConfigurationManager) to modify settings");
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "BitWizrd.HuntFirstAid");
			OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntFirstAid", "", "huntfirstaid", "", "");
		}
	}
	internal sealed class ConfigurationManagerAttributes
	{
		public int? Order { get; set; }

		public string Category { get; set; }

		public string Description { get; set; }

		public bool? ReadOnly { get; set; }

		public bool? IsAdvanced { get; set; }
	}
	public class HuntFirstAidKit : FVRPhysicalObject
	{
		[Header("Basic Settings")]
		public bool DoesUseHandedPose = true;

		private bool m_isInRightHandMode = true;

		[Header("Audio Events")]
		public AudioEvent ActivationSound;

		public AudioEvent DeactivationSound;

		public AudioEvent BandagingSound;

		public AudioEvent DefaultHealingSound;

		public AudioEvent HealingSound;

		public AudioEvent FemaleHealingSound;

		public AudioEvent EmptyCharges;

		[Header("Healing Configuration")]
		public bool DestroyOnHeal;

		public float HealPercent = 33.33f;

		public float HealLimit = 100f;

		public float HealDuration = 2f;

		public bool HealOverTime = false;

		public float ManualHealingActivationTime = 2f;

		public int MaxCharges = 3;

		private int _remainingCharges;

		public bool DespawnAfterUse = false;

		[Header("State Variables")]
		private float _activationTimer;

		private bool _isTriggerHeld;

		private bool _isActivated;

		private bool _healingComplete;

		private bool _isOpeningAnimationComplete = false;

		private bool _openTriggered = false;

		private int _currentStage;

		[Header("Animation")]
		public float OpenAnimationLength = 1f;

		public float CloseAnimationLength = 1f;

		[Header("Physics")]
		public Animator animator;

		private Rigidbody medkitRigidbody;

		public float healingActivationVelocity = 0.1f;

		public float bandagingVelocityOffset = 0.02f;

		private float currentActivationVelocity;

		[Header("Internal State")]
		private bool _isHealingInProgress = false;

		private bool m_hasTriggeredUpSinceBeginHealthKit = false;

		[Header("Audio Management")]
		private FVRPooledAudioSource _currentBandagingSource;

		[Header("UI Elements")]
		public Image[] ChargeImages;

		public Image[] ChargeFillImages;

		public Image[] UsedChargeImages;

		public Canvas MedkitUICanvas;

		public CanvasGroup canvasGroup;

		public Image NoChargesImageFront;

		public Image NoChargesImageBack;

		[Header("UI Animation")]
		public float fadeDuration = 1f;

		private float fadeTime = 0f;

		private bool isFadingIn = false;

		private bool isFadingOut = false;

		[Header("Behavior")]
		public bool ToggleOpeningAnimation;

		private bool _isOpen;

		[Header("Despawn Settings")]
		public float DespawnDelaySeconds = 3f;

		public override void Start()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			((FVRInteractiveObject)this).Start();
			_remainingCharges = MaxCharges;
			_activationTimer = 0f;
			_healingComplete = false;
			_isOpeningAnimationComplete = false;
			_openTriggered = false;
			_isOpen = false;
			currentActivationVelocity = healingActivationVelocity;
			medkitRigidbody = ((Component)this).GetComponent<Rigidbody>();
			SetUIVisibility(visible: false);
			if (UsedChargeImages != null)
			{
				Image[] usedChargeImages = UsedChargeImages;
				foreach (Image val in usedChargeImages)
				{
					((Behaviour)val).enabled = false;
				}
			}
			UpdateUI();
			if ((Object)(object)HealingSoundManager.Instance == (Object)null)
			{
				GameObject val2 = new GameObject("HealingSoundManager");
				val2.AddComponent<HealingSoundManager>();
			}
			DespawnAfterUse = HuntFirstAidPlugin.FirstAidDespawnAfterUse;
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0009: 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_001a: Invalid comparison between Unknown and I4
			//IL_0036: 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_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_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			bool flag = (int)hand.CMode == 0 || (int)hand.CMode == 2;
			bool flag2 = hand.Input.TouchpadPressed && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f;
			bool flag3 = hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f;
			bool flag4 = !hand.IsInStreamlinedMode || flag;
			bool flag5 = ((!flag4) ? hand.Input.TriggerPressed : flag2);
			bool flag6 = ((!flag4) ? hand.Input.TriggerDown : flag3);
			if (!m_hasTriggeredUpSinceBeginHealthKit)
			{
				if (!flag5)
				{
					m_hasTriggeredUpSinceBeginHealthKit = true;
				}
			}
			else if (ToggleOpeningAnimation)
			{
				if (flag6)
				{
					if (!_isOpen)
					{
						OpenKit(hand);
					}
					else
					{
						CloseKit();
					}
				}
			}
			else if (flag5)
			{
				_isTriggerHeld = true;
				if (_healingComplete)
				{
					_healingComplete = false;
				}
				if (!_openTriggered)
				{
					OpenKit(hand);
				}
				AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f && !animator.IsInTransition(0) && !_isOpeningAnimationComplete)
				{
					_isOpeningAnimationComplete = true;
					_activationTimer = 0f;
				}
				if (_isOpeningAnimationComplete)
				{
					CheckVelocityAndProcessHealing();
				}
			}
			else
			{
				if (_isTriggerHeld)
				{
					CloseKit();
				}
				ResetAudioState();
			}
		}

		private void OpenKit(FVRViveHand hand)
		{
			//IL_001a: 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)
			if (_remainingCharges <= 0)
			{
				HealingSoundManager.PlayUIFeedbackSound(EmptyCharges, ((Component)this).transform.position);
				return;
			}
			if ((Object)(object)animator != (Object)null)
			{
				animator.speed = 1f / OpenAnimationLength;
				animator.SetTrigger("TriggerPulled");
			}
			HealingSoundManager.PlayUIFeedbackSound(ActivationSound, ((Component)this).transform.position);
			_openTriggered = true;
			SetUIVisibility(visible: true);
			_isOpen = true;
		}

		private void CloseKit()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)animator != (Object)null)
			{
				animator.speed = 1f / CloseAnimationLength;
				animator.SetTrigger("TriggerReleased");
			}
			HealingSoundManager.PlayUIFeedbackSound(DeactivationSound, ((Component)this).transform.position);
			_healingComplete = _remainingCharges == 0;
			_openTriggered = false;
			SetUIVisibility(visible: false);
			_isOpen = false;
		}

		private void CheckVelocityAndProcessHealing()
		{
			//IL_0018: 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)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			float num;
			if ((Object)(object)medkitRigidbody != (Object)null)
			{
				Vector3 velocity = medkitRigidbody.velocity;
				num = ((Vector3)(ref velocity)).magnitude;
			}
			else
			{
				num = 0f;
			}
			float num2 = num;
			if (GM.CurrentPlayerBody.GetPlayerHealth() >= HealLimit)
			{
				_activationTimer = 0f;
				return;
			}
			if (num2 >= healingActivationVelocity)
			{
				currentActivationVelocity = healingActivationVelocity - bandagingVelocityOffset;
			}
			if (num2 >= currentActivationVelocity)
			{
				_activationTimer += Time.deltaTime;
				if (_remainingCharges > 0 && !_isActivated)
				{
					if ((Object)(object)_currentBandagingSource == (Object)null || (Object)(object)_currentBandagingSource.Source == (Object)null || !_currentBandagingSource.Source.isPlaying)
					{
						_currentBandagingSource = SM.PlayCoreSound((FVRPooledAudioType)0, BandagingSound, ((Component)this).transform.position);
					}
					int num3 = MaxCharges - _remainingCharges;
					if (num3 >= 0 && num3 < ChargeFillImages.Length)
					{
						((Behaviour)ChargeFillImages[num3]).enabled = true;
					}
				}
				if (_activationTimer >= ManualHealingActivationTime && !_isActivated)
				{
					ActivateHealing();
				}
				_isHealingInProgress = true;
				UpdateUI();
			}
			else
			{
				if (!(num2 < currentActivationVelocity))
				{
					return;
				}
				currentActivationVelocity = healingActivationVelocity;
				if (_activationTimer > 0f)
				{
					_activationTimer -= Time.deltaTime;
					if (_activationTimer < 0f)
					{
						_activationTimer = 0f;
					}
				}
				if (!_healingComplete)
				{
					ResetHealing();
				}
				if (_remainingCharges <= 0 || !_isHealingInProgress)
				{
					((MonoBehaviour)this).StartCoroutine(FadeOutBandagingSound(1f));
				}
				UpdateUI();
			}
		}

		private void ResetHealing()
		{
			_isActivated = false;
			_isHealingInProgress = false;
			UpdateUI();
		}

		private void ActivateHealing()
		{
			if (!_isActivated && _remainingCharges > 0)
			{
				_isActivated = true;
				PerformHealing();
			}
		}

		private void PerformHealing()
		{
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			if (_remainingCharges <= 0 || _healingComplete || GM.CurrentPlayerBody.GetPlayerHealth() >= HealLimit)
			{
				return;
			}
			if (HealOverTime)
			{
				GM.CurrentPlayerBody.DeActivateBuff(10);
				GM.CurrentPlayerBody.ActivateBuff(10, false);
				GM.CurrentPlayerBody.m_isHealing = true;
				GM.CurrentPlayerBody.m_isHurting = false;
				if (GM.CurrentPlayerBody.m_buffTime_Heal <= 0f)
				{
					GM.CurrentPlayerBody.m_buffIntensity_HealHarm = HealPercent / HealDuration;
					GM.CurrentPlayerBody.m_buffTime_Heal = HealDuration;
				}
			}
			else
			{
				float num = Mathf.Min(HealLimit - GM.CurrentPlayerBody.GetPlayerHealth(), HealPercent);
				GM.CurrentPlayerBody.HealPercent(num);
			}
			_remainingCharges--;
			DisableCurrentChargeBar();
			HealingSoundManager.PlayHealingSound(DefaultHealingSound, HealingSound, FemaleHealingSound, ((Component)this).transform.position);
			TriggerRisingHaptics();
			UpdateUI();
			_activationTimer = 0f;
			if (_remainingCharges <= 0)
			{
				if ((Object)(object)NoChargesImageFront != (Object)null)
				{
					((Behaviour)NoChargesImageFront).enabled = true;
				}
				if ((Object)(object)NoChargesImageBack != (Object)null)
				{
					((Behaviour)NoChargesImageBack).enabled = true;
				}
				if (DespawnAfterUse)
				{
					((MonoBehaviour)this).StartCoroutine(DelayedDespawn(((FVRInteractiveObject)this).m_hand));
				}
			}
			_isActivated = false;
			_isHealingInProgress = false;
		}

		private void DisableCurrentChargeBar()
		{
			int num = MaxCharges - _remainingCharges - 1;
			if (num >= 0 && num < UsedChargeImages.Length)
			{
				((Behaviour)UsedChargeImages[num]).enabled = true;
			}
		}

		private void TriggerRisingHaptics()
		{
			if (HuntFirstAidPlugin.EnableHaptics)
			{
				FVRViveHand component = ((Component)GM.CurrentPlayerBody.RightHand).GetComponent<FVRViveHand>();
				FVRViveHand component2 = ((Component)GM.CurrentPlayerBody.LeftHand).GetComponent<FVRViveHand>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.Buzzer != (Object)null)
				{
					((MonoBehaviour)this).StartCoroutine(PlayRisingHapticBuzz(component));
				}
				if ((Object)(object)component2 != (Object)null && (Object)(object)component2.Buzzer != (Object)null)
				{
					((MonoBehaviour)this).StartCoroutine(PlayRisingHapticBuzz(component2));
				}
			}
		}

		private IEnumerator PlayRisingHapticBuzz(FVRViveHand hand)
		{
			if ((Object)(object)hand != (Object)null)
			{
				hand.Buzz(hand.Buzzer.Buzz_BeginInteraction);
				yield return (object)new WaitForSeconds(0.1f);
				hand.Buzz(hand.Buzzer.Buzz_BeginInteraction);
				yield return (object)new WaitForSeconds(0.1f);
				hand.Buzz(hand.Buzzer.Buzz_BeginInteraction);
			}
		}

		private IEnumerator FadeOutBandagingSound(float fadeDuration)
		{
			if ((Object)(object)_currentBandagingSource != (Object)null && (Object)(object)_currentBandagingSource.Source != (Object)null && _currentBandagingSource.Source.isPlaying)
			{
				float startVolume = _currentBandagingSource.Source.volume;
				while ((Object)(object)_currentBandagingSource != (Object)null && (Object)(object)_currentBandagingSource.Source != (Object)null && _currentBandagingSource.Source.volume > 0f)
				{
					AudioSource source = _currentBandagingSource.Source;
					source.volume -= startVolume * Time.deltaTime / fadeDuration;
					yield return null;
				}
				if ((Object)(object)_currentBandagingSource != (Object)null && (Object)(object)_currentBandagingSource.Source != (Object)null)
				{
					_currentBandagingSource.Source.Stop();
					_currentBandagingSource.Source.volume = startVolume;
				}
				_currentBandagingSource = null;
			}
		}

		private void ResetAudioState()
		{
			_isTriggerHeld = false;
			_activationTimer = 0f;
			_isOpeningAnimationComplete = false;
			UpdateUI();
		}

		private void UpdateUI()
		{
			if (ChargeImages == null || _remainingCharges < 0)
			{
				return;
			}
			int num = MaxCharges - _remainingCharges;
			if (num < ChargeImages.Length)
			{
				float fillAmount = Mathf.Clamp01(_activationTimer / ManualHealingActivationTime);
				if (num < ChargeFillImages.Length)
				{
					ChargeFillImages[num].fillAmount = fillAmount;
				}
			}
		}

		private void SetUIVisibility(bool visible)
		{
			if ((Object)(object)MedkitUICanvas != (Object)null)
			{
				if (visible)
				{
					StartFadeIn();
				}
				else
				{
					StartFadeOut();
				}
			}
		}

		private void StartFadeIn()
		{
			isFadingIn = true;
			isFadingOut = false;
			fadeTime = 0f;
			if ((Object)(object)canvasGroup != (Object)null)
			{
				canvasGroup.alpha = 0f;
			}
			((Behaviour)MedkitUICanvas).enabled = true;
		}

		private void StartFadeOut()
		{
			isFadingOut = true;
			isFadingIn = false;
			fadeTime = 0f;
		}

		public override void SetQuickBeltSlot(FVRQuickBeltSlot slot)
		{
			((FVRPhysicalObject)this).SetQuickBeltSlot(slot);
			if ((Object)(object)slot != (Object)null && _isOpen)
			{
				CloseKit();
			}
		}

		private void Update()
		{
			if (isFadingIn && (Object)(object)canvasGroup != (Object)null)
			{
				fadeTime += Time.deltaTime;
				canvasGroup.alpha = Mathf.Lerp(0f, 1f, fadeTime / fadeDuration);
				if (fadeTime >= fadeDuration)
				{
					canvasGroup.alpha = 1f;
					isFadingIn = false;
				}
			}
			else if (isFadingOut && (Object)(object)canvasGroup != (Object)null)
			{
				fadeTime += Time.deltaTime;
				canvasGroup.alpha = Mathf.Lerp(1f, 0f, fadeTime / fadeDuration);
				if (fadeTime >= fadeDuration)
				{
					canvasGroup.alpha = 0f;
					isFadingOut = false;
					((Behaviour)MedkitUICanvas).enabled = false;
				}
			}
			if (!_isHealingInProgress && !_healingComplete)
			{
				if (_activationTimer > 0f)
				{
					_activationTimer -= Time.deltaTime;
					if (_activationTimer < 0f)
					{
						_activationTimer = 0f;
					}
				}
				UpdateUI();
			}
			if (ToggleOpeningAnimation && _isOpen)
			{
				CheckVelocityAndProcessHealing();
			}
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).EndInteraction(hand);
			m_hasTriggeredUpSinceBeginHealthKit = false;
			if (ToggleOpeningAnimation && _isOpen)
			{
				CloseKit();
			}
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			//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_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_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_00a4: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			if (DoesUseHandedPose)
			{
				if (!hand.IsThisTheRightHand && m_isInRightHandMode)
				{
					Quaternion rotation = ((FVRInteractiveObject)this).PoseOverride.rotation;
					((FVRInteractiveObject)this).PoseOverride.rotation = rotation * Quaternion.Euler(0f, 190f, 0f);
					Quaternion rotation2 = ((FVRInteractiveObject)this).PoseOverride_Touch.rotation;
					((FVRInteractiveObject)this).PoseOverride_Touch.rotation = rotation2 * Quaternion.Euler(0f, 190f, 0f);
					if ((Object)(object)MedkitUICanvas != (Object)null)
					{
						Transform transform = ((Component)MedkitUICanvas).transform;
						transform.rotation *= Quaternion.Euler(0f, 0f, 180f);
					}
					m_isInRightHandMode = false;
				}
				else if (hand.IsThisTheRightHand && !m_isInRightHandMode)
				{
					Quaternion rotation3 = ((FVRInteractiveObject)this).PoseOverride.rotation;
					((FVRInteractiveObject)this).PoseOverride.rotation = rotation3 * Quaternion.Euler(0f, 170f, 0f);
					Quaternion rotation4 = ((FVRInteractiveObject)this).PoseOverride_Touch.rotation;
					((FVRInteractiveObject)this).PoseOverride_Touch.rotation = rotation4 * Quaternion.Euler(0f, 170f, 0f);
					if ((Object)(object)MedkitUICanvas != (Object)null)
					{
						Transform transform2 = ((Component)MedkitUICanvas).transform;
						transform2.rotation *= Quaternion.Euler(0f, 0f, 180f);
					}
					m_isInRightHandMode = true;
				}
			}
			((FVRPhysicalObject)this).BeginInteraction(hand);
		}

		private IEnumerator DelayedDespawn(FVRViveHand hand)
		{
			yield return (object)new WaitForSeconds(DespawnDelaySeconds);
			((FVRInteractiveObject)this).EndInteraction(hand);
			((Component)this).gameObject.SetActive(false);
		}
	}
	public class HuntSyringe : FVRPhysicalObject
	{
		[Header("Basic Settings")]
		public bool DoesUseHandedPose = true;

		private bool m_isInRightHandMode = true;

		[Header("Audio Events")]
		public AudioEvent InjectionSound;

		public AudioEvent DefaultHealingSound;

		public AudioEvent HealingSound;

		public AudioEvent FemaleHealingSound;

		public AudioEvent SyringeStabSound;

		public AudioEvent SyringePullOutSound;

		[Header("Healing Configuration")]
		private bool _healingComplete;

		[Header("Proximity Thresholds")]
		public float HeadInjectionThreshold = 0.15f;

		public float HeadVibrationThreshold = 0.15f;

		public float HandInjectionThreshold = 0.05f;

		public float OppositeHandThreshold = 0.1f;

		private float LeftHandInjectionThreshold;

		private float RightHandInjectionThreshold;

		[Header("State Variables")]
		private bool _isNeedleNearHand = false;

		private bool _isNeedleNearHead = false;

		private bool _wasNeedleNearHand = false;

		private bool _wasNeedleNearHead = false;

		[Header("References")]
		public Transform needletip;

		[Header("Healing Behavior")]
		public bool CanHealAtLimit = false;

		public bool DoesRegenStackOnApplication = true;

		public bool PlayHealingSound = true;

		public bool PlayProximitySoundAtFullHealth = false;

		[Header("Animation")]
		public Animator syringeAnimator;

		public float InjectionAnimationLength = 1f;

		public float HealingActionDelay = 0.5f;

		[Header("Internal State")]
		private bool m_hasTriggeredUpSinceBeginSyringe = false;

		private bool injectionStarted = false;

		private bool lockedIsInjectionHead = false;

		public float HealPercent = 25f;

		public float HealLimit = 100f;

		public float HealDuration = 2f;

		public bool HealOverTime = false;

		public bool DespawnAfterUse = false;

		public float DespawnDelaySeconds = 3f;

		private FVRHapticBuzzProfile risingBuzzProfile;

		private FVRHapticBuzzProfile finishingBuzzProfile;

		private bool hapticsInitialized = false;

		public override void Start()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			((FVRInteractiveObject)this).Start();
			_healingComplete = false;
			m_hasTriggeredUpSinceBeginSyringe = false;
			injectionStarted = false;
			LeftHandInjectionThreshold = HandInjectionThreshold;
			RightHandInjectionThreshold = HandInjectionThreshold;
			if ((Object)(object)HealingSoundManager.Instance == (Object)null)
			{
				GameObject val = new GameObject("HealingSoundManager");
				val.AddComponent<HealingSoundManager>();
			}
			DespawnAfterUse = HuntFirstAidPlugin.SyringeDespawnAfterUse;
			EnsureHapticProfiles();
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0016: 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_0027: Invalid comparison between Unknown and I4
			//IL_0043: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			CheckHandProximity(hand);
			CheckHeadProximity();
			bool flag = (int)hand.CMode == 0 || (int)hand.CMode == 2;
			bool flag2 = hand.Input.TouchpadPressed && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f;
			bool flag3 = hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f;
			bool flag4 = !hand.IsInStreamlinedMode || flag;
			bool flag5 = ((!flag4) ? hand.Input.TriggerPressed : flag2);
			bool flag6 = ((!flag4) ? hand.Input.TriggerDown : flag3);
			if (!m_hasTriggeredUpSinceBeginSyringe)
			{
				if (!flag5)
				{
					m_hasTriggeredUpSinceBeginSyringe = true;
				}
				return;
			}
			FVRViveHand component = ((Component)GM.CurrentPlayerBody.LeftHand).GetComponent<FVRViveHand>();
			FVRViveHand component2 = ((Component)GM.CurrentPlayerBody.RightHand).GetComponent<FVRViveHand>();
			bool flag7 = IsHoldingSyringe(component, null);
			bool flag8 = IsHoldingSyringe(null, component2);
			bool flag9 = (Object)(object)component.CurrentInteractable == (Object)null;
			bool flag10 = (Object)(object)component2.CurrentInteractable == (Object)null;
			if ((flag9 && flag8) || (flag10 && flag7) || (flag9 && flag10))
			{
				ResetHandInjectionThreshold();
			}
			else if (flag7 || flag8)
			{
				ApplyOppositeHandThreshold(component, component2);
			}
			if (flag6 && IsNeedleNearHeadOrHand() && (CanHealAtLimit || GM.CurrentPlayerBody.GetPlayerHealth() < HealLimit) && !_healingComplete && !injectionStarted)
			{
				injectionStarted = true;
				lockedIsInjectionHead = _isNeedleNearHead;
				if ((Object)(object)syringeAnimator != (Object)null)
				{
					syringeAnimator.speed = 1f / InjectionAnimationLength;
					syringeAnimator.SetTrigger("TriggerPulled");
				}
				PlaySound(InjectionSound);
				((MonoBehaviour)this).StartCoroutine(WaitForAnimationAndHeal(hand));
			}
		}

		private IEnumerator WaitForAnimationAndHeal(FVRViveHand injectingHand)
		{
			yield return (object)new WaitForSeconds(InjectionAnimationLength);
			yield return (object)new WaitForSeconds(HealingActionDelay);
			ActivateHealing(injectingHand);
		}

		private void ActivateHealing(FVRViveHand injectingHand)
		{
			if ((CanHealAtLimit || !(GM.CurrentPlayerBody.GetPlayerHealth() >= HealLimit)) && !_healingComplete)
			{
				PerformHealing(injectingHand);
				_healingComplete = true;
			}
		}

		private void PerformHealing(FVRViveHand injectingHand)
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			if (HealOverTime)
			{
				GM.CurrentPlayerBody.DeActivateBuff(10);
				GM.CurrentPlayerBody.ActivateBuff(10, false);
				GM.CurrentPlayerBody.m_isHealing = true;
				GM.CurrentPlayerBody.m_isHurting = false;
				if (GM.CurrentPlayerBody.m_buffTime_Heal <= 0f)
				{
					GM.CurrentPlayerBody.m_buffIntensity_HealHarm = HealPercent / HealDuration;
					GM.CurrentPlayerBody.m_buffTime_Heal = HealDuration;
				}
			}
			else
			{
				float num = ((!CanHealAtLimit) ? Mathf.Min(HealLimit - GM.CurrentPlayerBody.GetPlayerHealth(), HealPercent) : HealPercent);
				GM.CurrentPlayerBody.HealPercent(num);
			}
			if (!HealOverTime || !HuntFirstAidPlugin.SyringeNoHealingSound)
			{
				HealingSoundManager.PlayHealingSound(DefaultHealingSound, HealingSound, FemaleHealingSound, ((Component)this).transform.position);
			}
			if (HuntFirstAidPlugin.EnableHaptics)
			{
				if (lockedIsInjectionHead)
				{
					if ((Object)(object)injectingHand != (Object)null && (Object)(object)injectingHand.Buzzer != (Object)null)
					{
						((MonoBehaviour)this).StartCoroutine(PlayRisingHapticBuzz(injectingHand));
					}
				}
				else
				{
					FVRViveHand oppositeHand = GetOppositeHand(injectingHand);
					if ((Object)(object)oppositeHand != (Object)null && (Object)(object)oppositeHand.Buzzer != (Object)null)
					{
						((MonoBehaviour)this).StartCoroutine(PlayRisingHapticBuzz(oppositeHand));
					}
				}
			}
			if (DespawnAfterUse)
			{
				((MonoBehaviour)this).StartCoroutine(DelayedDespawn());
			}
		}

		private void PlaySound(AudioEvent sound)
		{
			//IL_0066: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			if (sound == null)
			{
				return;
			}
			if (sound == HealingSound)
			{
				if ((Object)(object)Camera.main != (Object)null)
				{
					SM.PlayGenericSound(sound, ((Component)Camera.main).transform.position);
				}
				else
				{
					SM.PlayGenericSound(sound, ((Component)this).transform.position);
				}
			}
			else
			{
				SM.PlayGenericSound(sound, ((Component)this).transform.position);
			}
		}

		private void CheckHeadProximity()
		{
			//IL_0017: 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)
			Transform transform = ((Component)GM.CurrentPlayerBody.Head).transform;
			float num = Vector3.Distance(needletip.position, transform.position);
			_isNeedleNearHead = num < HeadInjectionThreshold;
			if (!injectionStarted && (PlayProximitySoundAtFullHealth || GM.CurrentPlayerBody.GetPlayerHealth() < HealLimit || CanHealAtLimit))
			{
				if (_isNeedleNearHead && !_wasNeedleNearHead)
				{
					PlaySound(SyringeStabSound);
				}
				else if (!_isNeedleNearHead && _wasNeedleNearHead)
				{
					PlaySound(SyringePullOutSound);
				}
			}
			_wasNeedleNearHead = _isNeedleNearHead;
		}

		private void CheckHandProximity(FVRViveHand holdingHand)
		{
			//IL_0063: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			Transform leftHand = GM.CurrentPlayerBody.LeftHand;
			Transform rightHand = GM.CurrentPlayerBody.RightHand;
			bool flag = (Object)(object)holdingHand == (Object)null || (Object)(object)((Component)holdingHand).transform != (Object)(object)leftHand;
			bool flag2 = (Object)(object)holdingHand == (Object)null || (Object)(object)((Component)holdingHand).transform != (Object)(object)rightHand;
			_isNeedleNearHand = false;
			if (flag)
			{
				float num = Vector3.Distance(needletip.position, leftHand.position);
				_isNeedleNearHand |= num < LeftHandInjectionThreshold;
			}
			if (flag2)
			{
				float num2 = Vector3.Distance(needletip.position, rightHand.position);
				_isNeedleNearHand |= num2 < RightHandInjectionThreshold;
			}
			if (!injectionStarted && (PlayProximitySoundAtFullHealth || GM.CurrentPlayerBody.GetPlayerHealth() < HealLimit || CanHealAtLimit))
			{
				if (_isNeedleNearHand && !_wasNeedleNearHand)
				{
					PlaySound(SyringeStabSound);
				}
				else if (!_isNeedleNearHand && _wasNeedleNearHand)
				{
					PlaySound(SyringePullOutSound);
				}
			}
			_wasNeedleNearHand = _isNeedleNearHand;
		}

		private bool IsNeedleNearHeadOrHand()
		{
			return _isNeedleNearHand || _isNeedleNearHead;
		}

		private bool IsHoldingSyringe(FVRViveHand leftHand, FVRViveHand rightHand)
		{
			bool flag = (Object)(object)leftHand != (Object)null && (Object)(object)leftHand.CurrentInteractable != (Object)null && (Object)(object)((Component)leftHand.CurrentInteractable).GetComponent<HuntSyringe>() != (Object)null;
			bool flag2 = (Object)(object)rightHand != (Object)null && (Object)(object)rightHand.CurrentInteractable != (Object)null && (Object)(object)((Component)rightHand.CurrentInteractable).GetComponent<HuntSyringe>() != (Object)null;
			return flag || flag2;
		}

		private void ApplyOppositeHandThreshold(FVRViveHand leftHand, FVRViveHand rightHand)
		{
			if ((Object)(object)leftHand.CurrentInteractable != (Object)null && (Object)(object)((Component)leftHand.CurrentInteractable).GetComponent<HuntSyringe>() != (Object)null)
			{
				if ((Object)(object)rightHand.CurrentInteractable != (Object)null && (Object)(object)((Component)rightHand.CurrentInteractable).GetComponent<HuntSyringe>() == (Object)null)
				{
					RightHandInjectionThreshold = OppositeHandThreshold;
				}
			}
			else if ((Object)(object)rightHand.CurrentInteractable != (Object)null && (Object)(object)((Component)rightHand.CurrentInteractable).GetComponent<HuntSyringe>() != (Object)null && (Object)(object)leftHand.CurrentInteractable != (Object)null && (Object)(object)((Component)leftHand.CurrentInteractable).GetComponent<HuntSyringe>() == (Object)null)
			{
				LeftHandInjectionThreshold = OppositeHandThreshold;
			}
		}

		private void ResetHandInjectionThreshold()
		{
			LeftHandInjectionThreshold = HandInjectionThreshold;
			RightHandInjectionThreshold = HandInjectionThreshold;
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			//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_0036: 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_003c: 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_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_004e: 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_0066: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00ea: 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_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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_0126: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: 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_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: 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_015c: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			if (DoesUseHandedPose)
			{
				if (!hand.IsThisTheRightHand && m_isInRightHandMode)
				{
					Vector3 up = ((FVRInteractiveObject)this).PoseOverride.up;
					Vector3 forward = ((FVRInteractiveObject)this).PoseOverride.forward;
					up = Vector3.Reflect(up, ((Component)this).transform.right);
					forward = Vector3.Reflect(forward, ((Component)this).transform.right);
					((FVRInteractiveObject)this).PoseOverride.rotation = Quaternion.LookRotation(forward, up);
					up = ((FVRInteractiveObject)this).PoseOverride_Touch.up;
					forward = ((FVRInteractiveObject)this).PoseOverride_Touch.forward;
					up = Vector3.Reflect(up, ((Component)this).transform.right);
					forward = Vector3.Reflect(forward, ((Component)this).transform.right);
					((FVRInteractiveObject)this).PoseOverride_Touch.rotation = Quaternion.LookRotation(forward, up);
					m_isInRightHandMode = false;
				}
				else if (hand.IsThisTheRightHand && !m_isInRightHandMode)
				{
					Vector3 up2 = ((FVRInteractiveObject)this).PoseOverride.up;
					Vector3 forward2 = ((FVRInteractiveObject)this).PoseOverride.forward;
					up2 = Vector3.Reflect(up2, ((Component)this).transform.right);
					forward2 = Vector3.Reflect(forward2, ((Component)this).transform.right);
					((FVRInteractiveObject)this).PoseOverride.rotation = Quaternion.LookRotation(forward2, up2);
					up2 = ((FVRInteractiveObject)this).PoseOverride_Touch.up;
					forward2 = ((FVRInteractiveObject)this).PoseOverride_Touch.forward;
					up2 = Vector3.Reflect(up2, ((Component)this).transform.right);
					forward2 = Vector3.Reflect(forward2, ((Component)this).transform.right);
					((FVRInteractiveObject)this).PoseOverride_Touch.rotation = Quaternion.LookRotation(forward2, up2);
					m_isInRightHandMode = true;
				}
			}
			((FVRPhysicalObject)this).BeginInteraction(hand);
		}

		private FVRViveHand GetOppositeHand(FVRViveHand injectingHand)
		{
			FVRViveHand component = ((Component)GM.CurrentPlayerBody.LeftHand).GetComponent<FVRViveHand>();
			FVRViveHand component2 = ((Component)GM.CurrentPlayerBody.RightHand).GetComponent<FVRViveHand>();
			if ((Object)(object)injectingHand == (Object)(object)component)
			{
				return component2;
			}
			if ((Object)(object)injectingHand == (Object)(object)component2)
			{
				return component;
			}
			return null;
		}

		private IEnumerator PlayRisingHapticBuzz(FVRViveHand hand)
		{
			if (!((Object)(object)hand == (Object)null))
			{
				EnsureHapticProfiles();
				hand.Buzz(risingBuzzProfile);
				yield return (object)new WaitForSeconds(risingBuzzProfile.BuzzLength);
				hand.Buzz(finishingBuzzProfile);
			}
		}

		private IEnumerator DelayedDespawn()
		{
			yield return (object)new WaitForSeconds(DespawnDelaySeconds);
			((Component)this).gameObject.SetActive(false);
		}

		private void EnsureHapticProfiles()
		{
			//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_0084: 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_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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			if (!hapticsInitialized)
			{
				risingBuzzProfile = ScriptableObject.CreateInstance<FVRHapticBuzzProfile>();
				risingBuzzProfile.BuzzLength = 0.8f;
				risingBuzzProfile.AmpMult = 1f;
				risingBuzzProfile.Freq = 180;
				risingBuzzProfile.BuzzCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[6]
				{
					new Keyframe(0f, 0.9f),
					new Keyframe(0.093f, 0.8f),
					new Keyframe(0.227f, 0.6f),
					new Keyframe(0.368f, 0.4f),
					new Keyframe(0.513f, 0.1f),
					new Keyframe(1f, 0.1f)
				});
				finishingBuzzProfile = ScriptableObject.CreateInstance<FVRHapticBuzzProfile>();
				finishingBuzzProfile.BuzzLength = 0.2f;
				finishingBuzzProfile.AmpMult = 0.1f;
				finishingBuzzProfile.Freq = 150;
				finishingBuzzProfile.BuzzCurve = AnimationCurve.Linear(0f, 0.1f, 1f, 0.1f);
				hapticsInitialized = true;
			}
		}

		public override void OnDestroy()
		{
			if ((Object)(object)risingBuzzProfile != (Object)null)
			{
				Object.Destroy((Object)(object)risingBuzzProfile);
				risingBuzzProfile = null;
			}
			if ((Object)(object)finishingBuzzProfile != (Object)null)
			{
				Object.Destroy((Object)(object)finishingBuzzProfile);
				finishingBuzzProfile = null;
			}
			hapticsInitialized = false;
			((FVRPhysicalObject)this).OnDestroy();
		}
	}
}
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 HasMoveRelativeToEmitter;

	public Transform MoveRelEmitter;

	public float MoveRelPositionInherit;

	public float MoveRelVelocityInherit;

	public bool HasAlignRotation;

	public Transform AlignParentTransform;

	public Vector3 AlignAxisLocal;

	[NonSerialized]
	private Vector3 _alignTargetWorldDir;

	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 void Awake()
	{
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: 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_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_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Ps == (Object)null)
		{
			Ps = ((Component)this).GetComponent<ParticleSystem>();
		}
		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 val = ((!((Object)(object)Beam.SourceTransform != (Object)null)) ? ((Component)this).transform.position : Beam.SourceTransform.position);
			Vector3 val2 = ((!((Object)(object)Beam.DestTransform != (Object)null)) ? ((Component)this).transform.position : Beam.DestTransform.position);
			beamSourceWorld = val + Beam.SourceOffset;
			beamDestWorld = val2 + Beam.DestOffset;
			if (Beam.HasLine)
			{
				LineRenderer val3 = ((Component)this).GetComponent<LineRenderer>();
				if ((Object)(object)val3 == (Object)null)
				{
					val3 = ((Component)this).gameObject.AddComponent<LineRenderer>();
				}
				ParticleSystemRenderer component = ((Component)this).GetComponent<ParticleSystemRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)val3).material = ((Renderer)component).sharedMaterial;
				}
				val3.useWorldSpace = true;
				val3.positionCount = 2;
				val3.SetPosition(0, beamSourceWorld);
				val3.SetPosition(1, beamDestWorld);
			}
		}
		if (HasMoveRelativeToEmitter)
		{
			if ((Object)(object)MoveRelEmitter == (Object)null)
			{
				MoveRelEmitter = ((Component)this).transform;
			}
			lastEmitterPos = MoveRelEmitter.position;
			lastEmitterRot = MoveRelEmitter.rotation;
		}
		if (HasAlignRotation)
		{
			Quaternion val4 = ((!((Object)(object)AlignParentTransform != (Object)null)) ? Quaternion.identity : AlignParentTransform.rotation);
			Vector3 val5 = val4 * AlignAxisLocal;
			_alignTargetWorldDir = ((Vector3)(ref val5)).normalized;
		}
	}

	private void LateUpdate()
	{
		//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_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: 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_0113: 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_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0954: Unknown result type (might be due to invalid IL or missing references)
		//IL_0956: Unknown result type (might be due to invalid IL or missing references)
		//IL_0962: Unknown result type (might be due to invalid IL or missing references)
		//IL_0967: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: 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_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0334: Unknown result type (might be due to invalid IL or missing references)
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: 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_0380: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_0389: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Unknown result type (might be due to invalid IL or missing references)
		//IL_049d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0501: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0567: Unknown result type (might be due to invalid IL or missing references)
		//IL_0557: Unknown result type (might be due to invalid IL or missing references)
		//IL_068b: Unknown result type (might be due to invalid IL or missing references)
		//IL_068d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0698: Unknown result type (might be due to invalid IL or missing references)
		//IL_069d: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_056c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0843: Unknown result type (might be due to invalid IL or missing references)
		//IL_0845: Unknown result type (might be due to invalid IL or missing references)
		//IL_0848: 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_0852: Unknown result type (might be due to invalid IL or missing references)
		//IL_0857: Unknown result type (might be due to invalid IL or missing references)
		//IL_0859: Unknown result type (might be due to invalid IL or missing references)
		//IL_085e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0860: Unknown result type (might be due to invalid IL or missing references)
		//IL_0862: Unknown result type (might be due to invalid IL or missing references)
		//IL_086a: Unknown result type (might be due to invalid IL or missing references)
		//IL_086f: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0595: Unknown result type (might be due to invalid IL or missing references)
		//IL_058b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0422: Unknown result type (might be due to invalid IL or missing references)
		//IL_0424: Unknown result type (might be due to invalid IL or missing references)
		//IL_0433: 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_043f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0444: Unknown result type (might be due to invalid IL or missing references)
		//IL_0449: Unknown result type (might be due to invalid IL or missing references)
		//IL_0883: Unknown result type (might be due to invalid IL or missing references)
		//IL_0885: Unknown result type (might be due to invalid IL or missing references)
		//IL_0887: Unknown result type (might be due to invalid IL or missing references)
		//IL_088c: Unknown result type (might be due to invalid IL or missing references)
		//IL_088e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0890: Unknown result type (might be due to invalid IL or missing references)
		//IL_0898: Unknown result type (might be due to invalid IL or missing references)
		//IL_089d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0720: Unknown result type (might be due to invalid IL or missing references)
		//IL_0716: 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_059c: Unknown result type (might be due to invalid IL or missing references)
		//IL_059e: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0725: Unknown result type (might be due to invalid IL or missing references)
		//IL_0727: Unknown result type (might be due to invalid IL or missing references)
		//IL_0729: Unknown result type (might be due to invalid IL or missing references)
		//IL_072b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0730: Unknown result type (might be due to invalid IL or missing references)
		//IL_0764: Unknown result type (might be due to invalid IL or missing references)
		//IL_0766: Unknown result type (might be due to invalid IL or missing references)
		//IL_0768: Unknown result type (might be due to invalid IL or missing references)
		//IL_076d: Unknown result type (might be due to invalid IL or missing references)
		//IL_076f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0771: Unknown result type (might be due to invalid IL or missing references)
		//IL_0773: Unknown result type (might be due to invalid IL or missing references)
		//IL_0775: Unknown result type (might be due to invalid IL or missing references)
		//IL_077c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0781: Unknown result type (might be due to invalid IL or missing references)
		//IL_0786: Unknown result type (might be due to invalid IL or missing references)
		//IL_0788: Unknown result type (might be due to invalid IL or missing references)
		//IL_078d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0618: Unknown result type (might be due to invalid IL or missing references)
		//IL_061a: Unknown result type (might be due to invalid IL or missing references)
		//IL_061c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0621: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0603: Unknown result type (might be due to invalid IL or missing references)
		//IL_0608: Unknown result type (might be due to invalid IL or missing references)
		//IL_060a: Unknown result type (might be due to invalid IL or missing references)
		//IL_060f: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d3: 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_07d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ef: 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_064f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0653: Unknown result type (might be due to invalid IL or missing references)
		//IL_065d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0662: Unknown result type (might be due to invalid IL or missing references)
		//IL_0667: 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 (!HasBeam && !flag3 && !flag4 && !flag && !flag2 && !HasMoveRelativeToEmitter && !HasAlignRotation)
		{
			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 rotation = ((Component)this).transform.rotation;
			Vector3 val3 = ((!HasBeam) ? Vector3.zero : (beamDestWorld - beamSourceWorld));
			bool flag5 = false;
			float rotation2 = 0f;
			if (HasAlignRotation && (Object)(object)Camera.main != (Object)null)
			{
				Transform transform = ((Component)Camera.main).transform;
				Vector3 val4 = _alignTargetWorldDir - Vector3.Dot(_alignTargetWorldDir, transform.forward) * transform.forward;
				if (((Vector3)(ref val4)).sqrMagnitude > 1E-06f)
				{
					float num2 = Vector3.Angle(transform.up, val4);
					float num3 = Mathf.Sign(Vector3.Dot(transform.forward, Vector3.Cross(transform.up, val4)));
					rotation2 = 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 val5 = ((Particle)(ref buffer[k])).position;
				Vector3 val6 = ((Particle)(ref buffer[k])).velocity;
				if (HasBeam && flag6)
				{
					float num6 = ((num4 <= 1) ? 0.5f : ((float)num5 / (float)(num4 - 1)));
					val5 = beamSourceWorld + val3 * num6;
					num5++;
				}
				if (flag3 && flag6)
				{
					float value = Random.value;
					for (int l = 0; l < LocationOffsets.Length; l++)
					{
						AnimationCurve val7 = ((_locationOffsetScaleCurves == null || l >= _locationOffsetScaleCurves.Length) ? null : _locationOffsetScaleCurves[l]);
						float num7 = ((val7 == null) ? Mathf.Lerp(LocationOffsets[l].ScaleMin, LocationOffsets[l].ScaleMax, value) : val7.Evaluate(value));
						val5 += rotation * 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 val8 = rotation * RandomDirectionInCone(VelocityExtras[m].Direction, VelocityExtras[m].ConeAngleDeg, value2, value3);
						float num8 = Mathf.Lerp(VelocityExtras[m].SpeedMin, VelocityExtras[m].SpeedMax, value4);
						val6 += val8 * num8;
					}
				}
				if (flag)
				{
					for (int n = 0; n < GravityEntries.Length; n++)
					{
						GravityEntry gravityEntry = GravityEntries[n];
						Vector3 val9 = ((!((Object)(object)gravityEntry.Target != (Object)null)) ? ((Component)this).transform.position : gravityEntry.Target.position);
						Vector3 val10 = ((!(((Vector3)(ref gravityEntry.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref gravityEntry.Axis)).normalized);
						Vector3 val11 = rotation * val10;
						float num9 = ((!(gravityEntry.Decay > 0f)) ? 0f : (1f / (gravityEntry.Decay * gravityEntry.Decay)));
						Vector3 val13;
						if (gravityEntry.UseAxis)
						{
							Vector3 val12 = val5 - val9;
							val13 = val9 + val11 * Vector3.Dot(val11, val12) - val5;
						}
						else
						{
							val13 = val9 - val5;
						}
						float sqrMagnitude = ((Vector3)(ref val13)).sqrMagnitude;
						if (sqrMagnitude > 1E-08f)
						{
							float num10 = gravityEntry.Accel / (1f + num9 * sqrMagnitude);
							val6 += ((Vector3)(ref val13)).normalized * (num10 * num);
						}
					}
					if (HasGravityDrag)
					{
						val6 -= val6 * (GravityDrag * num);
					}
				}
				if (flag2)
				{
					for (int num11 = 0; num11 < VortexEntries.Length; num11++)
					{
						VortexEntry vortexEntry = VortexEntries[num11];
						Vector3 val14 = ((!((Object)(object)vortexEntry.Target != (Object)null)) ? ((Component)this).transform.position : vortexEntry.Target.position);
						Vector3 val15 = ((!(((Vector3)(ref vortexEntry.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref vortexEntry.Axis)).normalized);
						Vector3 val16 = rotation * val15;
						float num12 = ((!(vortexEntry.Decay > 0f)) ? 0f : (1f / (vortexEntry.Decay * vortexEntry.Decay)));
						Vector3 val17 = val5 - val14;
						Vector3 val18 = val14 + val16 * Vector3.Dot(val16, val17) - val5;
						float sqrMagnitude2 = ((Vector3)(ref val18)).sqrMagnitude;
						if (sqrMagnitude2 > 1E-08f)
						{
							float num13 = vortexEntry.Speed / (1f + num12 * sqrMagnitude2);
							Vector3 val19 = Vector3.Cross(((Vector3)(ref val18)).normalized, val16) * num13;
							val6 += (val19 - val6) * vortexEntry.Drag * num;
						}
					}
				}
				if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null && !flag6)
				{
					if (MoveRelPositionInherit > 0f)
					{