Decompiled source of MuzzleScripts2 v1.0.0

Muzzle.MuzzleScripts.dll

Decompiled 13 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using Microsoft.CodeAnalysis;
using On.FistVR;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Muzzle")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A collection of scripts for my H3VR mods.")]
[assembly: AssemblyFileVersion("1.0.5.0")]
[assembly: AssemblyInformationalVersion("1.0.5+0384d012db27c3643ba244f1a0149a8f90fc153b")]
[assembly: AssemblyProduct("Muzzle.MuzzleScripts")]
[assembly: AssemblyTitle("MuzzleScripts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.5.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace MuzzleScripts
{
	public class AttachableFlintlockBarrel : MonoBehaviour
	{
		private AttachableFlintlockWeapon m_weapon;

		private AttachableFlintlockFlashPan m_pan;

		[Header("Barrel")]
		public Transform Muzzle;

		public Transform LodgePoint_Paper;

		public Transform LodgePoint_Shot;

		public float BarrelLength = 0.21f;

		public List<LoadedElement> LoadedElements = new List<LoadedElement>();

		public List<Renderer> ProxyRends0;

		public List<Renderer> ProxyRends1;

		public MeshFilter ProxyPowder0;

		public MeshFilter ProxyPowder1;

		public List<Mesh> ProxyPowderPiles;

		public List<GameObject> EjectedObjectPrefabs;

		public Vector4 LoadedElementSizes = new Vector4(0.001f, 0.0175f, 0.0195f, 0.01f);

		[Header("Projectile Stuff")]
		public GameObject ProjectilePrefab;

		public float Spread = 0.6f;

		public float VelocityMult = 1f;

		public GameObject IgniteProjectile_Visible;

		public GameObject IgniteProjectile_NotVisible;

		public AnimationCurve PowderToVelMultCurve;

		[Header("Audio")]
		public AudioEvent AudEvent_Tamp;

		public AudioEvent AudEvent_TampEnd;

		public AudioEvent AudEvent_Squib;

		public List<AudioEvent> AudEvent_InsertByType;

		private float m_insertSoundRefire = 0.2f;

		[Header("MuzzleEffects")]
		public MuzzleEffectSize DefaultMuzzleEffectSize = (MuzzleEffectSize)1;

		public MuzzleEffect[] MuzzleEffects;

		private List<MuzzlePSystem> m_muzzleSystems = new List<MuzzlePSystem>();

		public ParticleSystem MuzzleOverFireSystem;

		public Vector2 MuzzleOverFireSystemScaleRange = new Vector2(0.3f, 2f);

		public Vector2 MuzzleOverFireSystemEmitRange = new Vector2(3f, 20f);

		public Vector2 FlashBlastSmokeRange = new Vector2(4f, 10f);

		public Vector2 FlashBlastFireRange = new Vector2(2f, 10f);

		private bool m_isIgnited;

		private float m_igniteTick;

		private float TampRefire = 0.2f;

		public AttachableFlintlockWeapon GetWeapon()
		{
			return m_weapon;
		}

		public void SetWeapon(AttachableFlintlockWeapon w)
		{
			m_weapon = w;
		}

		public void SetPan(AttachableFlintlockFlashPan p)
		{
			m_pan = p;
		}

		public float GetLengthOfElement(LoadedElementType Type, int PowderAmount)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			return (int)Type switch
			{
				0 => LoadedElementSizes.x * (float)PowderAmount, 
				1 => LoadedElementSizes.y, 
				2 => LoadedElementSizes.z, 
				3 => LoadedElementSizes.w, 
				_ => 0f, 
			};
		}

		private bool CanElementFit(LoadedElementType Type)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (LoadedElements.Count != 0)
			{
				return LoadedElements[LoadedElements.Count - 1].Position > GetLengthOfElement(Type, 5);
			}
			return true;
		}

		private void Awake()
		{
			RegenerateMuzzleEffects();
		}

		private void RegenerateMuzzleEffects()
		{
			//IL_0048: 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_0063: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected I4, but got Unknown
			//IL_00b5: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected I4, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected I4, but got Unknown
			for (int i = 0; i < m_muzzleSystems.Count; i++)
			{
				Object.Destroy((Object)(object)m_muzzleSystems[i].PSystem);
			}
			m_muzzleSystems.Clear();
			MuzzleEffect[] muzzleEffects = MuzzleEffects;
			for (int j = 0; j < muzzleEffects.Length; j++)
			{
				if ((int)muzzleEffects[j].Entry != 0)
				{
					MuzzleEffectConfig muzzleConfig = FXM.GetMuzzleConfig(muzzleEffects[j].Entry);
					MuzzleEffectSize size = muzzleEffects[j].Size;
					GameObject val = ((!GM.CurrentSceneSettings.IsSceneLowLight) ? Object.Instantiate<GameObject>(muzzleConfig.Prefabs_Highlight[(int)size], Muzzle.position, Muzzle.rotation) : Object.Instantiate<GameObject>(muzzleConfig.Prefabs_Lowlight[(int)size], Muzzle.position, Muzzle.rotation));
					if ((Object)(object)muzzleEffects[j].OverridePoint == (Object)null)
					{
						val.transform.SetParent(((Component)Muzzle).transform);
					}
					else
					{
						val.transform.SetParent(muzzleEffects[j].OverridePoint);
						val.transform.localPosition = Vector3.zero;
						val.transform.localEulerAngles = Vector3.zero;
					}
					MuzzlePSystem val2 = new MuzzlePSystem();
					val2.PSystem = val.GetComponent<ParticleSystem>();
					val2.OverridePoint = muzzleEffects[j].OverridePoint;
					int index = (int)size;
					if (GM.CurrentSceneSettings.IsSceneLowLight)
					{
						val2.NumParticlesPerShot = muzzleConfig.NumParticles_Lowlight[index];
					}
					else
					{
						val2.NumParticlesPerShot = muzzleConfig.NumParticles_Highlight[index];
					}
					m_muzzleSystems.Add(val2);
				}
			}
		}

		public void FireMuzzleSmoke()
		{
			//IL_0012: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (GM.CurrentSceneSettings.IsSceneLowLight)
			{
				FXM.InitiateMuzzleFlash(Muzzle.position, Muzzle.forward, 1f, new Color(1f, 0.9f, 0.77f), 1f);
			}
			for (int i = 0; i < m_muzzleSystems.Count; i++)
			{
				if ((Object)(object)m_muzzleSystems[i].OverridePoint == (Object)null)
				{
					((Component)m_muzzleSystems[i].PSystem).transform.position = Muzzle.position;
				}
				m_muzzleSystems[i].PSystem.Emit(m_muzzleSystems[i].NumParticlesPerShot);
			}
		}

		private bool IsBarrelPlugged()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Invalid comparison between Unknown and I4
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Invalid comparison between Unknown and I4
			if (LoadedElements.Count != 0)
			{
				if ((int)LoadedElements[LoadedElements.Count - 1].Type != 0 && LoadedElements[LoadedElements.Count - 1].Position < 0.01f)
				{
					if ((int)LoadedElements[LoadedElements.Count - 1].Type != 1)
					{
						return (int)LoadedElements[LoadedElements.Count - 1].Type == 2;
					}
					return true;
				}
				return false;
			}
			return false;
		}

		public void OnTriggerEnter(Collider other)
		{
			//IL_0015: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Invalid comparison between Unknown and I4
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Invalid comparison between Unknown and I4
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: 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_0165: 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 ((Object)(object)other.attachedRigidbody == (Object)null || Vector3.Angle(Muzzle.forward, Vector3.up) > 90f)
			{
				return;
			}
			GameObject gameObject = ((Component)other.attachedRigidbody).gameObject;
			if (gameObject.CompareTag("flintlock_shot"))
			{
				if (CanElementFit((LoadedElementType)1) && (!((Component)m_weapon.RamRod).gameObject.activeSelf || (int)m_weapon.RamRod.RState != 1 || !((Object)(object)m_weapon.RamRod.GetCurBarrel() == (Object)(object)this)) && !IsBarrelPlugged())
				{
					((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_InsertByType[1], Muzzle.position);
					InsertElement((LoadedElementType)1);
					Object.Destroy((Object)(object)((Component)other).gameObject);
				}
			}
			else if (gameObject.CompareTag("flintlock_paper"))
			{
				if (!CanElementFit((LoadedElementType)2) || (((Component)m_weapon.RamRod).gameObject.activeSelf && (int)m_weapon.RamRod.RState == 1 && (Object)(object)m_weapon.RamRod.GetCurBarrel() == (Object)(object)this) || IsBarrelPlugged() || Vector3.Angle(Muzzle.forward, gameObject.transform.forward) > 80f)
				{
					return;
				}
				FlintlockPaperCartridge component = gameObject.GetComponent<FlintlockPaperCartridge>();
				if ((int)component.CState != 0)
				{
					((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_InsertByType[2], Muzzle.position);
					for (int i = 0; i < component.numPowderChunksLeft; i++)
					{
						InsertElement((LoadedElementType)0);
					}
					InsertElement((LoadedElementType)2);
					Object.Destroy((Object)(object)((Component)other).gameObject);
				}
			}
			else if (gameObject.CompareTag("flintlock_wadding"))
			{
				if (CanElementFit((LoadedElementType)3))
				{
					((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_InsertByType[3], Muzzle.position);
					InsertElement((LoadedElementType)3);
					Object.Destroy((Object)(object)((Component)other).gameObject);
				}
			}
			else if (gameObject.CompareTag("flintlock_powdergrain"))
			{
				if (CanElementFit((LoadedElementType)0))
				{
					if (m_insertSoundRefire > 0.15f)
					{
						((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_InsertByType[0], Muzzle.position);
					}
					InsertElement((LoadedElementType)0);
					Object.Destroy((Object)(object)((Component)other).gameObject);
				}
			}
			else if (gameObject.CompareTag("flintlock_ramrod"))
			{
				FlintlockRamRod component2 = gameObject.GetComponent<FlintlockRamRod>();
				if (((FVRInteractiveObject)component2).IsHeld)
				{
					FVRViveHand hand = ((FVRInteractiveObject)component2).m_hand;
					((FVRInteractiveObject)component2).ForceBreakInteraction();
					((Component)m_weapon.RamRod).gameObject.SetActive(true);
					m_weapon.RamRod.RState = (RamRodState)1;
					m_weapon.RamRod.MountToBarrel(this, hand);
					Tamp(0.05f, 0.001f);
					hand.ForceSetInteractable((FVRInteractiveObject)(object)m_weapon.RamRod);
					((FVRInteractiveObject)m_weapon.RamRod).BeginInteraction(hand);
					Object.Destroy((Object)(object)((Component)other).gameObject);
				}
			}
		}

		public void Tamp(float delta, float depth)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: 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)
			if (TampRefire < 0.15f || Mathf.Abs(delta) < 0.01f)
			{
				return;
			}
			if (LoadedElements.Count == 1)
			{
				if (Mathf.Abs(depth) > LoadedElements[0].Position)
				{
					float position = LoadedElements[0].Position;
					float num = LoadedElements[0].Position + Mathf.Abs(delta);
					float num2 = BarrelLength - GetLengthOfElement(LoadedElements[0].Type, LoadedElements[0].PowderAmount);
					num = Mathf.Clamp(num, num, num2);
					LoadedElements[0].Position = num;
					if (Mathf.Abs(position - num) > 0.001f)
					{
						((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_Tamp, Muzzle.position);
					}
					else
					{
						((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_TampEnd, Muzzle.position);
					}
					TampRefire = 0f;
				}
			}
			else if (LoadedElements.Count > 1 && Mathf.Abs(depth) > LoadedElements[LoadedElements.Count - 1].Position)
			{
				float position2 = LoadedElements[LoadedElements.Count - 1].Position;
				float num3 = LoadedElements[LoadedElements.Count - 1].Position + Mathf.Abs(delta);
				float num4 = LoadedElements[LoadedElements.Count - 2].Position - GetLengthOfElement(LoadedElements[LoadedElements.Count - 1].Type, LoadedElements[LoadedElements.Count - 1].PowderAmount);
				num3 = Mathf.Clamp(num3, num3, num4);
				LoadedElements[LoadedElements.Count - 1].Position = num3;
				if (Mathf.Abs(position2 - num3) > 0.001f)
				{
					((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_Tamp, Muzzle.position);
				}
				else
				{
					((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_TampEnd, Muzzle.position);
				}
				TampRefire = 0f;
			}
		}

		public float GetMaxDepth()
		{
			if (LoadedElements.Count < 1)
			{
				return BarrelLength;
			}
			return LoadedElements[LoadedElements.Count - 1].Position;
		}

		private void InsertElement(LoadedElementType type)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (LoadedElements.Count > 0)
			{
				if ((int)type == 0 && (int)LoadedElements[LoadedElements.Count - 1].Type == 0)
				{
					LoadedElement obj = LoadedElements[LoadedElements.Count - 1];
					obj.PowderAmount++;
					return;
				}
				LoadedElement val = new LoadedElement();
				val.Type = type;
				val.Position = 0f;
				val.PowderAmount = 1;
				LoadedElements.Add(val);
			}
			else
			{
				LoadedElement val2 = new LoadedElement();
				val2.Type = type;
				val2.Position = 0f;
				val2.PowderAmount = 1;
				LoadedElements.Add(val2);
			}
		}

		private int ExpellElement(LoadedElementType type, int PowderAmount)
		{
			//IL_0000: 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_0064: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected I4, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_0014: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0042: Expected I4, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if ((int)type != 0)
			{
				Vector3 val = Muzzle.position + Muzzle.forward * GetLengthOfElement(type, PowderAmount) * 0.75f;
				Object.Instantiate<GameObject>(EjectedObjectPrefabs[(int)type], val, Muzzle.rotation);
				return 0;
			}
			int result = PowderAmount - 1;
			Vector3 val2 = Muzzle.position + Random.onUnitSphere * 0.005f + Muzzle.forward * GetLengthOfElement(type, 1) * 0.75f;
			Object.Instantiate<GameObject>(EjectedObjectPrefabs[(int)type], val2, Muzzle.rotation);
			return result;
		}

		public void Ignite()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (LoadedElements.Count > 0 && (int)LoadedElements[0].Type == 0)
			{
				m_isIgnited = true;
				m_igniteTick = Random.Range(0.01f, 0.03f);
			}
		}

		private void Update()
		{
			if (TampRefire < 0.2f)
			{
				TampRefire += Time.deltaTime;
			}
			if (m_insertSoundRefire < 0.2f)
			{
				m_insertSoundRefire += Time.deltaTime;
			}
			if (m_isIgnited)
			{
				m_igniteTick -= Time.deltaTime;
				if (m_igniteTick <= 0f)
				{
					Fire();
				}
			}
			else
			{
				BarrelContentsSim();
				BarrelContentsDraw();
			}
		}

		private int GetNumProjectilesInBarrel()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			int num = 0;
			for (int i = 0; i < LoadedElements.Count; i++)
			{
				if ((int)LoadedElements[i].Type == 1 || (int)LoadedElements[i].Type == 2)
				{
					num += LoadedElements[i].PowderAmount;
				}
			}
			return num;
		}

		private int GetNumPowder()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			for (int i = 0; i < LoadedElements.Count; i++)
			{
				if ((int)LoadedElements[i].Type == 0)
				{
					num += LoadedElements[i].PowderAmount;
				}
			}
			return num;
		}

		private float GetMinProjPos()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			float num = BarrelLength;
			for (int i = 0; i < LoadedElements.Count; i++)
			{
				if ((int)LoadedElements[i].Type != 0)
				{
					num = Mathf.Min(num, LoadedElements[i].Position);
				}
			}
			return num;
		}

		private float GetMaxProjPos()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			for (int i = 0; i < LoadedElements.Count; i++)
			{
				if ((int)LoadedElements[i].Type != 0)
				{
					num = Mathf.Max(num, LoadedElements[i].Position);
				}
			}
			return num;
		}

		public void BurnOffOuter()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			if (LoadedElements.Count != 0 && (int)LoadedElements[LoadedElements.Count - 1].Type == 0)
			{
				int powderAmount = LoadedElements[LoadedElements.Count - 1].PowderAmount;
				LoadedElements.RemoveAt(LoadedElements.Count - 1);
				float num = Mathf.Lerp(0f, 1f, (float)powderAmount / 60f);
				float spread = Spread;
				float num2 = Mathf.Lerp(MuzzleOverFireSystemScaleRange.x, MuzzleOverFireSystemScaleRange.y, num);
				float num3 = Mathf.Lerp(MuzzleOverFireSystemEmitRange.x, MuzzleOverFireSystemEmitRange.y, num);
				((Component)MuzzleOverFireSystem).transform.localEulerAngles = new Vector3(num2, num2, num2);
				MuzzleOverFireSystem.Emit(Mathf.RoundToInt(num3));
				if (LoadedElements.Count == 0 && m_pan.GetPanContents() > 0f)
				{
					float panContents = m_pan.GetPanContents();
					m_pan.FlashBlast(Mathf.RoundToInt(panContents), Mathf.RoundToInt(panContents));
					m_pan.Ignite();
				}
				FireMuzzleSmoke();
				m_weapon.Fire(0f);
				if ((Object)(object)m_weapon.RamRod.GetCurBarrel() == (Object)(object)this)
				{
					((Component)m_weapon.RamRod).gameObject.SetActive(false);
					Object.Instantiate<GameObject>(m_weapon.RamRodProj, Muzzle.position, Muzzle.rotation).GetComponent<BallisticProjectile>().Fire(Muzzle.forward, ((AttachableFirearm)m_weapon).OverrideFA);
					((FVRInteractiveObject)m_weapon.RamRod).GameObject.SetActive(false);
					m_weapon.RamRod.MountToBarrel(null, null);
				}
				for (int i = 0; (float)i < num3; i++)
				{
					Vector3 val = Muzzle.forward * 0.005f;
					GameObject val2 = Object.Instantiate<GameObject>(IgniteProjectile_Visible, Muzzle.position - val, Muzzle.rotation);
					val2.transform.Rotate(new Vector3(Random.Range((0f - spread) * 2f, spread * 2f), Random.Range((0f - spread) * 2f, spread * 2f), 0f));
					BallisticProjectile component = val2.GetComponent<BallisticProjectile>();
					component.Fire(component.MuzzleVelocityBase, val2.transform.forward, ((AttachableFirearm)m_weapon).OverrideFA, true);
				}
				((AttachableFirearm)m_weapon).PlayAudioGunShot(true, (FVRTailSoundClass)13, (FVRTailSoundClass)7, GM.CurrentPlayerBody.GetCurrentSoundEnvironment());
			}
		}

		private void Fire()
		{
			//IL_001a: 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_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			if (LoadedElements.Count > 0 && (int)LoadedElements[0].Type != 0)
			{
				m_isIgnited = false;
				return;
			}
			bool flag = false;
			bool flag2 = false;
			int numProjectilesInBarrel = GetNumProjectilesInBarrel();
			int numPowder = GetNumPowder();
			float num = Mathf.Lerp(0.2f, 3.1f, (float)numPowder / 60f);
			float num2 = Mathf.Lerp(0f, 1f, (float)numPowder / 60f);
			float spread = Spread;
			float num3 = PowderToVelMultCurve.Evaluate((float)numPowder);
			if (numProjectilesInBarrel > 0)
			{
				num3 *= 1f / (float)numProjectilesInBarrel;
			}
			else
			{
				num = 0.05f;
			}
			if (num > 3f)
			{
				flag2 = true;
			}
			if (numProjectilesInBarrel > 3 && numPowder > 15)
			{
				flag = true;
			}
			if (numProjectilesInBarrel > 0 && numPowder > 100)
			{
				flag = true;
			}
			spread += Spread * 0.2f * (float)(numProjectilesInBarrel - 1);
			if (flag)
			{
				spread *= 5f;
			}
			float num4 = Mathf.Lerp(MuzzleOverFireSystemScaleRange.x, MuzzleOverFireSystemScaleRange.y, num2);
			float num5 = Mathf.Lerp(MuzzleOverFireSystemEmitRange.x, MuzzleOverFireSystemEmitRange.y, num2);
			((Component)MuzzleOverFireSystem).transform.localEulerAngles = new Vector3(num4, num4, num4);
			MuzzleOverFireSystem.Emit(Mathf.RoundToInt(num5));
			m_pan.FlashBlast(Mathf.RoundToInt(num5) * 2, Mathf.RoundToInt(num5) * 2);
			int num6 = 3 * numProjectilesInBarrel;
			if (numProjectilesInBarrel > 0 && numPowder < num6)
			{
				LoadedElements.RemoveAt(0);
				((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_Squib, ((Component)m_pan).transform.position);
				m_isIgnited = false;
				return;
			}
			FireMuzzleSmoke();
			m_weapon.Fire(num);
			if ((Object)(object)m_weapon.RamRod.GetCurBarrel() == (Object)(object)this)
			{
				((Component)m_weapon.RamRod).gameObject.SetActive(false);
				Object.Instantiate<GameObject>(m_weapon.RamRodProj, Muzzle.position, Muzzle.rotation).GetComponent<BallisticProjectile>().Fire(Muzzle.forward, ((AttachableFirearm)m_weapon).OverrideFA);
				((FVRInteractiveObject)m_weapon.RamRod).GameObject.SetActive(false);
				m_weapon.RamRod.MountToBarrel(null, null);
			}
			for (int i = 0; (float)i < num5; i++)
			{
				Vector3 val = Muzzle.forward * 0.005f;
				GameObject val2 = IgniteProjectile_Visible;
				if (numProjectilesInBarrel > 0)
				{
					val2 = IgniteProjectile_NotVisible;
				}
				GameObject val3 = Object.Instantiate<GameObject>(val2, Muzzle.position - val, Muzzle.rotation);
				val3.transform.Rotate(new Vector3(Random.Range((0f - spread) * 2f, spread * 2f), Random.Range((0f - spread) * 2f, spread * 2f), 0f));
				BallisticProjectile component = val3.GetComponent<BallisticProjectile>();
				component.Fire(component.MuzzleVelocityBase, val3.transform.forward, ((AttachableFirearm)m_weapon).OverrideFA, true);
			}
			if (flag)
			{
				((AttachableFirearm)m_weapon).PlayAudioGunShot(true, (FVRTailSoundClass)8, (FVRTailSoundClass)7, GM.CurrentPlayerBody.GetCurrentSoundEnvironment());
			}
			else if (numProjectilesInBarrel > 0)
			{
				((AttachableFirearm)m_weapon).PlayAudioGunShot(true, (FVRTailSoundClass)4, (FVRTailSoundClass)7, GM.CurrentPlayerBody.GetCurrentSoundEnvironment());
			}
			else
			{
				((AttachableFirearm)m_weapon).PlayAudioGunShot(true, (FVRTailSoundClass)13, (FVRTailSoundClass)7, GM.CurrentPlayerBody.GetCurrentSoundEnvironment());
			}
			float num7 = 1f - GetMinProjPos() / BarrelLength;
			float num8 = 1f - GetMaxProjPos() / BarrelLength;
			float num9 = 1f * Random.Range(num7, num8);
			spread += num9;
			for (int j = 0; j < numProjectilesInBarrel; j++)
			{
				Vector3 val4 = Muzzle.forward * 0.005f;
				GameObject val5 = Object.Instantiate<GameObject>(ProjectilePrefab, Muzzle.position - val4, Muzzle.rotation);
				val5.transform.Rotate(new Vector3(Random.Range(0f - spread, spread), Random.Range(0f - spread, spread), 0f));
				BallisticProjectile component2 = val5.GetComponent<BallisticProjectile>();
				component2.Fire(component2.MuzzleVelocityBase * num3 * VelocityMult, val5.transform.forward, ((AttachableFirearm)m_weapon).OverrideFA, true);
			}
			ClearBarrel();
			if (flag2)
			{
				((FVRInteractiveObject)((AttachableFirearm)m_weapon).Attachment).ForceBreakInteraction();
				((FVRPhysicalObject)((AttachableFirearm)m_weapon).Attachment).RootRigidbody.velocity = ((Component)m_weapon).transform.forward * -8f + ((Component)m_weapon).transform.up * 1f;
				((FVRPhysicalObject)((AttachableFirearm)m_weapon).Attachment).RootRigidbody.angularVelocity = ((Component)m_weapon).transform.right * -5f;
			}
			if (flag)
			{
				m_weapon.Blowup();
			}
			m_isIgnited = false;
		}

		private void ClearBarrel()
		{
			LoadedElements.Clear();
		}

		private void BarrelContentsSim()
		{
			//IL_0006: 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_01c5: 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_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Angle(Muzzle.forward, Vector3.up);
			if (num > 90f)
			{
				if (LoadedElements.Count <= 0)
				{
					return;
				}
				for (int num2 = LoadedElements.Count - 1; num2 >= 0; num2--)
				{
					if ((int)LoadedElements[num2].Type == 0)
					{
						float num3 = 0f;
						float num4 = BarrelLength;
						bool flag = true;
						if (num2 + 1 < LoadedElements.Count)
						{
							num3 = LoadedElements[num2 + 1].Position + GetLengthOfElement(LoadedElements[num2 + 1].Type, LoadedElements[num2 + 1].PowderAmount);
							flag = false;
						}
						if (num2 - 1 >= 0)
						{
							num4 = LoadedElements[num2 - 1].Position;
						}
						float position = LoadedElements[num2].Position;
						float num5 = (num - 90f) / 90f * 2f;
						float num6 = position - num5 * Time.deltaTime;
						if (flag && num6 <= 0f)
						{
							int num7 = ExpellElement(LoadedElements[num2].Type, LoadedElements[num2].PowderAmount);
							if (num7 <= 0)
							{
								LoadedElements.RemoveAt(num2);
							}
							else
							{
								LoadedElements[num2].PowderAmount = num7;
							}
						}
						else
						{
							num6 = Mathf.Clamp(num6, num3, num4);
							LoadedElements[num2].Position = num6;
						}
					}
				}
			}
			else
			{
				if (LoadedElements.Count <= 0)
				{
					return;
				}
				for (int num8 = LoadedElements.Count - 1; num8 >= 0; num8--)
				{
					if ((int)LoadedElements[num8].Type == 0)
					{
						float num9 = 0f;
						float num10 = BarrelLength - GetLengthOfElement(LoadedElements[num8].Type, LoadedElements[num8].PowderAmount);
						if (num8 + 1 < LoadedElements.Count)
						{
							num9 = LoadedElements[num8 + 1].Position + GetLengthOfElement(LoadedElements[num8 + 1].Type, LoadedElements[num8 + 1].PowderAmount);
						}
						if (num8 - 1 >= 0)
						{
							num10 = LoadedElements[num8 - 1].Position;
						}
						float position2 = LoadedElements[num8].Position;
						float num11 = (1f - num / 90f) * 2f;
						float num12 = position2 + num11 * Time.deltaTime;
						num12 = Mathf.Clamp(num12, num9, num10);
						LoadedElements[num8].Position = num12;
					}
				}
			}
		}

		private void BarrelContentsDraw()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Invalid comparison between Unknown and I4
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: 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_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Invalid comparison between Unknown and I4
			//IL_0478: 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_00e4: Invalid comparison between Unknown and I4
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Invalid comparison between Unknown and I4
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Invalid comparison between Unknown and I4
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Invalid comparison between Unknown and I4
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			if (LoadedElements.Count > 1)
			{
				int index = LoadedElements.Count - 1;
				int index2 = LoadedElements.Count - 2;
				for (int i = 0; i < ProxyRends0.Count; i++)
				{
					if ((int)LoadedElements[index].Type == i)
					{
						ProxyRends0[i].enabled = true;
						((Component)ProxyRends0[i]).transform.position = Muzzle.position - Muzzle.forward * LoadedElements[index].Position;
						if ((int)LoadedElements[index].Type != 0 && LoadedElements[index].Position < 0.01f)
						{
							if ((int)LoadedElements[index].Type == 1)
							{
								((Component)ProxyRends0[i]).transform.position = LodgePoint_Shot.position;
							}
							else if ((int)LoadedElements[index].Type == 2)
							{
								((Component)ProxyRends0[i]).transform.position = LodgePoint_Paper.position;
							}
						}
						if ((int)LoadedElements[index].Type == 0)
						{
							int powderAmount = LoadedElements[index].PowderAmount;
							if (powderAmount > 15)
							{
								ProxyPowder0.mesh = ProxyPowderPiles[3];
							}
							else if (powderAmount > 9)
							{
								ProxyPowder0.mesh = ProxyPowderPiles[2];
							}
							else if (powderAmount > 4)
							{
								ProxyPowder0.mesh = ProxyPowderPiles[1];
							}
							else
							{
								ProxyPowder0.mesh = ProxyPowderPiles[0];
							}
						}
					}
					else
					{
						ProxyRends0[i].enabled = false;
					}
				}
				for (int j = 0; j < ProxyRends1.Count; j++)
				{
					if ((int)LoadedElements[index2].Type == j)
					{
						ProxyRends1[j].enabled = true;
						((Component)ProxyRends1[j]).transform.position = Muzzle.position - Muzzle.forward * LoadedElements[index2].Position;
						if ((int)LoadedElements[index2].Type == 0)
						{
							int powderAmount2 = LoadedElements[index2].PowderAmount;
							if (powderAmount2 > 15)
							{
								ProxyPowder1.mesh = ProxyPowderPiles[3];
							}
							else if (powderAmount2 > 9)
							{
								ProxyPowder1.mesh = ProxyPowderPiles[2];
							}
							else if (powderAmount2 > 4)
							{
								ProxyPowder1.mesh = ProxyPowderPiles[1];
							}
							else
							{
								ProxyPowder1.mesh = ProxyPowderPiles[0];
							}
						}
					}
					else
					{
						ProxyRends1[j].enabled = false;
					}
				}
			}
			else if (LoadedElements.Count > 0)
			{
				for (int k = 0; k < ProxyRends0.Count; k++)
				{
					if ((int)LoadedElements[0].Type == k)
					{
						ProxyRends0[k].enabled = true;
						((Component)ProxyRends0[k]).transform.position = Muzzle.position - Muzzle.forward * LoadedElements[0].Position;
						if ((int)LoadedElements[0].Type != 0 && LoadedElements[0].Position < 0.01f)
						{
							if ((int)LoadedElements[0].Type == 1)
							{
								((Component)ProxyRends0[k]).transform.position = LodgePoint_Shot.position;
							}
							else if ((int)LoadedElements[0].Type == 2)
							{
								((Component)ProxyRends0[k]).transform.position = LodgePoint_Paper.position;
							}
						}
						if ((int)LoadedElements[0].Type == 0)
						{
							int powderAmount3 = LoadedElements[0].PowderAmount;
							if (powderAmount3 > 15)
							{
								ProxyPowder0.mesh = ProxyPowderPiles[3];
							}
							else if (powderAmount3 > 9)
							{
								ProxyPowder0.mesh = ProxyPowderPiles[2];
							}
							else if (powderAmount3 > 4)
							{
								ProxyPowder0.mesh = ProxyPowderPiles[1];
							}
							else
							{
								ProxyPowder0.mesh = ProxyPowderPiles[0];
							}
						}
					}
					else
					{
						ProxyRends0[k].enabled = false;
					}
				}
				for (int l = 0; l < ProxyRends1.Count; l++)
				{
					ProxyRends1[l].enabled = false;
				}
			}
			else
			{
				for (int m = 0; m < ProxyRends0.Count; m++)
				{
					ProxyRends0[m].enabled = false;
				}
				for (int n = 0; n < ProxyRends1.Count; n++)
				{
					ProxyRends1[n].enabled = false;
				}
			}
		}
	}
	public class AttachableFlintlockDamagableSensor : MonoBehaviour, IFVRDamageable
	{
		public AttachableFlintlockFlashPan Pan;

		public AttachableFlintlockBarrel Barrel;

		public void Damage(Damage d)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			if (d.Dam_Thermal > 1f)
			{
				if ((Object)(object)Pan != (Object)null && (int)Pan.FrizenState == 1)
				{
					Pan.Ignite();
				}
				if ((Object)(object)Barrel != (Object)null)
				{
					Barrel.BurnOffOuter();
				}
			}
		}
	}
	public class AttachableFlintlockFlashPan : MonoBehaviour, IFVRDamageable
	{
		public AttachableFlintlockWeapon m_weapon;

		[Header("Frizen")]
		public Transform Frizen;

		public Vector2 FrizenRots = new Vector2(0f, 45f);

		public FState FrizenState = (FState)1;

		[Header("VFX")]
		public GameObject GrainPrefab;

		public Transform GrainSpawnPoint;

		public List<Renderer> GrainPileGeo;

		public ParticleSystem Flash_Fire;

		public ParticleSystem Flash_Smoke;

		public ParticleSystem Shot_Fire;

		public ParticleSystem Shot_Smoke;

		[Header("Audio")]
		public AudioEvent AudEvent_FrizenUp;

		public AudioEvent AudEvent_FrizenDown;

		public AudioEvent AudEvent_FlashpanIgnite;

		public AudioEvent AudEvent_PowderLandOnFlashpan;

		[Header("Barrels")]
		public List<AttachableFlintlockBarrel> Barrels = new List<AttachableFlintlockBarrel>();

		private float numGrainsPowderOn;

		private bool m_isIgnited;

		private float timeSinceSpawn;

		private void AddGrain()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			numGrainsPowderOn += 1f;
			SetGrainPileGeo(Mathf.CeilToInt(numGrainsPowderOn));
			((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_PowderLandOnFlashpan, Frizen.position);
		}

		public void ClearPan()
		{
			numGrainsPowderOn = 0f;
			SetGrainPileGeo(-1);
		}

		public void Damage(Damage d)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			if ((int)FrizenState == 1 && (d.Dam_Thermal > 0f || (int)d.Class == 1))
			{
				Ignite();
			}
		}

		private void FireBarrels()
		{
			for (int i = 0; i < Barrels.Count; i++)
			{
				Barrels[i].Ignite();
			}
		}

		public void FlashBlast(int x, int y)
		{
			Shot_Fire.Emit(x);
			Shot_Smoke.Emit(y);
		}

		public float GetPanContents()
		{
			return numGrainsPowderOn;
		}

		public AttachableFlintlockWeapon GetWeapon()
		{
			return m_weapon;
		}

		public void HammerHit(FlintState f, bool Flint)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)FrizenState == 0 && Flint)
			{
				Ignite();
			}
			SetFrizenUp();
		}

		public void Ignite()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (numGrainsPowderOn > 0f)
			{
				m_isIgnited = true;
				((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_FlashpanIgnite, Frizen.position);
			}
		}

		private bool IsPanFull()
		{
			return numGrainsPowderOn > 4f;
		}

		public void OnTriggerEnter(Collider other)
		{
			//IL_0001: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			if ((int)FrizenState != 0 && !IsPanFull() && !((Object)(object)other.attachedRigidbody == (Object)null) && !(Vector3.Angle(((Component)this).transform.up, Vector3.up) > 70f) && ((Component)other.attachedRigidbody).gameObject.CompareTag("flintlock_powdergrain"))
			{
				AddGrain();
				Object.Destroy((Object)(object)((Component)other).gameObject);
			}
		}

		private void SetFrizenDown()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			if ((int)FrizenState != 0 && (int)m_weapon.HammerState != 0)
			{
				FrizenState = (FState)0;
				((FVRPhysicalObject)((AttachableFirearm)m_weapon).Attachment).SetAnimatedComponent(Frizen, FrizenRots.x, (InterpStyle)1, (Axis)0);
				((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_FrizenDown, Frizen.position);
			}
		}

		private void SetFrizenUp()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_000c: 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)
			if ((int)FrizenState != 1)
			{
				FrizenState = (FState)1;
				((FVRPhysicalObject)((AttachableFirearm)m_weapon).Attachment).SetAnimatedComponent(Frizen, FrizenRots.y, (InterpStyle)1, (Axis)0);
				((AttachableFirearm)m_weapon).PlayAudioAsHandling(AudEvent_FrizenUp, Frizen.position);
			}
		}

		private void SetGrainPileGeo(int g)
		{
			for (int i = 0; i < GrainPileGeo.Count; i++)
			{
				if (i == g)
				{
					GrainPileGeo[i].enabled = true;
				}
				else
				{
					GrainPileGeo[i].enabled = false;
				}
			}
		}

		public void SetWeapon(AttachableFlintlockWeapon w)
		{
			m_weapon = w;
			for (int i = 0; i < Barrels.Count; i++)
			{
				Barrels[i].SetWeapon(w);
				Barrels[i].SetPan(this);
			}
		}

		public void ToggleFrizenState()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)FrizenState == 0)
			{
				SetFrizenUp();
			}
			else
			{
				SetFrizenDown();
			}
		}

		private void Update()
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Invalid comparison between Unknown and I4
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			if (m_isIgnited)
			{
				numGrainsPowderOn -= Time.deltaTime * 20f;
				numGrainsPowderOn = Mathf.Clamp(numGrainsPowderOn, 0f, numGrainsPowderOn);
				SetGrainPileGeo(Mathf.CeilToInt(numGrainsPowderOn));
				Flash_Fire.Emit(1);
				Flash_Smoke.Emit(2);
				if (numGrainsPowderOn <= 0f)
				{
					SetGrainPileGeo(-1);
					m_isIgnited = false;
					FireBarrels();
				}
			}
			if (timeSinceSpawn < 1f)
			{
				timeSinceSpawn += Time.deltaTime;
			}
			if ((int)FrizenState == 1 && Vector3.Angle(((Component)m_weapon).transform.up, Vector3.up) > 85f && timeSinceSpawn > 0.04f && numGrainsPowderOn > 0f)
			{
				numGrainsPowderOn -= 1f;
				numGrainsPowderOn = Mathf.Clamp(numGrainsPowderOn, 0f, numGrainsPowderOn);
				if (numGrainsPowderOn <= 0f)
				{
					SetGrainPileGeo(-1);
				}
				else
				{
					SetGrainPileGeo(Mathf.CeilToInt(numGrainsPowderOn));
				}
				timeSinceSpawn = 0f;
				Object.Instantiate<GameObject>(GrainPrefab, GrainSpawnPoint.position, Random.rotation);
			}
			_ = ((FVRInteractiveObject)((AttachableFirearm)m_weapon).Attachment).IsHeld;
		}
	}
	public class AttachableFlintlockFlintHolder : FVRInteractiveObject
	{
		public AttachableFlintlockFlintScrew Screw;

		public GameObject FlintPrefab;

		public AudioEvent AudEvent_Remove;

		public AudioEvent AudEvent_Replace;

		public Transform FlintPos;

		private float TimeTilFlintReplace = 1f;

		public override bool IsInteractable()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			return (int)Screw.SState == 2;
		}

		public override void SimpleInteraction(FVRViveHand hand)
		{
			//IL_001d: 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_0025: 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)
			if (Screw.Weapon.HasFlint())
			{
				Vector3 u = Screw.Weapon.RemoveFlint();
				ExtractFlint(hand, u);
				((AttachableFirearm)Screw.Weapon).PlayAudioAsHandling(AudEvent_Remove, ((Component)this).transform.position);
			}
			((FVRInteractiveObject)this).SimpleInteraction(hand);
		}

		public override void FVRUpdate()
		{
			((FVRInteractiveObject)this).FVRUpdate();
			if (TimeTilFlintReplace > 0f)
			{
				TimeTilFlintReplace -= Time.deltaTime;
			}
		}

		private void ExtractFlint(FVRViveHand h, Vector3 u)
		{
			//IL_0017: 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_0033: 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)
			TimeTilFlintReplace = 1f;
			FlintlockFlint component = Object.Instantiate<GameObject>(FlintPrefab, FlintPos.position, FlintPos.rotation).GetComponent<FlintlockFlint>();
			component.m_flintUses = u;
			component.UpdateState();
			h.ForceSetInteractable((FVRInteractiveObject)(object)component);
			((FVRInteractiveObject)component).BeginInteraction(h);
		}

		public void OnTriggerEnter(Collider other)
		{
			//IL_005c: 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)
			if (!(TimeTilFlintReplace > 0f) && !Screw.Weapon.HasFlint() && !((Object)(object)other.attachedRigidbody == (Object)null))
			{
				GameObject gameObject = ((Component)other.attachedRigidbody).gameObject;
				if (gameObject.CompareTag("flintlock_flint"))
				{
					FlintlockFlint component = gameObject.GetComponent<FlintlockFlint>();
					Screw.Weapon.AddFlint(component.m_flintUses);
					((AttachableFirearm)Screw.Weapon).PlayAudioAsHandling(AudEvent_Replace, ((Component)this).transform.position);
					Object.Destroy((Object)(object)((Component)other).gameObject);
				}
			}
		}
	}
	public class AttachableFlintlockFlintScrew : FVRInteractiveObject
	{
		public AttachableFlintlockWeapon Weapon;

		public Transform Screw;

		public ScrewState SState;

		private float lerp;

		public Vector2 Heights = new Vector2(0.05455612f, 0.06048f);

		public AudioEvent AudEvent_Screw;

		public AudioEvent AudEvent_Unscrew;

		public override void SimpleInteraction(FVRViveHand hand)
		{
			((FVRInteractiveObject)this).SimpleInteraction(hand);
			ToggleScrewState();
		}

		public override bool IsInteractable()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			if ((int)SState != 1 && (int)SState != 3)
			{
				return ((FVRInteractiveObject)this).IsInteractable();
			}
			return false;
		}

		private void ToggleScrewState()
		{
			//IL_0001: 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_003f: Invalid comparison between Unknown and I4
			//IL_001a: 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_0053: 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)
			if ((int)SState == 0)
			{
				((AttachableFirearm)Weapon).PlayAudioAsHandling(AudEvent_Unscrew, ((Component)this).transform.position);
				SState = (ScrewState)3;
				lerp = 0f;
			}
			else if ((int)SState == 2)
			{
				((AttachableFirearm)Weapon).PlayAudioAsHandling(AudEvent_Screw, ((Component)this).transform.position);
				SState = (ScrewState)1;
				lerp = 0f;
			}
		}

		public override void FVRUpdate()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Invalid comparison between Unknown and I4
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: 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_0175: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).FVRUpdate();
			if ((int)SState == 1)
			{
				lerp += Time.deltaTime * 1.4f;
				Screw.localPosition = new Vector3(Screw.localPosition.x, Mathf.Lerp(Heights.y, Heights.x, lerp), Screw.localPosition.z);
				Screw.localEulerAngles = new Vector3(90f, Mathf.Lerp(0f, 720f, lerp), 0f);
				if (lerp >= 1f)
				{
					SState = (ScrewState)0;
				}
			}
			else if ((int)SState == 3)
			{
				lerp += Time.deltaTime * 1.4f;
				Screw.localPosition = new Vector3(Screw.localPosition.x, Mathf.Lerp(Heights.x, Heights.y, lerp), Screw.localPosition.z);
				Screw.localEulerAngles = new Vector3(90f, Mathf.Lerp(720f, 0f, lerp), 0f);
				if (lerp >= 1f)
				{
					SState = (ScrewState)2;
				}
			}
		}
	}
	public class AttachableFlintlockFrizenTrigger : FVRInteractiveObject
	{
		public AttachableFlintlockFlashPan FlashPan;

		public Transform DistPoint;

		public override bool IsInteractable()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			return (int)FlashPan.GetWeapon().HammerState > 0;
		}

		public override void SimpleInteraction(FVRViveHand hand)
		{
			FlashPan.ToggleFrizenState();
			((FVRInteractiveObject)this).SimpleInteraction(hand);
		}

		public override void FVRUpdate()
		{
			//IL_0042: 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_0058: 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_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_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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Invalid comparison between Unknown and I4
			//IL_00c3: 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)
			((FVRInteractiveObject)this).FVRUpdate();
			if (!((FVRInteractiveObject)((AttachableFirearm)FlashPan.GetWeapon()).Attachment).IsHeld)
			{
				return;
			}
			FVRViveHand otherHand = ((FVRInteractiveObject)((AttachableFirearm)FlashPan.GetWeapon()).Attachment).m_hand.OtherHand;
			Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(((HandInput)(ref otherHand.Input)).Pos, otherHand.PalmTransform.position, DistPoint.position);
			if (!(Vector3.Distance(DistPoint.position, closestValidPoint) < 0.045f))
			{
				return;
			}
			Vector3 val = ((Component)FlashPan.GetWeapon()).transform.InverseTransformVector(otherHand.Input.VelLinearWorld);
			if ((int)FlashPan.FrizenState == 1)
			{
				if (val.z < -0.5f)
				{
					FlashPan.ToggleFrizenState();
				}
			}
			else if (val.z > 0.5f)
			{
				FlashPan.ToggleFrizenState();
			}
		}
	}
	public class AttachableFlintlockPseudoRamRod : FVRInteractiveObject
	{
		public Transform Root;

		public RamRodState RState;

		public Transform Point_Lower_Rear;

		public Transform Point_Lower_Forward;

		private float lastHandZ;

		private float m_ramZ;

		private float m_minZ_lower;

		private float m_maxZ_lower;

		public GameObject RamRodPrefab;

		private float m_minZ_barrel;

		private float m_maxZ_barrel;

		private AttachableFlintlockBarrel m_curBarrel;

		[Header("Audio")]
		public AudioEvent AudEvent_Grab;

		public AudioEvent AudEvent_ExtractHolder;

		public AudioEvent AudEvent_ExtractBarrel;

		public AudioEvent AudEvent_InsertHolder;

		public AudioEvent AudEvent_InsertBarrel;

		private float m_curHandRodOffsetZ;

		public AttachableFlintlockBarrel GetCurBarrel()
		{
			return m_curBarrel;
		}

		public override void Awake()
		{
			//IL_000d: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).Awake();
			m_ramZ = ((Component)this).transform.localPosition.z;
			m_minZ_lower = Point_Lower_Rear.localPosition.z;
			m_maxZ_lower = Point_Lower_Forward.localPosition.z;
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			//IL_0007: 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_000e: 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_0049: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).BeginInteraction(hand);
			Vector3 zero = Vector3.zero;
			zero = (((int)RState != 0) ? m_curBarrel.Muzzle.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos) : Root.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos));
			SM.PlayGenericSound(AudEvent_Grab, ((Component)this).transform.position);
			lastHandZ = zero.z;
			m_curHandRodOffsetZ = ((Component)this).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z;
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0007: 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_000e: 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_0049: 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_002b: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).UpdateInteraction(hand);
			Vector3 zero = Vector3.zero;
			zero = (((int)RState != 0) ? m_curBarrel.Muzzle.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos) : Root.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos));
			float z = zero.z;
			float num = z - lastHandZ;
			num = ((Component)this).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z - m_curHandRodOffsetZ;
			MoveRamRod(num, hand);
			lastHandZ = z;
		}

		public void MountToUnder(FVRViveHand h)
		{
			//IL_0013: 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_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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.SetParent(Root);
			RState = (RamRodState)0;
			m_ramZ = m_maxZ_lower - 0.002f;
			SM.PlayGenericSound(AudEvent_InsertHolder, ((Component)this).transform.position);
			((Component)this).transform.localPosition = new Vector3(Point_Lower_Rear.localPosition.x, Point_Lower_Rear.localPosition.y, m_ramZ);
			m_curHandRodOffsetZ = ((Component)this).transform.InverseTransformPoint(((HandInput)(ref h.Input)).Pos).z;
		}

		public void MountToBarrel(AttachableFlintlockBarrel b, FVRViveHand h)
		{
			//IL_0064: 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_008a: 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_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)
			if ((Object)(object)b == (Object)null)
			{
				m_curBarrel = null;
				((Component)this).gameObject.SetActive(false);
				return;
			}
			((Component)this).transform.SetParent(b.Muzzle);
			m_maxZ_barrel = 0.01f;
			m_minZ_barrel = 0f - b.BarrelLength;
			m_curBarrel = b;
			m_ramZ = -0.02f;
			SM.PlayGenericSound(AudEvent_InsertBarrel, ((Component)this).transform.position);
			((Component)this).transform.localPosition = new Vector3(Point_Lower_Rear.localPosition.x, Point_Lower_Rear.localPosition.y, m_ramZ);
			if ((Object)(object)h != (Object)null)
			{
				m_curHandRodOffsetZ = ((Component)this).transform.InverseTransformPoint(((HandInput)(ref h.Input)).Pos).z;
			}
		}

		private void MoveRamRod(float delta, FVRViveHand hand)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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)
			if ((int)RState == 0)
			{
				float ramZ = m_ramZ;
				m_ramZ += delta;
				m_ramZ = Mathf.Clamp(m_ramZ, m_minZ_lower, m_ramZ);
				_ = m_ramZ;
				((Component)this).transform.localPosition = new Vector3(Point_Lower_Rear.localPosition.x, Point_Lower_Rear.localPosition.y, m_ramZ);
				if (m_ramZ >= m_maxZ_lower)
				{
					GameObject obj = Object.Instantiate<GameObject>(RamRodPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation);
					((FVRInteractiveObject)this).ForceBreakInteraction();
					FlintlockRamRod component = obj.GetComponent<FlintlockRamRod>();
					hand.ForceSetInteractable((FVRInteractiveObject)(object)component);
					((FVRInteractiveObject)component).BeginInteraction(hand);
					SM.PlayGenericSound(AudEvent_ExtractHolder, ((Component)this).transform.position);
					Hide();
				}
				return;
			}
			m_ramZ += delta;
			float num = Mathf.Clamp(m_ramZ, 0f - m_curBarrel.GetMaxDepth(), m_ramZ);
			((Component)this).transform.localPosition = new Vector3(0f, 0f, num);
			if (m_ramZ < num)
			{
				m_curBarrel.Tamp((m_ramZ - num) * 1f, m_ramZ);
			}
			if (m_ramZ >= 0f)
			{
				GameObject obj2 = Object.Instantiate<GameObject>(RamRodPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation);
				((FVRInteractiveObject)this).ForceBreakInteraction();
				FlintlockRamRod component2 = obj2.GetComponent<FlintlockRamRod>();
				hand.ForceSetInteractable((FVRInteractiveObject)(object)component2);
				((FVRInteractiveObject)component2).BeginInteraction(hand);
				SM.PlayGenericSound(AudEvent_ExtractBarrel, ((Component)this).transform.position);
				m_curBarrel = null;
				Hide();
			}
			m_ramZ = num;
		}

		private void Hide()
		{
			((Component)this).gameObject.SetActive(false);
		}
	}
	public class AttachableFlintlockRamRodHolder : MonoBehaviour
	{
		public AttachableFlintlockWeapon Weapon;

		public void OnTriggerEnter(Collider other)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)other.attachedRigidbody == (Object)null)
			{
				return;
			}
			GameObject gameObject = ((Component)other.attachedRigidbody).gameObject;
			if (gameObject.CompareTag("flintlock_ramrod"))
			{
				FlintlockRamRod component = gameObject.GetComponent<FlintlockRamRod>();
				if (((FVRInteractiveObject)component).IsHeld)
				{
					FVRViveHand hand = ((FVRInteractiveObject)component).m_hand;
					((FVRInteractiveObject)component).ForceBreakInteraction();
					((Component)Weapon.RamRod).gameObject.SetActive(true);
					Weapon.RamRod.RState = (RamRodState)0;
					Weapon.RamRod.MountToUnder(hand);
					hand.ForceSetInteractable((FVRInteractiveObject)(object)Weapon.RamRod);
					((FVRInteractiveObject)Weapon.RamRod).BeginInteraction(hand);
					Object.Destroy((Object)(object)((Component)other).gameObject);
				}
			}
		}
	}
	public class AttachableFlintlockWeapon : AttachableFirearm
	{
		[Header("Flintlock")]
		public List<AttachableFlintlockFlashPan> FlashPans = new List<AttachableFlintlockFlashPan>();

		private int m_curFlashPan;

		public AttachableFlintlockPseudoRamRod RamRod;

		[Header("Trigger")]
		public Transform Trigger;

		public Vector2 TriggerRots = new Vector2(0f, 5f);

		private float m_triggerFloat;

		private float m_lastTriggerFloat;

		[Header("Hammer")]
		public Transform Hammer;

		public HState HammerState;

		public Vector3 HammerRots = new Vector3(0f, 20f, 45f);

		private float m_curHammerRot;

		private float m_tarHammerRot;

		[Header("Flint")]
		public FlintState FState;

		private Vector3 m_flintUses = Vector3.one;

		private bool m_hasFlint = true;

		public MeshFilter FlintMesh;

		public MeshRenderer FlintRenderer;

		public List<Mesh> FlintMeshes = new List<Mesh>();

		public AttachableFlintlockFlintScrew FlintlockScrew;

		public AttachableFlintlockFlintHolder FlintlockFlintHolder;

		public ParticleSystem Sparks;

		[Header("Audio")]
		public AudioEvent AudEvent_HammerCock;

		public AudioEvent AudEvent_HammerHalfCock;

		public AudioEvent AudEvent_HammerHit_Clean;

		public AudioEvent AudEvent_HammerHit_Dull;

		public AudioEvent AudEvent_Spark;

		public AudioEvent AudEvent_FlintBreak;

		public AudioEvent AudEvent_FlintHolderScrew;

		public AudioEvent AudEvent_FlintHolderUnscrew;

		public AudioEvent AudEvent_FlintRemove;

		public AudioEvent AudEvent_FlintReplace;

		[Header("Destruction")]
		public List<GameObject> DisableOnDestroy = new List<GameObject>();

		public List<GameObject> EnableOnDestroy = new List<GameObject>();

		public bool m_isDestroyed;

		public List<GameObject> SpawnOnDestroy = new List<GameObject>();

		public Transform SpawnOnDestroyPoint;

		public GameObject RamRodProj;

		private float FireReFire = 0.2f;

		public override void Awake()
		{
			//IL_0049: 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)
			((AttachableFirearm)this).Awake();
			for (int i = 0; i < FlashPans.Count; i++)
			{
				FlashPans[i].SetWeapon(this);
			}
			m_flintUses = new Vector3((float)Random.Range(8, 15), (float)Random.Range(5, 9), (float)Random.Range(4, 8));
		}

		public bool HasFlint()
		{
			return m_hasFlint;
		}

		public void AddFlint(Vector3 uses)
		{
			//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)
			m_hasFlint = true;
			m_flintUses = uses;
			((Renderer)FlintRenderer).enabled = true;
			if (m_flintUses.x > 0f)
			{
				SetFlintState((FlintState)0);
			}
			else if (m_flintUses.y > 0f)
			{
				SetFlintState((FlintState)1);
			}
			else if (m_flintUses.z > 0f)
			{
				SetFlintState((FlintState)2);
			}
			else
			{
				SetFlintState((FlintState)3);
			}
		}

		public Vector3 RemoveFlint()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			m_hasFlint = false;
			((Renderer)FlintRenderer).enabled = false;
			return m_flintUses;
		}

		private void SetFlintState(FlintState state)
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected I4, but got Unknown
			FState = state;
			FlintMesh.mesh = FlintMeshes[(int)state];
		}

		public void Blowup()
		{
			//IL_0076: 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)
			if (!m_isDestroyed)
			{
				m_isDestroyed = true;
				for (int i = 0; i < DisableOnDestroy.Count; i++)
				{
					DisableOnDestroy[i].SetActive(false);
				}
				for (int j = 0; j < DisableOnDestroy.Count; j++)
				{
					EnableOnDestroy[j].SetActive(true);
				}
				for (int k = 0; k < DisableOnDestroy.Count; k++)
				{
					Object.Instantiate<GameObject>(SpawnOnDestroy[k], SpawnOnDestroyPoint.position, SpawnOnDestroyPoint.rotation);
				}
			}
		}

		public void Fire(float recoilMult = 1f)
		{
			if (FireReFire < 0.1f)
			{
				return;
			}
			FireReFire = 0f;
			FVRViveHand hand = ((FVRInteractiveObject)base.Attachment).m_hand;
			if ((Object)(object)hand != (Object)null)
			{
				hand.Buzz(hand.Buzzer.Buzz_GunShot);
				if ((Object)(object)((FVRInteractiveObject)((FVRFireArmAttachment)base.Attachment).curMount.Parent).m_hand != (Object)null && (Object)(object)((FVRFireArmAttachment)base.Attachment).curMount.Parent != (Object)null)
				{
					((FVRInteractiveObject)((FVRFireArmAttachment)base.Attachment).curMount.Parent).m_hand.Buzz(((FVRInteractiveObject)((FVRFireArmAttachment)base.Attachment).curMount.Parent).m_hand.Buzzer.Buzz_GunShot);
				}
			}
			if (((AttachableFirearm)this).IsSuppressed())
			{
				GM.CurrentPlayerBody.VisibleEvent(0.1f);
			}
			else
			{
				GM.CurrentPlayerBody.VisibleEvent(2f);
			}
			FVRFireArm val = null;
			if ((Object)(object)base.OverrideFA != (Object)null)
			{
				val = base.OverrideFA;
				GM.CurrentSceneSettings.OnShotFired(val);
				((AttachableFirearm)this).Recoil(true, val);
			}
		}

		public override void ProcessInput(FVRViveHand hand, bool fromInterface, FVRInteractiveObject o)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Invalid comparison between Unknown and I4
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Invalid comparison between Unknown and I4
			((AttachableFirearm)this).ProcessInput(hand, fromInterface, o);
			if (o.m_hasTriggeredUpSinceBegin)
			{
				m_triggerFloat = hand.Input.TriggerFloat;
			}
			else
			{
				m_triggerFloat = 0f;
			}
			if (m_isDestroyed || !o.m_hasTriggeredUpSinceBegin)
			{
				return;
			}
			if (hand.IsInStreamlinedMode)
			{
				if (hand.Input.BYButtonDown)
				{
					if ((int)HammerState == 0)
					{
						MoveToHalfCock();
					}
					else if ((int)HammerState == 1)
					{
						MoveToFullCock();
					}
				}
			}
			else if (hand.Input.TouchpadDown && (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f || Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f))
			{
				if ((int)HammerState == 0)
				{
					MoveToHalfCock();
				}
				else if ((int)HammerState == 1)
				{
					MoveToFullCock();
				}
			}
		}

		private void MoveToFullCock()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_000c: 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)
			if ((int)HammerState != 2)
			{
				HammerState = (HState)2;
				m_tarHammerRot = HammerRots.z;
				((AttachableFirearm)this).PlayAudioAsHandling(AudEvent_HammerCock, Hammer.position);
			}
		}

		private void MoveToHalfCock()
		{
			//IL_0001: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			if ((int)HammerState == 0)
			{
				HammerState = (HState)1;
				m_tarHammerRot = HammerRots.y;
				((AttachableFirearm)this).PlayAudioAsHandling(AudEvent_HammerHalfCock, Hammer.position);
			}
		}

		public override void Update()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Invalid comparison between Unknown and I4
			((AttachableFirearm)this).Update();
			if (FireReFire < 0.2f)
			{
				FireReFire += Time.deltaTime;
			}
			if (m_triggerFloat != m_lastTriggerFloat)
			{
				m_lastTriggerFloat = m_triggerFloat;
			}
			((FVRPhysicalObject)base.Attachment).SetAnimatedComponent(Trigger, Mathf.Lerp(TriggerRots.x, TriggerRots.y, m_triggerFloat), (InterpStyle)1, (Axis)0);
			if (m_isDestroyed)
			{
				return;
			}
			if (m_curHammerRot != m_tarHammerRot)
			{
				float num = 7200f;
				if ((int)HammerState == 1 || (int)HammerState == 2)
				{
					num = 360f;
				}
				m_curHammerRot = Mathf.MoveTowards(m_curHammerRot, m_tarHammerRot, Time.deltaTime * num);
				((FVRPhysicalObject)base.Attachment).SetAnimatedComponent(Hammer, m_curHammerRot, (InterpStyle)1, (Axis)0);
			}
			if (m_triggerFloat > 0.7f && (int)HammerState == 2)
			{
				ReleaseHammer();
			}
		}

		private void ReleaseHammer()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0091: 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)
			if ((int)HammerState != 2)
			{
				return;
			}
			HammerState = (HState)0;
			m_tarHammerRot = HammerRots.x;
			if (HitWithFlint())
			{
				((AttachableFirearm)this).PlayAudioAsHandling(AudEvent_HammerHit_Clean, Hammer.position);
				if ((int)FlashPans[m_curFlashPan].FrizenState == 0)
				{
					((AttachableFirearm)this).PlayAudioAsHandling(AudEvent_Spark, Hammer.position);
					Sparks.Emit(15);
				}
				FlashPans[m_curFlashPan].HammerHit(FState, Flint: true);
			}
			else
			{
				FlashPans[m_curFlashPan].HammerHit(FState, Flint: false);
				((AttachableFirearm)this).PlayAudioAsHandling(AudEvent_HammerHit_Dull, Hammer.position);
			}
		}

		private bool HitWithFlint()
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected I4, but got Unknown
			//IL_0066: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			if (!m_hasFlint)
			{
				return false;
			}
			FlintState fState = FState;
			switch ((int)fState)
			{
			case 0:
				m_flintUses.x -= 1f;
				if (m_flintUses.x <= 0f)
				{
					SetFlintState((FlintState)1);
					((AttachableFirearm)this).PlayAudioAsHandling(AudEvent_FlintBreak, Hammer.position);
				}
				return true;
			case 1:
				m_flintUses.y -= 1f;
				if (m_flintUses.y <= 0f)
				{
					SetFlintState((FlintState)2);
					((AttachableFirearm)this).PlayAudioAsHandling(AudEvent_FlintBreak, Hammer.position);
				}
				return true;
			case 2:
				m_flintUses.z -= 1f;
				if (m_flintUses.z <= 0f)
				{
					SetFlintState((FlintState)3);
					((AttachableFirearm)this).PlayAudioAsHandling(AudEvent_FlintBreak, Hammer.position);
				}
				return true;
			case 3:
				return false;
			default:
				return false;
			}
		}

		[ContextMenu("Copy Existing Weapon Components")]
		public void CopyFromHierarchy()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: 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_05f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Copying Flintlock Components...");
			FlintlockWeapon val = ((Component)this).GetComponents<FlintlockWeapon>().Single((FlintlockWeapon c) => (Object)(object)c != (Object)(object)this);
			Debug.Log((object)"Copying Flashpans...");
			foreach (FlintlockFlashPan flashPan in val.FlashPans)
			{
				AttachableFlintlockFlashPan attachableFlintlockFlashPan = ((Component)flashPan).gameObject.AddComponent<AttachableFlintlockFlashPan>();
				if ((Object)(object)flashPan.Frizen != (Object)null)
				{
					attachableFlintlockFlashPan.Frizen = flashPan.Frizen;
				}
				_ = flashPan.FrizenRots;
				attachableFlintlockFlashPan.FrizenRots = flashPan.FrizenRots;
				attachableFlintlockFlashPan.FrizenState = flashPan.FrizenState;
				FlintlockFrizenTrigger component = ((Component)flashPan.Frizen).gameObject.GetComponent<FlintlockFrizenTrigger>();
				AttachableFlintlockFrizenTrigger attachableFlintlockFrizenTrigger = ((Component)component).gameObject.AddComponent<AttachableFlintlockFrizenTrigger>();
				((FVRInteractiveObject)attachableFlintlockFrizenTrigger).IsSimpleInteract = true;
				attachableFlintlockFrizenTrigger.FlashPan = attachableFlintlockFlashPan;
				attachableFlintlockFrizenTrigger.DistPoint = component.DistPoint;
				if ((Object)(object)flashPan.GrainPrefab != (Object)null)
				{
					attachableFlintlockFlashPan.GrainPrefab = flashPan.GrainPrefab;
				}
				if (flashPan.GrainPileGeo != null)
				{
					attachableFlintlockFlashPan.GrainPileGeo = flashPan.GrainPileGeo;
				}
				if ((Object)(object)flashPan.Flash_Fire != (Object)null)
				{
					attachableFlintlockFlashPan.Flash_Fire = flashPan.Flash_Fire;
				}
				if ((Object)(object)flashPan.Flash_Smoke != (Object)null)
				{
					attachableFlintlockFlashPan.Flash_Smoke = flashPan.Flash_Smoke;
				}
				if ((Object)(object)flashPan.Shot_Fire != (Object)null)
				{
					attachableFlintlockFlashPan.Shot_Fire = flashPan.Shot_Fire;
				}
				if ((Object)(object)flashPan.Shot_Smoke != (Object)null)
				{
					attachableFlintlockFlashPan.Shot_Smoke = flashPan.Shot_Smoke;
				}
				attachableFlintlockFlashPan.AudEvent_FrizenUp = flashPan.AudEvent_FrizenUp;
				attachableFlintlockFlashPan.AudEvent_FrizenDown = flashPan.AudEvent_FrizenDown;
				attachableFlintlockFlashPan.AudEvent_FlashpanIgnite = flashPan.AudEvent_FlashpanIgnite;
				attachableFlintlockFlashPan.AudEvent_PowderLandOnFlashpan = flashPan.AudEvent_PowderLandOnFlashpan;
				if (flashPan.Barrels != null)
				{
					foreach (FlintlockBarrel barrel in flashPan.Barrels)
					{
						Debug.Log((object)"Copying Barrel...");
						AttachableFlintlockBarrel attachableFlintlockBarrel = ((Component)barrel).gameObject.AddComponent<AttachableFlintlockBarrel>();
						attachableFlintlockBarrel.Muzzle = barrel.Muzzle;
						attachableFlintlockBarrel.LodgePoint_Paper = barrel.LodgePoint_Paper;
						attachableFlintlockBarrel.LodgePoint_Shot = barrel.LodgePoint_Shot;
						attachableFlintlockBarrel.BarrelLength = barrel.BarrelLength;
						attachableFlintlockBarrel.ProxyRends0 = barrel.ProxyRends0;
						attachableFlintlockBarrel.ProxyRends1 = barrel.ProxyRends1;
						attachableFlintlockBarrel.ProxyPowder0 = barrel.ProxyPowder0;
						attachableFlintlockBarrel.ProxyPowder1 = barrel.ProxyPowder1;
						attachableFlintlockBarrel.ProxyPowderPiles = barrel.ProxyPowderPiles;
						attachableFlintlockBarrel.EjectedObjectPrefabs = barrel.EjectedObjectPrefabs;
						attachableFlintlockBarrel.LoadedElementSizes = barrel.LoadedElementSizes;
						attachableFlintlockBarrel.ProjectilePrefab = barrel.ProjectilePrefab;
						attachableFlintlockBarrel.Spread = barrel.Spread;
						attachableFlintlockBarrel.VelocityMult = barrel.VelocityMult;
						attachableFlintlockBarrel.IgniteProjectile_Visible = barrel.IgniteProjectile_Visible;
						attachableFlintlockBarrel.IgniteProjectile_NotVisible = barrel.IgniteProjectile_NotVisible;
						attachableFlintlockBarrel.PowderToVelMultCurve = barrel.PowderToVelMultCurve;
						attachableFlintlockBarrel.AudEvent_Tamp = barrel.AudEvent_Tamp;
						attachableFlintlockBarrel.AudEvent_TampEnd = barrel.AudEvent_TampEnd;
						attachableFlintlockBarrel.AudEvent_Squib = barrel.AudEvent_Squib;
						attachableFlintlockBarrel.AudEvent_InsertByType = barrel.AudEvent_InsertByType;
						attachableFlintlockBarrel.DefaultMuzzleEffectSize = barrel.DefaultMuzzleEffectSize;
						attachableFlintlockBarrel.MuzzleEffects = barrel.MuzzleEffects;
						attachableFlintlockBarrel.MuzzleOverFireSystem = barrel.MuzzleOverFireSystem;
						attachableFlintlockBarrel.MuzzleOverFireSystemScaleRange = barrel.MuzzleOverFireSystemScaleRange;
						attachableFlintlockBarrel.MuzzleOverFireSystemEmitRange = barrel.MuzzleOverFireSystemEmitRange;
						attachableFlintlockBarrel.FlashBlastSmokeRange = barrel.FlashBlastSmokeRange;
						attachableFlintlockBarrel.FlashBlastFireRange = barrel.FlashBlastFireRange;
						((Behaviour)((Component)attachableFlintlockBarrel).gameObject.GetComponent<FlintlockBarrel>()).enabled = false;
						if ((Object)(object)attachableFlintlockBarrel == (Object)null)
						{
							Debug.Log((object)"Found the problem! Now how do I fix A_Barrel being null?");
						}
						else if ((Object)(object)attachableFlintlockFlashPan == (Object)null)
						{
							Debug.Log((object)"Found the problem! Now how do I fix A_FlashPan being null?");
						}
						else if (attachableFlintlockFlashPan.Barrels == null)
						{
							Debug.Log((object)"Found the problem! Now how do I fix A_FlashPan.Barrels being null?");
						}
						Debug.Log((object)"Adding A_Barrel to Flashpan");
						attachableFlintlockFlashPan.Barrels.Add(attachableFlintlockBarrel);
						Debug.Log((object)"Finished Copying Barrel");
						FlintlockDamageableSensor componentInChildren = ((Component)attachableFlintlockBarrel).gameObject.GetComponentInChildren<FlintlockDamageableSensor>();
						if ((Object)(object)componentInChildren != (Object)null)
						{
							Debug.Log((object)"Copying Sensor...");
							AttachableFlintlockDamagableSensor attachableFlintlockDamagableSensor = ((Component)componentInChildren).gameObject.AddComponent<AttachableFlintlockDamagableSensor>();
							attachableFlintlockDamagableSensor.Pan = attachableFlintlockFlashPan;
							attachableFlintlockDamagableSensor.Barrel = attachableFlintlockBarrel;
							Object.DestroyImmediate((Object)(object)((Component)attachableFlintlockDamagableSensor).gameObject.GetComponent<FlintlockDamageableSensor>());
							Debug.Log((object)"Finished Copying Sensor");
						}
					}
				}
				((Behaviour)((Component)attachableFlintlockFlashPan).gameObject.GetComponent<FlintlockFlashPan>()).enabled = false;
				FlashPans.Add(attachableFlintlockFlashPan);
			}
			Debug.Log((object)"Finished Copying Flashpans");
			Debug.Log((object)"Copying PseudoRamRod...");
			FlintlockPseudoRamRod ramRod = val.RamRod;
			AttachableFlintlockPseudoRamRod attachableFlintlockPseudoRamRod = ((Component)ramRod).gameObject.AddComponent<AttachableFlintlockPseudoRamRod>();
			attachableFlintlockPseudoRamRod.Root = ramRod.Root;
			attachableFlintlockPseudoRamRod.RState = ramRod.RState;
			attachableFlintlockPseudoRamRod.Point_Lower_Rear = ramRod.Point_Lower_Rear;
			attachableFlintlockPseudoRamRod.Point_Lower_Forward = ramRod.Point_Lower_Forward;
			attachableFlintlockPseudoRamRod.RamRodPrefab = ramRod.RamRodPrefab;
			attachableFlintlockPseudoRamRod.AudEvent_Grab = ramRod.AudEvent_Grab;
			attachableFlintlockPseudoRamRod.AudEvent_ExtractHolder = ramRod.AudEvent_ExtractHolder;
			attachableFlintlockPseudoRamRod.AudEvent_ExtractBarrel = ramRod.AudEvent_ExtractBarrel;
			attachableFlintlockPseudoRamRod.AudEvent_InsertHolder = ramRod.AudEvent_InsertHolder;
			attachableFlintlockPseudoRamRod.AudEvent_InsertBarrel = ramRod.AudEvent_InsertBarrel;
			((Behaviour)((Component)attachableFlintlockPseudoRamRod).gameObject.GetComponent<FlintlockPseudoRamRod>()).enabled = false;
			RamRod = attachableFlintlockPseudoRamRod;
			Debug.Log((object)"Finished Copying PseudoRamRod");
			Debug.Log((object)"Copying RamRodHolder...");
			FlintlockRamRodHolder componentInChildren2 = ((Component)this).gameObject.GetComponentInChildren<FlintlockRamRodHolder>();
			if ((Object)(object)componentInChildren2 == (Object)null)
			{
				Debug.Log((object)"Found the problem! Now how do I fix ramRodHolder being null?");
			}
			AttachableFlintlockRamRodHolder attachableFlintlockRamRodHolder = ((Component)componentInChildren2).gameObject.AddComponent<AttachableFlintlockRamRodHolder>();
			if ((Object)(object)attachableFlintlockRamRodHolder == (Object)null)
			{
				Debug.Log((object)"Found the problem! Now how do I fix A_RamRodHolder being null?");
			}
			Object.DestroyImmediate((Object)(object)((Component)attachableFlintlockRamRodHolder).gameObject.GetComponent<FlintlockRamRodHolder>());
			attachableFlintlockRamRodHolder.Weapon = this;
			Debug.Log((object)"Finished Copying RamRodHolder");
			Trigger = val.Trigger;
			TriggerRots = val.TriggerRots;
			Hammer = val.Hammer;
			HammerRots = val.HammerRots;
			HammerState = val.HammerState;
			FState = val.FState;
			FlintMesh = val.FlintMesh;
			FlintRenderer = val.FlintRenderer;
			foreach (Mesh flintMesh in val.FlintMeshes)
			{
				FlintMeshes.Add(flintMesh);
			}
			Debug.Log((object)"Copying FlintScrew...");
			FlintlockFlintScrew flintlockScrew = val.FlintlockScrew;
			if ((Object)(object)flintlockScrew == (Object)null)
			{
				Debug.Log((object)"Found the problem! Now how do I fix flintScrew being null?");
			}
			AttachableFlintlockFlintScrew attachableFlintlockFlintScrew = ((Component)flintlockScrew).gameObject.AddComponent<AttachableFlintlockFlintScrew>();
			if ((Object)(object)attachableFlintlockFlintScrew == (Object)null)
			{
				Debug.Log((object)"Found the problem! Now how do I fix A_FlintScrew being null?");
			}
			attachableFlintlockFlintScrew.Weapon = this;
			attachableFlintlockFlintScrew.Screw = flintlockScrew.Screw;
			attachableFlintlockFlintScrew.SState = flintlockScrew.SState;
			attachableFlintlockFlintScrew.Heights = flintlockScrew.Heights;
			attachableFlintlockFlintScrew.AudEvent_Screw = flintlockScrew.AudEvent_Screw;
			attachableFlintlockFlintScrew.AudEvent_Unscrew = flintlockScrew.AudEvent_Unscrew;
			((Behaviour)((Component)attachableFlintlockFlintScrew).gameObject.GetComponent<FlintlockFlintScrew>()).enabled = false;
			FlintlockScrew = attachableFlintlockFlintScrew;
			Debug.Log((object)"Finished Copying FlintScrew");
			Debug.Log((object)"Copying FlintHolder...");
			FlintlockFlintHolder flintlockHolder = val.FlintlockHolder;
			if ((Object)(object)flintlockHolder == (Object)null)
			{
				Debug.Log((object)"Found the problem! Now how do I fix flintHolder being null?");
			}
			AttachableFlintlockFlintHolder attachableFlintlockFlintHolder = ((Component)flintlockHolder).gameObject.AddComponent<AttachableFlintlockFlintHolder>();
			if ((Object)(object)attachableFlintlockFlintHolder == (Object)null)
			{
				Debug.Log((object)"Found the problem! Now how do I fix A_FlintHolder being null?");
			}
			attachableFlintlockFlintHolder.Screw = FlintlockScrew;
			attachableFlintlockFlintHolder.FlintPrefab = flintlockHolder.FlintPrefab;
			attachableFlintlockFlintHolder.AudEvent_Remove = flintlockHolder.AudEvent_Remove;
			attachableFlintlockFlintHolder.AudEvent_Replace = flintlockHolder.AudEvent_Replace;
			attachableFlintlockFlintHolder.FlintPos = flintlockHolder.FlintPos;
			((Behaviour)((Component)attachableFlintlockFlintHolder).gameObject.GetComponent<FlintlockFlintHolder>()).enabled = false;
			FlintlockFlintHolder = attachableFlintlockFlintHolder;
			Debug.Log((object)"Finished Copying FlintHolder");
			Sparks = val.Sparks;
			AudEvent_HammerCock = val.AudEvent_HammerCock;
			AudEvent_HammerHalfCock = val.AudEvent_HammerHalfCock;
			AudEvent_HammerHit_Clean = val.AudEvent_HammerHit_Clean;
			AudEvent_HammerHit_Dull = val.AudEvent_HammerHit_Dull;
			AudEvent_Spark = val.AudEvent_Spark;
			AudEvent_FlintBreak = val.AudEvent_FlintBreak;
			DisableOnDestroy = val.DisableOnDestroy;
			EnableOnDestroy = val.EnableOnDestroy;
			SpawnOnDestroy = val.SpawnOnDestroy;
			SpawnOnDestroyPoint = val.SpawnOnDestroyPoint;
			RamRodProj = val.RamRodProj;
			((Behaviour)((Component)this).gameObject.GetComponent<FlintlockWeapon>()).enabled = false;
			Debug.Log((object)"Finished Copying Components! Double check just to be sure :D");
		}
	}
	public class BreakActionPercussionNipple : MonoBehaviour
	{
		public BreakActionWeapon BreakAction;

		public FVRFireArmChamber[] CapNipples;

		public void Awake()
		{
			Hook();
		}

		public void OnDestroy()
		{
			Unhook();
		}

		public void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			BreakActionWeapon.DropHammer += new hook_DropHammer(BreakActionWeapon_DropHammer);
		}

		private void BreakActionWeapon_DropHammer(orig_DropHammer orig, BreakActionWeapon self)
		{
			if ((Object)(object)self == (Object)(object)BreakAction)
			{
				if (!self.m_isLatched)
				{
					return;
				}
				self.firedOneShot = false;
				for (int i = 0; i < self.Barrels.Length; i++)
				{
					if (self.Barrels[i].m_isHammerCocked)
					{
						((FVRFireArm)self).PlayAudioEvent((FirearmAudioEventType)6, 1f);
						self.Barrels[i].m_isHammerCocked = false;
						self.UpdateVisualHammers();
						if (CapNipples[i].Fire())
						{
							self.Fire(i, self.FireAllBarrels, i);
						}
						if (!self.FireAllBarrels)
						{
							break;
						}
					}
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		public void Unhook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			BreakActionWeapon.DropHammer -= new hook_DropHammer(BreakActionWeapon_DropHammer);
		}
	}
	public class BreakActionSafetySwitch : MonoBehaviour
	{
		public enum FireSelectorModeType
		{
			Safe,
			Single,
			All
		}

		[Serializable]
		public class FireSelectorMode
		{
			public float SelectorPosition;

			public FireSelectorModeType ModeType;
		}

		public BreakActionWeapon BreakAction;

		public Transform Switch;

		public Axis Axis;

		public FireSelectorMode[] FireSelectorModes;

		private int _fireSelectorMode;

		public void Awake()
		{
			Hook();
		}

		public void OnDestroy()
		{
			Unhook();
		}

		public void Update()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			FVRViveHand hand = ((FVRInteractiveObject)BreakAction).m_hand;
			if (!((Object)(object)hand != (Object)null))
			{
				return;
			}
			if (hand.IsInStreamlinedMode)
			{
				if (hand.Input.AXButtonDown)
				{
					ChangeFireSelectorMode();
				}
			}
			else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) < 45f)
			{
				ChangeFireSelectorMode();
			}
		}

		private void ChangeFireSelectorMode()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected I4, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			_fireSelectorMode++;
			if (FireSelectorModes.Length <= _fireSelectorMode)
			{
				_fireSelectorMode = 0;
			}
			Vector3 localPosition = Switch.localPosition;
			Axis axis = Axis;
			switch ((int)axis)
			{
			case 0:
				localPosition.x = FireSelectorModes[_fireSelectorMode].SelectorPosition;
				break;
			case 1:
				localPosition.y = FireSelectorModes[_fireSelectorMode].SelectorPosition;
				break;
			case 2:
				localPosition.z = FireSelectorModes[_fireSelectorMode].SelectorPosition;
				break;
			}
			Switch.localPosition = localPosition;
			((FVRFireArm)BreakAction).PlayAudioEvent((FirearmAudioEventType)15, 1f);
		}

		public void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			BreakActionWeapon.DropHammer += new hook_DropHammer(BreakActionWeapon_DropHammer);
		}

		private void BreakActionWeapon