using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using BitWizrd.Revolver; using BitWizrd.Speedloader; using FistVR; using HarmonyLib; using OtherLoader; using UnityEditor; using UnityEngine; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace BitWizrd.HuntCaldwellConversionChain { [BepInPlugin("BitWizrd.HuntCaldwellConversionChain", "HuntCaldwellConversionChain", "1.0.3")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class HuntCaldwellConversionChainPlugin : BaseUnityPlugin { private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; LoadAssets(); } private void LoadAssets() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "BitWizrd.HuntCaldwellConversionChain"); OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntCaldwellConversionChain", "", "caldwell conversion chain", "", ""); } } } public class BloodBondSR : MonoBehaviour { private void Awake() { string name = "Ammo_69_CashMoney_D100(Clone)"; ((Object)((Component)this).gameObject).name = name; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Object)((Component)componentsInChildren[i]).gameObject).name = name; } } } namespace BitWizrd.Revolver { public class Chain : FVRFireArm { [Header("Chain Revolver")] public ChainCylinder ChainCylinder; public Transform Hammer; public Transform LoadingGate; public Transform Trigger; public Transform HammerFanDir; public Transform PoseSpinHolder; public Transform Pose_Main; public Transform Pose_Toggled; public float Hammer_Rot_Uncocked; public float Hammer_Rot_Halfcocked; public float Hammer_Rot_Cocked; public float LoadingGate_Rot_Closed; public float LoadingGate_Rot_Open; public float Trigger_Rot_Forward; public float Trigger_Rot_Rearward; public bool StateToggles = true; public float TriggerThreshold = 0.9f; public bool CanSpin = true; public bool HasTransferBarSafety; public bool IsAccessTwoChambersBack; public Transform ChainHolder; public bool AllChambersAccessible = false; private int m_curChamber; private float m_curChamberLerp; private float m_tarChamberLerp; private bool m_isSpinning; private bool m_isStateToggled; private float m_triggerFloat; private bool m_isHammerCocking; private bool m_isHammerCocked; private float m_hammerCockLerp; private float m_hammerCockSpeed = 10f; private float xSpinRot; private float xSpinVel; private float timeSinceColFire; private float m_chainHolderBaseAngle; private float m_chainHolderCurAngle; private float m_chainHolderTargetAngle; private float m_chainHolderLerp; private float m_chainHolderLerpDuration = 0.1f; public int CurChamber { get { return m_curChamber; } set { m_curChamber = value; if (m_curChamber < 0) { m_curChamber += ChainCylinder.NumChambers; } m_curChamber %= ChainCylinder.NumChambers; } } public int NextChamber => (m_curChamber - 1 + ChainCylinder.NumChambers) % ChainCylinder.NumChambers; public int PrevChamber => (m_curChamber + 1) % ChainCylinder.NumChambers; public int PrevChamber2 => (m_curChamber + 2) % ChainCylinder.NumChambers; public override void Awake() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).Awake(); base.FChambers.Clear(); FVRFireArmChamber[] chambers = ChainCylinder.Chambers; foreach (FVRFireArmChamber item in chambers) { base.FChambers.Add(item); } m_chainHolderBaseAngle = 0f; m_chainHolderCurAngle = 0f; m_chainHolderTargetAngle = 0f; m_chainHolderLerp = 1f; if ((Object)(object)ChainCylinder != (Object)null && ChainCylinder.LerpSpeed > 0f) { m_chainHolderLerpDuration = 1f / ChainCylinder.LerpSpeed; } if ((Object)(object)((FVRInteractiveObject)this).PoseOverride_Touch != (Object)null) { Pose_Main.localPosition = ((FVRInteractiveObject)this).PoseOverride_Touch.localPosition; Pose_Main.localRotation = ((FVRInteractiveObject)this).PoseOverride_Touch.localRotation; } } public override void BeginInteraction(FVRViveHand hand) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).BeginInteraction(hand); if (((FVRPhysicalObject)this).IsAltHeld) { return; } if (!m_isStateToggled) { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation; } } else { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation; } } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) ((FVRPhysicalObject)this).UpdateInteraction(hand); m_isSpinning = false; if (!((FVRPhysicalObject)this).IsAltHeld) { if (!m_isStateToggled) { if (hand.Input.TouchpadPressed && !hand.IsInStreamlinedMode && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f) { m_isSpinning = true; } if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown) { CockHammer(5f); } if (hand.Input.BYButtonDown && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } else if (hand.Input.TouchpadDown) { if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) < 45f) { CockHammer(5f); } else if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } } else { if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown) { AdvanceCylinder(); } if (hand.Input.BYButtonDown && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } else if (hand.Input.TouchpadDown) { if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); } else if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { AdvanceCylinder(); } } if (hand.Input.TriggerDown) { EjectPrevCylinder(); } } } UpdateTriggerHammer(hand); UpdateCylinderRot(); if (!((FVRInteractiveObject)this).IsHeld) { m_isSpinning = false; } if (m_chainHolderLerp < 1f) { m_chainHolderLerp += Time.deltaTime / m_chainHolderLerpDuration; if (m_chainHolderLerp > 1f) { m_chainHolderLerp = 1f; } float z = Mathf.Lerp(m_chainHolderCurAngle, m_chainHolderTargetAngle, m_chainHolderLerp); if ((Object)(object)ChainHolder != (Object)null) { Vector3 localEulerAngles = ChainHolder.localEulerAngles; localEulerAngles.z = z; ChainHolder.localEulerAngles = localEulerAngles; } } else if ((Object)(object)ChainHolder != (Object)null) { Vector3 localEulerAngles2 = ChainHolder.localEulerAngles; localEulerAngles2.z = m_chainHolderTargetAngle; ChainHolder.localEulerAngles = localEulerAngles2; } } public override void EndInteraction(FVRViveHand hand) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) m_triggerFloat = 0f; ((FVRFireArm)this).EndInteraction(hand); ((FVRPhysicalObject)this).RootRigidbody.AddRelativeTorque(new Vector3(xSpinVel, 0f, 0f), (ForceMode)1); } public override void FVRFixedUpdate() { UpdateSpinning(); if (timeSinceColFire < 3f) { timeSinceColFire += Time.deltaTime; } ((FVRFireArm)this).FVRFixedUpdate(); } private void UpdateTriggerHammer(FVRViveHand hand) { //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) ChainCylinder.CurrentChamberIndex = CurChamber; if (((FVRInteractiveObject)this).IsHeld && !m_isStateToggled && !m_isHammerCocked && !m_isHammerCocking && (Object)(object)hand.OtherHand != (Object)null) { Vector3 velLinearWorld = hand.OtherHand.Input.VelLinearWorld; float num = Vector3.Distance(hand.OtherHand.PalmTransform.position, HammerFanDir.position); if (num < 0.15f && Vector2.Angle(Vector2.op_Implicit(velLinearWorld), Vector2.op_Implicit(HammerFanDir.forward)) < 60f && ((Vector3)(ref velLinearWorld)).magnitude > 1f) { CockHammer(10f); } } if (m_isHammerCocking) { if (m_hammerCockLerp < 1f) { m_hammerCockLerp += Time.deltaTime * m_hammerCockSpeed; } else { m_hammerCockLerp = 1f; m_isHammerCocking = false; m_isHammerCocked = true; CurChamber--; m_curChamberLerp = 0f; m_tarChamberLerp = 0f; } } if (!m_isStateToggled) { Hammer.localEulerAngles = new Vector3(Mathf.Lerp(Hammer_Rot_Uncocked, Hammer_Rot_Cocked, m_hammerCockLerp), 0f, 0f); } else { Hammer.localEulerAngles = new Vector3(Hammer_Rot_Halfcocked, 0f, 0f); } if ((Object)(object)LoadingGate != (Object)null) { if (!m_isStateToggled) { LoadingGate.localEulerAngles = new Vector3(0f, 0f, LoadingGate_Rot_Closed); } else { LoadingGate.localEulerAngles = new Vector3(0f, 0f, LoadingGate_Rot_Open); } } m_triggerFloat = 0f; if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !m_isSpinning && !m_isStateToggled) { m_triggerFloat = hand.Input.TriggerFloat; } Trigger.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, m_triggerFloat), 0f, 0f); if (m_triggerFloat > TriggerThreshold) { DropHammer(); } } private void DropHammer() { if (m_isHammerCocked) { m_isHammerCocked = false; m_isHammerCocking = false; m_hammerCockLerp = 0f; Fire(); } } private void AdvanceCylinder() { CurChamber--; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f); ChainCylinder.CurrentLerpDuration = 1f / ((!(ChainCylinder.LerpSpeed > 0f)) ? 10f : ChainCylinder.LerpSpeed); ChainCylinder.Advance(); m_chainHolderTargetAngle = (m_chainHolderCurAngle = m_chainHolderTargetAngle) - 72f; m_chainHolderLerp = 0f; } public void EjectPrevCylinder() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (m_isStateToggled) { int num = PrevChamber; if (IsAccessTwoChambersBack) { num = PrevChamber2; } FVRFireArmChamber val = ChainCylinder.Chambers[num]; if (val.IsFull) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } val.EjectRound(((Component)val).transform.position + ((Component)val).transform.forward * 0.0025f, -((Component)val).transform.forward, Vector3.zero, false); } } private void Fire() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); if (base.FChambers[CurChamber].Fire()) { FVRFireArmChamber val = base.FChambers[CurChamber]; ((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); ((FVRFireArm)this).PlayAudioGunShot(val.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { val.IsSpent = false; val.UpdateProxyDisplay(); } } } private void UpdateCylinderRot() { if (AllChambersAccessible) { for (int i = 0; i < base.FChambers.Count; i++) { int curChamber = CurChamber; int num = (CurChamber + 1) % ChainCylinder.NumChambers; int num2 = (CurChamber + ChainCylinder.NumChambers - 1) % ChainCylinder.NumChambers; if (i == curChamber || i == num || i == num2) { base.FChambers[i].IsAccessible = false; } else { base.FChambers[i].IsAccessible = true; } } if (m_isStateToggled) { int num3 = (CurChamber + 1) % ChainCylinder.NumChambers; if (num3 >= 0 && num3 < base.FChambers.Count) { base.FChambers[num3].IsAccessible = true; } } return; } for (int j = 0; j < base.FChambers.Count; j++) { base.FChambers[j].IsAccessible = false; } if (m_isStateToggled) { int num4 = (CurChamber + 1) % ChainCylinder.NumChambers; if (IsAccessTwoChambersBack) { num4 = (CurChamber + 2) % ChainCylinder.NumChambers; } if (num4 >= 0 && num4 < base.FChambers.Count) { base.FChambers[num4].IsAccessible = true; } } } private void UpdateSpinning() { //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) if (!((FVRInteractiveObject)this).IsHeld) { m_isSpinning = false; } if (m_isSpinning) { Vector3 val = Vector3.zero; if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) { val = ((FVRInteractiveObject)this).m_hand.Input.VelLinearLocal; } float num = Vector3.Dot(((Vector3)(ref val)).normalized, ((Component)this).transform.up); num = Mathf.Clamp(num, 0f - ((Vector3)(ref val)).magnitude, ((Vector3)(ref val)).magnitude); if (Mathf.Abs(xSpinVel) < 90f) { xSpinVel += num * Time.deltaTime * 600f; } else if (Mathf.Sign(num) == Mathf.Sign(xSpinVel)) { xSpinVel += num * Time.deltaTime * 600f; } if (Mathf.Abs(xSpinVel) < 90f) { if (Vector3.Dot(((Component)this).transform.up, Vector3.down) >= 0f && Mathf.Sign(xSpinVel) == 1f) { xSpinVel += Time.deltaTime * 50f; } if (Vector3.Dot(((Component)this).transform.up, Vector3.down) < 0f && Mathf.Sign(xSpinVel) == -1f) { xSpinVel -= Time.deltaTime * 50f; } } xSpinVel = Mathf.Clamp(xSpinVel, -500f, 500f); xSpinRot += xSpinVel * Time.deltaTime * 5f; PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f); xSpinVel = Mathf.Lerp(xSpinVel, 0f, Time.deltaTime * 0.6f); } else { xSpinRot = 0f; xSpinVel = 0f; PoseSpinHolder.localRotation = Quaternion.RotateTowards(PoseSpinHolder.localRotation, Quaternion.identity, Time.deltaTime * 500f); PoseSpinHolder.localEulerAngles = new Vector3(PoseSpinHolder.localEulerAngles.x, 0f, 0f); } } public override List GetChamberRoundList() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) bool flag = false; List list = new List(); for (int i = 0; i < base.FChambers.Count; i++) { if (base.FChambers[i].IsFull) { list.Add(base.FChambers[i].GetRound().RoundClass); flag = true; } } if (flag) { return list; } return null; } public override void SetLoadedChambers(List rounds) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count <= 0) { return; } for (int i = 0; i < base.FChambers.Count; i++) { if (i < rounds.Count) { base.FChambers[i].Autochamber(rounds[i]); } } } private void CockHammer(float speed) { if (!m_isHammerCocked && !m_isHammerCocking) { m_hammerCockSpeed = speed; m_isHammerCocking = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); ChainCylinder.CurrentLerpDuration = 1f / m_hammerCockSpeed; ChainCylinder.StartAdvanceLerp(); m_chainHolderTargetAngle = (m_chainHolderCurAngle = m_chainHolderTargetAngle) - 72f; m_chainHolderLerp = 0f; } } private void ToggleState() { //IL_00a6: 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_0034: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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) m_isStateToggled = !m_isStateToggled; if (!((FVRPhysicalObject)this).IsAltHeld) { if (!m_isStateToggled) { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation; } } else { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation; } } } m_isHammerCocking = false; m_isHammerCocked = false; m_hammerCockLerp = 0f; } } public class ChainCylinder : MonoBehaviour { private class ChainLink { public Transform transform; public Vector3 baseLocalPos; public Quaternion baseLocalRot; public Vector3 particlePos; private Vector3 particleVel; private float restVelocityThreshold = 0.003f; public float distanceLimit = 0.12f; public float gravityScale = 0.8f; public float springRate = 0.85f; public float damping = 0.6f; public float positionScale = 0.2f; public bool isKinematic = false; public ChainLink prevLink; public ChainLink nextLink; private float idealDistanceToPrev; private float idealDistanceToNext; private float uniqueOffset1; private float uniqueOffset2; private float uniqueOffset3; private float moveScale; private float noiseFrequency1; private float noiseFrequency2; private float noiseFrequency3; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) baseLocalPos = transform.localPosition; baseLocalRot = transform.localRotation; ResetParticle(); uniqueOffset1 = Random.Range(0f, 100f); uniqueOffset2 = Random.Range(0f, 100f); uniqueOffset3 = Random.Range(0f, 100f); noiseFrequency1 = Random.Range(0.6f, 1.2f); noiseFrequency2 = Random.Range(0.6f, 1.2f); noiseFrequency3 = Random.Range(0.6f, 1.2f); moveScale = Random.Range(0.7f, 1f); } public void ResetParticle() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) particlePos = transform.position; particleVel = Vector3.zero; } public void SetToBasePosition() { //IL_0008: 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) transform.localPosition = baseLocalPos; transform.localRotation = baseLocalRot; ResetParticle(); } public void SetBasePosition(Vector3 pos, Quaternion rot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_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) baseLocalPos = pos; baseLocalRot = rot; if (isKinematic) { transform.localPosition = baseLocalPos; transform.localRotation = baseLocalRot; ResetParticle(); } } public void UpdatePhysics(float deltaTime, float movementAmount, bool advancing) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00a5: 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_00b5: 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_00c6: 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_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_036c: 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_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0378: 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_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) if (isKinematic) { transform.localPosition = baseLocalPos; transform.localRotation = baseLocalRot; ResetParticle(); return; } Vector3 position = transform.position; bool flag = movementAmount < 0.001f && !advancing; if (flag && ((Vector3)(ref particleVel)).magnitude < restVelocityThreshold) { transform.localPosition = Vector3.Lerp(transform.localPosition, baseLocalPos, deltaTime * 3f); transform.localRotation = baseLocalRot; particleVel = Vector3.zero; particlePos = transform.position; return; } Vector3 val = Physics.gravity * gravityScale; Vector3 val2 = Vector3.zero; if (movementAmount > 0.005f && !advancing) { float time = Time.time; float num = Mathf.PerlinNoise(time * noiseFrequency1 + uniqueOffset1, uniqueOffset2) * 2f - 1f; float num2 = Mathf.PerlinNoise(uniqueOffset2, time * noiseFrequency2 + uniqueOffset3) * 2f - 1f; float num3 = Mathf.PerlinNoise(uniqueOffset3 + time * noiseFrequency3, time * noiseFrequency1) * 2f - 1f; val2 = new Vector3(num * 0.05f, num2 * 0.05f, num3 * 0.05f) * moveScale * Mathf.Min(1f, movementAmount * 6f); } if (!advancing && ((Vector3)(ref val2)).magnitude < 0.001f) { float num4 = Time.time * 0.3f; val2 += new Vector3(Mathf.Sin(num4 * 1.2f + uniqueOffset1) * 0.006f, Mathf.Cos(num4 * 0.9f + uniqueOffset2) * 0.006f, Mathf.Sin(num4 * 0.7f + uniqueOffset3) * 0.006f) * moveScale * 0.1f; } Vector3 val3 = particlePos; float num5 = ((!advancing) ? (damping * Random.Range(0.9f, 1.1f)) : 0.85f); Vector3 val4 = Vector3.Lerp(particleVel, Vector3.zero, num5 * deltaTime) + (val + val2) * deltaTime; val4 = Vector3.Lerp(particleVel, val4, deltaTime * 6f); Vector3 val5 = val3 + val4 * deltaTime; float num6 = (advancing ? 0.95f : ((!flag) ? (springRate * Random.Range(0.85f, 1.15f)) : 0.98f)); Vector3 val6 = transform.parent.TransformPoint(baseLocalPos); val5 = Vector3.Lerp(val5, val6, num6 * deltaTime); float num7 = ((!advancing) ? (distanceLimit * moveScale) : (distanceLimit * 0.3f)); float num8 = Vector3.Distance(val5, position); if (num8 > num7) { Vector3 val7 = val5 - position; val5 = position + ((Vector3)(ref val7)).normalized * num7; } particlePos = val5; particleVel = (particlePos - val3) / deltaTime; if (flag) { particleVel *= 0.8f; } if ((prevLink != null && prevLink.isKinematic) || (nextLink != null && nextLink.isKinematic)) { EnforceKinematicConnectivity(ref val5); } else { EnforceLooseConnectivity(ref val5); } Vector3 val8 = particlePos - position; Vector3 val9 = transform.parent.InverseTransformDirection(val8); float num9 = ((!advancing) ? (positionScale * moveScale) : (positionScale * 0.3f)); val9 *= num9; transform.localPosition = baseLocalPos + val9; transform.localRotation = baseLocalRot; } private void EnforceLooseConnectivity(ref Vector3 newPos) { //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //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_006f: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) if (prevLink != null && !prevLink.isKinematic) { Vector3 position = prevLink.transform.position; float num = Vector3.Distance(newPos, position); if (Mathf.Abs(num - idealDistanceToPrev) > idealDistanceToPrev * 0.6f) { Vector3 val = newPos - position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = position + normalized * idealDistanceToPrev; newPos = Vector3.Lerp(newPos, val2, 0.3f); } } if (nextLink != null && !nextLink.isKinematic) { Vector3 position2 = nextLink.transform.position; float num2 = Vector3.Distance(newPos, position2); if (Mathf.Abs(num2 - idealDistanceToNext) > idealDistanceToNext * 0.6f) { Vector3 val3 = newPos - position2; Vector3 normalized2 = ((Vector3)(ref val3)).normalized; Vector3 val4 = position2 + normalized2 * idealDistanceToNext; newPos = Vector3.Lerp(newPos, val4, 0.3f); } } particlePos = newPos; } public void SetupConnectivity() { //IL_000f: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (prevLink != null) { idealDistanceToPrev = Vector3.Distance(baseLocalPos, prevLink.baseLocalPos); } if (nextLink != null) { idealDistanceToNext = Vector3.Distance(baseLocalPos, nextLink.baseLocalPos); } } private void EnforceKinematicConnectivity(ref Vector3 newPos) { //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0128: 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) if (prevLink != null && prevLink.isKinematic) { Vector3 position = prevLink.transform.position; float num = Vector3.Distance(newPos, position); if (Mathf.Abs(num - idealDistanceToPrev) > 0.005f) { Vector3 val = newPos - position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = position + normalized * idealDistanceToPrev; newPos = Vector3.Lerp(newPos, val2, 0.95f); } } if (nextLink != null && nextLink.isKinematic) { Vector3 position2 = nextLink.transform.position; float num2 = Vector3.Distance(newPos, position2); if (Mathf.Abs(num2 - idealDistanceToNext) > 0.005f) { Vector3 val3 = newPos - position2; Vector3 normalized2 = ((Vector3)(ref val3)).normalized; Vector3 val4 = position2 + normalized2 * idealDistanceToNext; newPos = Vector3.Lerp(newPos, val4, 0.95f); } } particlePos = newPos; } } public int NumChambers = 17; public Transform[] ChamberModels; public FVRFireArmChamber[] Chambers; [HideInInspector] public Vector3[] ChamberPositions; [HideInInspector] public Quaternion[] ChamberRotations; public float LerpSpeed = 10f; private int m_curChamber = 0; private float[] m_lerpProgress; private int[] m_targetIndices; private float m_hammerLerp = 0f; public int CurrentChamberIndex = 0; public float CurrentLerpDuration = 0.1f; [Tooltip("The distance the particle is clamped to")] public float WaggleDistanceLimit = 0.15f; [Tooltip("Left angle limit for chain links")] public float WaggleAngleLimitLeft = 25f; [Tooltip("Right angle limit for chain links")] public float WaggleAngleLimitRight = 25f; [Tooltip("Multiplier for physics gravity affecting the particles")] public float WaggleGravityScale = 0.7f; [Tooltip("Pulls particles back to their hinge direction")] public bool WaggleUseSpring = true; [Tooltip("Rate at which particles approach the hinge direction (0.95 = 95% closer each second)")] public float WaggleSpringApproachRate = 0.8f; [Tooltip("Rate at which particles lose velocity (0.7 = 70% slower each second)")] public float WaggleDamping = 0.6f; private ChainLink[] m_chainLinks; private Vector3 m_lastPosition; private Quaternion m_lastRotation; private float m_movementAmount = 0f; private const float STABILITY_THRESHOLD = 0.002f; private bool m_isAdvancing = false; [Header("Audio Cue Settings")] [Tooltip("Velocity threshold for playing jingle sound")] public float JingleVelocityThreshold = 1.5f; [Tooltip("Minimum time between jingle sounds in seconds")] public float JingleCooldownTime = 0.7f; private float m_lastJingleTime = 0f; private FVRFireArm m_firearm; private Rigidbody m_firearmRb; [Tooltip("Enable or disable the jingle sound when the chain moves")] public bool EnableJingleSound = true; private void Awake() { //IL_0085: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) if (ChamberModels == null || ChamberModels.Length != NumChambers || Chambers == null || Chambers.Length != NumChambers) { return; } ChamberPositions = (Vector3[])(object)new Vector3[NumChambers]; ChamberRotations = (Quaternion[])(object)new Quaternion[NumChambers]; for (int i = 0; i < NumChambers; i++) { ref Vector3 reference = ref ChamberPositions[i]; reference = ChamberModels[i].localPosition; ref Quaternion reference2 = ref ChamberRotations[i]; reference2 = ChamberModels[i].localRotation; } m_firearm = ((Component)this).GetComponentInParent(); if ((Object)(object)m_firearm != (Object)null) { m_firearmRb = ((Component)m_firearm).GetComponent(); } m_lerpProgress = new float[NumChambers]; m_targetIndices = new int[NumChambers]; for (int j = 0; j < NumChambers; j++) { m_targetIndices[j] = j; } m_chainLinks = new ChainLink[NumChambers]; for (int k = 0; k < NumChambers; k++) { m_chainLinks[k] = new ChainLink(); m_chainLinks[k].transform = ChamberModels[k]; m_chainLinks[k].distanceLimit = WaggleDistanceLimit; m_chainLinks[k].gravityScale = WaggleGravityScale; m_chainLinks[k].springRate = WaggleSpringApproachRate; m_chainLinks[k].damping = WaggleDamping; if (k == 4 || k == 14) { m_chainLinks[k].damping *= 1.2f; m_chainLinks[k].springRate *= 1.1f; } m_chainLinks[k].positionScale = 0.2f; m_chainLinks[k].Initialize(); } for (int l = 0; l < NumChambers; l++) { int num = (l - 1 + NumChambers) % NumChambers; int num2 = (l + 1) % NumChambers; m_chainLinks[l].prevLink = m_chainLinks[num]; m_chainLinks[l].nextLink = m_chainLinks[num2]; } for (int m = 0; m < NumChambers; m++) { m_chainLinks[m].SetupConnectivity(); } for (int n = 0; n < NumChambers; n++) { ChamberModels[n].localPosition = ChamberPositions[n]; ChamberModels[n].localRotation = ChamberRotations[n]; } DisableCollisionsBetweenLinks(); m_lastPosition = ((Component)this).transform.position; m_lastRotation = ((Component)this).transform.rotation; } private void DisableCollisionsBetweenLinks() { List list = new List(); Transform[] chamberModels = ChamberModels; foreach (Transform val in chamberModels) { Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); if (componentsInChildren != null && componentsInChildren.Length > 0) { list.AddRange(componentsInChildren); } } if (list.Count <= 0) { return; } for (int j = 0; j < list.Count; j++) { if ((Object)(object)list[j] == (Object)null || !list[j].enabled) { continue; } for (int k = j + 1; k < list.Count; k++) { if (!((Object)(object)list[k] == (Object)null) && list[k].enabled) { Physics.IgnoreCollision(list[j], list[k], true); } } } } public void Advance() { m_isAdvancing = true; for (int i = 0; i < NumChambers; i++) { m_targetIndices[i] = (m_targetIndices[i] + 1) % NumChambers; m_lerpProgress[i] = 0f; } } public void StartAdvanceLerp() { m_isAdvancing = true; for (int i = 0; i < NumChambers; i++) { m_targetIndices[i] = (m_targetIndices[i] + 1) % NumChambers; m_lerpProgress[i] = 0f; } } public void SetHammerLerp(float lerp) { m_hammerLerp = lerp; } private float CalculateMovement() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_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_0050: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) float num = 0f; if ((Object)(object)m_firearmRb != (Object)null) { Vector3 velocity = m_firearmRb.velocity; num = ((Vector3)(ref velocity)).magnitude; } else if ((Object)(object)m_firearm != (Object)null) { num = Vector3.Distance(((Component)m_firearm).transform.position, m_lastPosition) / Mathf.Max(Time.deltaTime, 0.0001f); m_lastPosition = ((Component)m_firearm).transform.position; } else { num = Vector3.Distance(((Component)this).transform.position, m_lastPosition) / Mathf.Max(Time.deltaTime, 0.0001f); m_lastPosition = ((Component)this).transform.position; } float num2 = Quaternion.Angle(((Component)this).transform.rotation, m_lastRotation) / 90f; m_lastRotation = ((Component)this).transform.rotation; float num3 = Mathf.Max(num, num2 * 5f); m_movementAmount = Mathf.Lerp(m_movementAmount, num3, Time.deltaTime * 10f); CheckPlayJingleSound(m_movementAmount); return m_movementAmount; } private void CheckPlayJingleSound(float movement) { if (!EnableJingleSound || !((Object)(object)m_firearm != (Object)null) || !((FVRInteractiveObject)m_firearm).IsHeld || !(movement > JingleVelocityThreshold) || !(Time.time > m_lastJingleTime + JingleCooldownTime)) { return; } try { if ((Object)(object)m_firearm != (Object)null && (Object)(object)m_firearm.AudioClipSet != (Object)null && m_firearm.AudioClipSet.BeltGrab != null && m_firearm.AudioClipSet.BeltGrab.Clips != null && m_firearm.AudioClipSet.BeltGrab.Clips.Count > 0) { m_firearm.PlayAudioEvent((FirearmAudioEventType)50, 1f); m_lastJingleTime = Time.time; } } catch (Exception) { } } private void UpdateKinematicLinks() { int num = -2; int num2 = 6; for (int i = 0; i < NumChambers; i++) { m_chainLinks[i].isKinematic = false; } for (int j = 0; j < num2; j++) { int num3 = (CurrentChamberIndex + num + j + NumChambers) % NumChambers; if (num3 >= 0 && num3 < NumChambers) { m_chainLinks[num3].isKinematic = true; } } } private void Update() { //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024a: 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_00b1: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) float movementAmount = CalculateMovement(); bool flag = true; for (int i = 0; i < NumChambers; i++) { if (m_lerpProgress[i] < 1f) { flag = false; break; } } if (flag) { m_isAdvancing = false; } if (m_hammerLerp > 0f && m_hammerLerp < 1f) { for (int j = 0; j < NumChambers; j++) { int num = m_targetIndices[j]; int num2 = (m_targetIndices[j] + 1) % NumChambers; Vector3 val = Vector3.Lerp(ChamberPositions[num], ChamberPositions[num2], m_hammerLerp); Quaternion val2 = Quaternion.Slerp(ChamberRotations[num], ChamberRotations[num2], m_hammerLerp); ChamberModels[j].localPosition = val; ChamberModels[j].localRotation = val2; m_chainLinks[j].SetBasePosition(val, val2); } } else { for (int k = 0; k < NumChambers; k++) { if (m_lerpProgress[k] < 1f) { m_lerpProgress[k] += Time.deltaTime / ((!(CurrentLerpDuration > 0f)) ? 0.1f : CurrentLerpDuration); if (m_lerpProgress[k] > 1f) { m_lerpProgress[k] = 1f; } } int num3 = (m_targetIndices[k] + NumChambers - 1) % NumChambers; int num4 = m_targetIndices[k]; Vector3 pos = Vector3.Lerp(ChamberPositions[num3], ChamberPositions[num4], m_lerpProgress[k]); Quaternion rot = Quaternion.Slerp(ChamberRotations[num3], ChamberRotations[num4], m_lerpProgress[k]); m_chainLinks[k].SetBasePosition(pos, rot); } } UpdateKinematicLinks(); for (int l = 0; l < NumChambers; l++) { m_chainLinks[l].UpdatePhysics(Time.deltaTime, movementAmount, m_isAdvancing); } } } public class ChainEjectorRod : FVRInteractiveObject { public Chain ChainRevolver; public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if ((Object)(object)ChainRevolver != (Object)null) { ChainRevolver.EjectPrevCylinder(); } } } } public class CooldownSound : MonoBehaviour { public ClosedBoltWeapon weapon; public AudioClip[] audioClips; public float volume = 1f; public int minShots = 5; public int maxShots = 10; public float minDelay = 0.5f; public float maxDelay = 2f; public float resetTime = 1.5f; private AudioSource audioSource; private int shotCounter = 0; private float lastShotTime; private bool lastRoundSpent; private int nextShotThreshold; private bool isPlayingSound = false; private void Start() { if ((Object)(object)weapon == (Object)null) { weapon = ((Component)this).GetComponent(); } if ((Object)(object)weapon == (Object)null) { Debug.LogError((object)"CooldownSound: Weapon reference is missing. Attach this script to a ClosedBoltWeapon."); return; } audioSource = ((Component)weapon).gameObject.GetComponent(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)weapon).gameObject.AddComponent(); } audioSource.spatialBlend = 1f; audioSource.playOnAwake = false; audioSource.rolloffMode = (AudioRolloffMode)0; lastRoundSpent = weapon.Chamber.IsSpent; SetNewShotThreshold(); } private void Update() { DetectFiring(); } private void DetectFiring() { if (weapon.Chamber.IsFull && weapon.Chamber.IsSpent && !lastRoundSpent) { OnWeaponFired(); } lastRoundSpent = weapon.Chamber.IsSpent; } private void OnWeaponFired() { float num = Time.time - lastShotTime; if (num > resetTime) { shotCounter = 0; SetNewShotThreshold(); } shotCounter++; lastShotTime = Time.time; if (shotCounter >= nextShotThreshold) { ((MonoBehaviour)this).StartCoroutine(PlaySoundWithDelay()); shotCounter = 0; SetNewShotThreshold(); } } private IEnumerator PlaySoundWithDelay() { if (!isPlayingSound) { isPlayingSound = true; float delay = Random.Range(minDelay, maxDelay); yield return (object)new WaitForSeconds(delay); if (audioClips.Length > 0) { int index = Random.Range(0, audioClips.Length); audioSource.clip = audioClips[index]; audioSource.PlayOneShot(audioSource.clip, volume); yield return (object)new WaitForSeconds(audioSource.clip.length); } isPlayingSound = false; } } private void SetNewShotThreshold() { nextShotThreshold = Random.Range(minShots, maxShots + 1); } } public class CustomWaggleJoint : MonoBehaviour { public float distanceLimit = 0.25f; public float angleLimitLeft = 45f; public float angleLimitRight = 45f; public float gravityScale = 1f; public bool useSpring; public float springApproachRate = 0.95f; public float damping; public Transform hingeGraphic; public Vector3 hingeGraphicRotationOffset; public bool invertWaggleAxis; public bool ManualExecution; public float onHitLimitCooldown = 0.05f; public Vector3 waggleAxis = Vector3.up; public Vector3 rotationAxis = Vector3.up; [Header("Gizmo Options")] public bool debugGizmos = false; public bool showRotationExtremes = false; public bool showRotationDirectionArrows = false; private Vector3 particlePos; private Vector3 particleVel; private bool leftCatchState; private bool rightCatchState; private float lastTouchTime = float.MinValue; private Vector3 EffectiveWaggleDir() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.TransformDirection((!invertWaggleAxis) ? waggleAxis : (-waggleAxis)); } private void GetEffectiveAngleLimits(out float effectiveAngleMin, out float effectiveAngleMax) { if (invertWaggleAxis) { effectiveAngleMin = 0f - angleLimitLeft; effectiveAngleMax = angleLimitRight; } else { effectiveAngleMin = 0f - angleLimitRight; effectiveAngleMax = angleLimitLeft; } } public void ResetParticlePos() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) particlePos = ((Component)this).transform.position + EffectiveWaggleDir() * distanceLimit; particleVel = Vector3.zero; } private void OnHitLimit(float angularVelocity) { } public void Execute() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) float deltaTime = Time.deltaTime; Transform transform = ((Component)this).transform; Vector3 val = Physics.gravity * gravityScale; Vector3 val2 = particlePos; Vector3 val3 = particleVel * Mathf.Pow(1f - damping, deltaTime) + val * deltaTime; Vector3 val4 = val2 + val3 * deltaTime; Vector3 val5 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized); Vector3 val6 = EffectiveWaggleDir(); Vector3 position = transform.position; if (useSpring) { val4 = Vector3.Lerp(val4, position + val6 * distanceLimit, 1f - Mathf.Pow(1f - springApproachRate, deltaTime)); } GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax); particlePos = ProjectOnHinge(val4, position, val5, val6, distanceLimit, effectiveAngleMin, effectiveAngleMax); particleVel = (particlePos - val2) / deltaTime; if ((Object)(object)hingeGraphic != (Object)null) { hingeGraphic.rotation = Quaternion.LookRotation(particlePos - transform.position, val5) * Quaternion.Euler(hingeGraphicRotationOffset); } } private Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) float num = ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection); num = Mathf.Clamp(num, angleMin, angleMax); Vector3 val = Quaternion.AngleAxis(num, hingeAxis) * hingeDirection; return val * distanceLimit + hingePivot; } private float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - hingePivot; Vector3 val2 = Vector3.ProjectOnPlane(val, hingeAxis); Vector3 normalized = ((Vector3)(ref val2)).normalized; return SignedAngle(hingeDirection, normalized, hingeAxis); } private float SignedAngle(Vector3 from, Vector3 to, Vector3 axis) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(from, to); return num * Mathf.Sign(Vector3.Dot(axis, Vector3.Cross(from, to))); } private void Start() { ResetParticlePos(); } private void Update() { if (!ManualExecution) { Execute(); } } private void OnDrawGizmosSelected() { //IL_002e: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00e3: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) if (debugGizmos && !((Object)(object)Selection.activeGameObject != (Object)(object)((Component)this).gameObject)) { Transform transform = ((Component)this).transform; Vector3 position = transform.position; Vector3 val = EffectiveWaggleDir(); Vector3 val2 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized); Vector3 val3 = position + val * distanceLimit; Gizmos.color = Color.white; float num = 0.01f; Gizmos.DrawLine(position + Vector3.left * num, position + Vector3.right * num); Gizmos.DrawLine(position + Vector3.up * num, position + Vector3.down * num); Gizmos.DrawLine(position + Vector3.forward * num, position + Vector3.back * num); Handles.BeginGUI(); Handles.Label(position, "Pivot"); Handles.EndGUI(); Gizmos.color = Color.green; Gizmos.DrawLine(position, val3); GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax); Vector3 val4 = Quaternion.AngleAxis(effectiveAngleMax, val2) * val; Vector3 val5 = Quaternion.AngleAxis(effectiveAngleMin, val2) * val; Vector3 val6 = position + val4 * distanceLimit; Vector3 val7 = position + val5 * distanceLimit; Gizmos.color = Color.cyan; Gizmos.DrawLine(position, val6); Gizmos.DrawLine(position, val7); Handles.color = Color.yellow; Handles.DrawWireArc(position, val2, val5, effectiveAngleMax - effectiveAngleMin, distanceLimit * 0.5f); if (Application.isPlaying) { Gizmos.color = Color.red; float num2 = 0.01f; Gizmos.DrawLine(particlePos + Vector3.left * num2, particlePos + Vector3.right * num2); Gizmos.DrawLine(particlePos + Vector3.up * num2, particlePos + Vector3.down * num2); Gizmos.DrawLine(particlePos + Vector3.forward * num2, particlePos + Vector3.back * num2); } } } } namespace BitWizrd.RevolverMod { public class DoubleActionEjectorRod : FVRInteractiveObject { public DoubleActionLoadingGateRevolver revolver; } public class DoubleActionLoadingGateEjectorRod : FVRInteractiveObject { public DoubleActionLoadingGateRevolver Revolver; public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); Revolver.EjectPrevCylinder(); } } public class DoubleActionLoadingGateRevolver : FVRFireArm { [Header("Single Action Revolver")] public bool AllowsSuppressor; public Transform Hammer; public Transform LoadingGate; public Transform Trigger; public Transform EjectorRod; public SingleActionRevolverCylinder Cylinder; public Transform HammerFanDir; private int m_curChamber; private float m_curChamberLerp; private float m_tarChamberLerp; [Header("Component Movement Params")] public float Hammer_Rot_Uncocked; public float Hammer_Rot_Halfcocked; public float Hammer_Rot_Cocked; public float LoadingGate_Rot_Closed; public float LoadingGate_Rot_Open; public float Trigger_Rot_Forward; public float Trigger_Rot_Rearward; public Vector3 EjectorRod_Pos_Forward; public Vector3 EjectorRod_Pos_Rearward; public bool DoesCylinderTranslateForward; public bool IsAccessTwoChambersBack; public Vector3 CylinderBackPos; public Vector3 CylinderFrontPos; [Header("Spinning Config")] public Transform PoseSpinHolder; public bool CanSpin = true; public bool CanFan = true; private bool m_isSpinning; [Header("StateToggling")] public bool StateToggles = true; private bool m_isStateToggled; public Transform Pose_Main; public Transform Pose_Toggled; public float TriggerThreshold = 0.9f; private float m_triggerFloat; private bool m_isHammerCocking; private bool m_isHammerCocked; private float m_hammerCockLerp; private float m_hammerCockSpeed = 10f; private float xSpinRot; private float xSpinVel; private float timeSinceColFire; [Header("DoubleAction Config")] private float m_tarTriggerFloat; private float m_tarRealTriggerFloat; private float m_triggerCurrentRot; private float m_curTriggerFloat; private float m_curRealTriggerFloat; private float lastTriggerRot; private RecockingState m_recockingState; private float m_recockingLerp; private bool m_shouldRecock; [SerializeField] private bool DoesFiringRecock = false; private bool m_hasTriggerCycled; public bool CanManuallyCockHammer; private bool m_isHammerLocked; private float m_hammerCurrentRot; private Vector2 RecockingSpeeds = new Vector2(8f, 3f); public Transform RecockingPiece; public Transform RecockingPoint_Forward; public Transform RecockingPoint_Rearward; public float ejectedRoundOffset; public bool doesToggleStateHalfRotatesCylinder; public int CurChamber { get { return m_curChamber; } set { m_curChamber = value % Cylinder.NumChambers; } } public int NextChamber => (m_curChamber + 1) % Cylinder.NumChambers; public int PrevChamber { get { int num = m_curChamber - 1; return (num >= 0) ? num : (Cylinder.NumChambers - 1); } } public int PrevChamber2 { get { int num = m_curChamber - 2; return (num >= 0) ? num : (Cylinder.NumChambers + num); } } public override void Awake() { //IL_0058: 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) ((FVRFireArm)this).Awake(); FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber item in chambers) { base.FChambers.Add(item); } if ((Object)(object)((FVRInteractiveObject)this).PoseOverride_Touch != (Object)null) { Pose_Main.localPosition = ((FVRInteractiveObject)this).PoseOverride_Touch.localPosition; Pose_Main.localRotation = ((FVRInteractiveObject)this).PoseOverride_Touch.localRotation; } } public override void BeginInteraction(FVRViveHand hand) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).BeginInteraction(hand); if (((FVRPhysicalObject)this).IsAltHeld) { return; } if (!m_isStateToggled) { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation; } } else { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation; } } } public override void UpdateInteraction(FVRViveHand hand) { //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); m_isSpinning = false; if (!((FVRPhysicalObject)this).IsAltHeld) { if (!m_isStateToggled) { if (hand.Input.TouchpadPressed && !hand.IsInStreamlinedMode && (double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45.0) { m_isSpinning = true; } if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } else if (hand.Input.TouchpadDown && (double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45.0 && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } else { if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown) { AdvanceCylinder(); } if (hand.Input.BYButtonDown && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } else if (hand.Input.TouchpadDown) { if ((double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45.0 && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); } else if ((double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45.0) { AdvanceCylinder(); } } if (hand.Input.TriggerDown) { EjectPrevCylinder(); } } } UpdateTriggerHammer(); UpdateCylinderRot(); UpdateCylinderRelease(); if (!((FVRInteractiveObject)this).IsHeld) { m_isSpinning = false; } } public override void EndInteraction(FVRViveHand hand) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) m_triggerFloat = 0f; ((FVRFireArm)this).EndInteraction(hand); ((FVRPhysicalObject)this).RootRigidbody.AddRelativeTorque(new Vector3(xSpinVel, 0f, 0f), (ForceMode)1); } public override void FVRFixedUpdate() { UpdateSpinning(); if ((double)timeSinceColFire < 3.0) { timeSinceColFire += Time.deltaTime; } ((FVRFireArm)this).FVRFixedUpdate(); UpdateRecocking(); } private void UpdateRecocking() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) RecockingState recockingState = m_recockingState; if ((int)recockingState != 1) { if ((int)recockingState == 2) { m_recockingLerp -= Time.deltaTime * RecockingSpeeds.y; if ((double)m_recockingLerp <= 0.0) { m_recockingState = (RecockingState)0; } m_recockingLerp = Mathf.Clamp(m_recockingLerp, 0f, 1f); RecockingPiece.position = Vector3.Lerp(RecockingPoint_Forward.position, RecockingPoint_Rearward.position, m_recockingLerp); } } else { m_recockingLerp += Time.deltaTime * RecockingSpeeds.x; if ((double)m_recockingLerp >= 1.0) { m_recockingState = (RecockingState)2; m_isHammerLocked = true; } m_recockingLerp = Mathf.Clamp(m_recockingLerp, 0f, 1f); RecockingPiece.position = Vector3.Lerp(RecockingPoint_Forward.position, RecockingPoint_Rearward.position, m_recockingLerp); } } private void InitiateRecock() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if ((int)m_recockingState == 0) { m_recockingLerp = 0f; m_recockingState = (RecockingState)1; } } private void UpdateTriggerHammer() { //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) if (CanFan && ((FVRInteractiveObject)this).IsHeld && !m_isStateToggled && !m_isHammerCocked && !m_isHammerCocking && (Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand != (Object)null) { Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld; if (Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, HammerFanDir.position) < 0.15f && Vector3.Angle(velLinearWorld, HammerFanDir.forward) < 60f && ((Vector3)(ref velLinearWorld)).magnitude > 1f) { CockHammer(10f); } } if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !m_isSpinning && !m_isStateToggled) { m_tarTriggerFloat = ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat; m_tarRealTriggerFloat = ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat; } else { m_tarTriggerFloat = 0f; m_tarRealTriggerFloat = 0f; } if (m_isHammerLocked) { m_tarTriggerFloat += 0.8f; m_triggerCurrentRot = Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, m_curTriggerFloat); } else { m_triggerCurrentRot = Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, m_curTriggerFloat); } m_curTriggerFloat = Mathf.MoveTowards(m_curTriggerFloat, m_tarTriggerFloat, Time.deltaTime * 14f); m_curRealTriggerFloat = Mathf.MoveTowards(m_curRealTriggerFloat, m_tarRealTriggerFloat, Time.deltaTime * 14f); if (DoesCylinderTranslateForward) { ((Component)Cylinder).transform.localPosition = Vector3.Lerp(CylinderBackPos, CylinderFrontPos, m_curTriggerFloat); } if (Mathf.Abs(m_triggerCurrentRot - lastTriggerRot) > 0.01f && (Object)(object)Trigger != (Object)null) { Trigger.localEulerAngles = new Vector3(m_triggerCurrentRot, 0f, 0f); } lastTriggerRot = m_triggerCurrentRot; if (m_shouldRecock) { m_shouldRecock = false; InitiateRecock(); } if (!m_hasTriggerCycled && !DoesFiringRecock) { bool flag = false; if (DoesFiringRecock && (int)m_recockingState != 0) { flag = true; } if (!flag && m_curTriggerFloat >= 0.98f && !((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed) { if (!m_isStateToggled) { m_hasTriggerCycled = true; m_isHammerLocked = false; CurChamber++; m_curChamberLerp = 0f; m_tarChamberLerp = 0f; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); Fire(); if (DoesFiringRecock) { m_shouldRecock = true; } } } else if (m_curTriggerFloat <= 0.08f && !m_isHammerLocked && CanManuallyCockHammer) { bool flag2 = false; if (DoesFiringRecock && (int)m_recockingState != 0) { flag2 = true; } if (!((FVRPhysicalObject)this).IsAltHeld && !flag2 && !m_isStateToggled) { if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode) { if (((FVRInteractiveObject)this).m_hand.Input.AXButtonDown) { CockHammer(5f); } } else if (((FVRInteractiveObject)this).m_hand.Input.TouchpadDown && Vector2.Angle(((FVRInteractiveObject)this).m_hand.Input.TouchpadAxes, Vector2.down) < 45f) { CockHammer(5f); } } } } else if (m_hasTriggerCycled && m_curRealTriggerFloat <= 0.08f) { m_hasTriggerCycled = false; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f); } m_hammerCurrentRot = (m_hasTriggerCycled ? (m_isHammerLocked ? Mathf.Lerp(m_hammerCurrentRot, Hammer_Rot_Cocked, Time.deltaTime * 10f) : Mathf.Lerp(m_hammerCurrentRot, Hammer_Rot_Uncocked, Time.deltaTime * 30f)) : (m_isHammerLocked ? Mathf.Lerp(m_hammerCurrentRot, Hammer_Rot_Cocked, Time.deltaTime * 10f) : Mathf.Lerp(Hammer_Rot_Uncocked, Hammer_Rot_Cocked, m_curTriggerFloat))); if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(m_hammerCurrentRot, 0f, 0f); } if ((Object)(object)LoadingGate != (Object)null) { LoadingGate.localEulerAngles = ((!m_isStateToggled) ? new Vector3(0f, 0f, LoadingGate_Rot_Closed) : new Vector3(0f, 0f, LoadingGate_Rot_Open)); } } private void UpdateCylinderRelease() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (m_isHammerLocked) { m_tarChamberLerp = 1f; } else if (!m_hasTriggerCycled && doesToggleStateHalfRotatesCylinder && m_isStateToggled) { m_tarChamberLerp = 0.5f; } else if (!m_hasTriggerCycled) { m_tarChamberLerp = m_curTriggerFloat * 1.4f; } m_curChamberLerp = Mathf.Lerp(m_curChamberLerp, m_tarChamberLerp, Time.deltaTime * 16f); int num = (CurChamber + 1) % Cylinder.NumChambers; ((Component)Cylinder).transform.localRotation = Quaternion.Slerp(Cylinder.GetLocalRotationFromCylinder(CurChamber), Cylinder.GetLocalRotationFromCylinder(num), m_curChamberLerp); } private void AdvanceCylinder() { CurChamber++; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f); } public void EjectPrevCylinder() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (m_isStateToggled) { int num = PrevChamber; if (IsAccessTwoChambersBack) { num = PrevChamber2; } FVRFireArmChamber val = Cylinder.Chambers[num]; if (val.IsFull) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } val.EjectRound(((Component)val).transform.position + ((Component)val).transform.forward * ejectedRoundOffset, -((Component)val).transform.forward, Vector3.zero, false); } } private void Fire() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); if (Cylinder.Chambers[CurChamber].Fire()) { FVRFireArmChamber val = Cylinder.Chambers[CurChamber]; ((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f); ((FVRFireArm)this).PlayAudioGunShot(val.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { val.IsSpent = false; val.UpdateProxyDisplay(); } } } private void UpdateCylinderRot() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (m_isStateToggled) { int num = PrevChamber; if (IsAccessTwoChambersBack) { num = PrevChamber2; } for (int i = 0; i < Cylinder.Chambers.Length; i++) { Cylinder.Chambers[i].IsAccessible = i == num; } ((Component)Cylinder).transform.localRotation = Cylinder.GetLocalRotationFromCylinder(CurChamber); } else { for (int j = 0; j < Cylinder.Chambers.Length; j++) { Cylinder.Chambers[j].IsAccessible = false; } } } private void UpdateSpinning() { //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) if (!((FVRInteractiveObject)this).IsHeld) { m_isSpinning = false; } if (m_isSpinning) { Vector3 val = Vector3.zero; if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) { val = ((FVRInteractiveObject)this).m_hand.Input.VelLinearLocal; } float num = Mathf.Clamp(Vector3.Dot(((Vector3)(ref val)).normalized, ((Component)this).transform.up), 0f - ((Vector3)(ref val)).magnitude, ((Vector3)(ref val)).magnitude); if (Mathf.Abs(xSpinVel) < 90f) { xSpinVel += num * Time.deltaTime * 600f; } else if (Mathf.Sign(num) == Mathf.Sign(xSpinVel)) { xSpinVel += num * Time.deltaTime * 600f; } if (Mathf.Abs(xSpinVel) < 90f) { if (Vector3.Dot(((Component)this).transform.up, Vector3.down) >= 0f && Mathf.Sign(xSpinVel) == 1f) { xSpinVel += Time.deltaTime * 50f; } if (Vector3.Dot(((Component)this).transform.up, Vector3.down) < 0f && Mathf.Sign(xSpinVel) == -1f) { xSpinVel -= Time.deltaTime * 50f; } } xSpinVel = Mathf.Clamp(xSpinVel, -500f, 500f); xSpinRot += xSpinVel * Time.deltaTime * 5f; PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f); xSpinVel = Mathf.Lerp(xSpinVel, 0f, Time.deltaTime * 0.6f); } else { xSpinRot = 0f; xSpinVel = 0f; PoseSpinHolder.localRotation = Quaternion.RotateTowards(PoseSpinHolder.localRotation, Quaternion.identity, Time.deltaTime * 500f); PoseSpinHolder.localEulerAngles = new Vector3(PoseSpinHolder.localEulerAngles.x, 0f, 0f); } } private void CockHammer(float speed) { if (!m_isHammerLocked && !m_isHammerCocking && !m_isStateToggled) { m_isHammerLocked = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } private void ToggleState() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) m_isHammerLocked = false; m_isStateToggled = !m_isStateToggled; if (!((FVRPhysicalObject)this).IsAltHeld) { if (!m_isStateToggled) { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation; } } else { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation; } } } m_isHammerCocking = false; m_isHammerCocked = false; m_hammerCockLerp = 0f; } public override void OnCollisionEnter(Collision col) { ((FVRPhysicalObject)this).OnCollisionEnter(col); } public override List GetChamberRoundList() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) bool flag = false; List list = new List(); for (int i = 0; i < Cylinder.Chambers.Length; i++) { if (Cylinder.Chambers[i].IsFull) { list.Add(Cylinder.Chambers[i].GetRound().RoundClass); flag = true; } } return (!flag) ? null : list; } public override void SetLoadedChambers(List rounds) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count <= 0) { return; } for (int i = 0; i < Cylinder.Chambers.Length; i++) { if (i < rounds.Count) { Cylinder.Chambers[i].Autochamber(rounds[i]); } } } } } public class GunStockLace : MonoBehaviour { public float length = 0.5f; public float gravity = 9.81f; public float damping = 0.05f; public float maxDeviationAngle = 45f; public LayerMask collisionMask; public bool showGizmos = false; private Vector3 pendulumDirection; private Vector3 angularVelocity; private Quaternion baseRotation; private Vector3 restDirection; private Vector3 previousPosition; private void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) baseRotation = ((Component)this).transform.rotation; restDirection = baseRotation * -Vector3.up; pendulumDirection = restDirection; previousPosition = ((Component)this).transform.position; } private void FixedUpdate() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - previousPosition; previousPosition = ((Component)this).transform.position; float fixedDeltaTime = Time.fixedDeltaTime; Vector3 val2 = Vector3.Cross(((Vector3)(ref pendulumDirection)).normalized, Vector3.down) * gravity / length; Vector3 val3 = val * 10f / fixedDeltaTime; angularVelocity += (val2 + val3) * fixedDeltaTime; angularVelocity *= Mathf.Clamp01(1f - damping * fixedDeltaTime); Quaternion val4 = Quaternion.Euler(angularVelocity * fixedDeltaTime * 57.29578f); pendulumDirection = val4 * pendulumDirection; HandleCollisionLimits(); ClampToMaxAngle(); ((Component)this).transform.rotation = Quaternion.FromToRotation(-Vector3.up, pendulumDirection) * baseRotation; } private void HandleCollisionLimits() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position, pendulumDirection, ref val, length, LayerMask.op_Implicit(collisionMask))) { Vector3 normal = ((RaycastHit)(ref val)).normal; Vector3 val2 = Vector3.ProjectOnPlane(pendulumDirection, normal); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Vector3.Angle(pendulumDirection, normalized); pendulumDirection = Vector3.RotateTowards(pendulumDirection, normalized, num * ((float)Math.PI / 180f), 0f); angularVelocity = Vector3.ProjectOnPlane(angularVelocity, normal); } } private void ClampToMaxAngle() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(restDirection, pendulumDirection); if (num > maxDeviationAngle) { pendulumDirection = Vector3.RotateTowards(restDirection, pendulumDirection, maxDeviationAngle * ((float)Math.PI / 180f), 0f); angularVelocity *= 0.5f; } } private void OnDrawGizmos() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (showGizmos) { Gizmos.color = Color.yellow; Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + pendulumDirection * length); Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position + pendulumDirection * length, 0.02f); } } } public class HuntDollarSR : MonoBehaviour { private IEnumerator Start() { yield return (object)new WaitForSeconds(3f); string str = "CharcoalBriquette(Clone)"; ((Object)((Component)this).gameObject).name = str; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Component val = (Component)(object)componentsInChildren[i]; ((Object)val.gameObject).name = str; } } } namespace BitWizrd.Revolver { public class Lemat : BreakActionWeapon { public enum FireMode { Revolver, Shotgun } [Header("Shotgun Hinge Setup")] public HingeJoint hinge; public float hingeLimit = 45f; public float hingeEjectLimit = 30f; [Header("Lemat Mode (Default Revolver)")] public FireMode CurrentMode = FireMode.Revolver; [Header("Barrels & Chambers")] public Transform RevolverMuzzle; public Transform ShotgunMuzzle; public FVRFireArmChamber ShotgunChamber; [Header("Shotgun Ejection")] public float ShotgunEjectOffset = -0.06f; public float ShotgunEjectSpeed = -2.5f; [Header("Selector Pin")] public Transform FireSelectorPin; public Vector3 RevolverPinRotation = Vector3.zero; public Vector3 ShotgunPinRotation = new Vector3(90f, 0f, 0f); [Header("Revolver Cylinder")] public SingleActionRevolverCylinder Cylinder; [Header("Revolver Mechanics")] public Transform Hammer; public Transform LoadingGate; public Transform Trigger; [Tooltip("Trigger rotates on X-axis.")] public float Trigger_Rot_Forward = 0f; public float Trigger_Rot_Rearward = 25f; private bool hasTriggeredUpSinceBegin = false; [Tooltip("Rotate revolve gate around Z-axis.")] public float LoadingGate_Rot_Closed = 0f; public float LoadingGate_Rot_Open = 40f; [Tooltip("Revolver hammer angles (X-axis).")] public float Hammer_Rot_Uncocked_Revolver = 0f; public float Hammer_Rot_Cocked_Revolver = 30f; [Tooltip("Shotgun hammer angles (X-axis).")] public float Hammer_Rot_Uncocked_Shotgun = 0f; public float Hammer_Rot_Cocked_Shotgun = 30f; [Tooltip("Revolver hammer angle for half-cock (X-axis).")] public float Hammer_Rot_Halfcock_Revolver = 15f; [Tooltip("Trigger threshold to fire.")] public float TriggerThreshold = 0.9f; [Header("Cylinder Mechanics (Classic Single-Action)")] public bool DoesCylinderTranslateForward; public bool DoesHalfCockHalfRotCylinder; public bool HasTransferBarSafety; public bool IsAccessTwoChambersBack; public Vector3 CylinderBackPos; public Vector3 CylinderFrontPos; [Header("Optional Spin Feature (Revolver Only)")] public Transform PoseSpinHolder; public bool CanSpin = true; [Tooltip("Allows revolve gate toggling (half-cock).")] public bool StateToggles = true; [Header("Revolver Muzzle Effects")] public int RevolverMuzzleFireIndex = 0; public int RevolverMuzzleSmokeIndex = 1; public int RevolverGasOutIndex = 2; [Header("Shotgun Muzzle Effects")] public int ShotgunMuzzleFireIndex = 0; public int ShotgunMuzzleSmokeIndex = 1; public int ShotgunGasOutIndex = 2; [Header("Revolver Pose Toggling (like SingleActionRevolver)")] public Transform Pose_Main; public Transform Pose_Toggled; public bool StateTogglesPose = true; [Header("LematMk2-Style Audio / Recoil")] public FVRFireArmRecoilProfile ShotgunRecoilProfile; [Header("Fanning")] public bool CanFan = true; public Transform HammerFanDir; public float FanDistance = 0.15f; public float FanAngle = 60f; public float FanVelocityThreshold = 1f; [Header("Foregrip Reference")] public LematForegrip ForegripRef; [Header("Shotgun Ammo Type")] public FireArmRoundType ShotgunRoundType = (FireArmRoundType)21; private FireArmRoundType m_originalRoundType; private bool m_hasInitializedRoundTypes = false; private bool _inputsBlocked = false; private bool m_isGateOpen; public bool m_isShotgunOpen; public bool foregripLatch; private bool m_isHammerCocked; private bool m_isHammerCocking; private float m_hammerCockLerp; private float m_hammerCockSpeed = 10f; private float Hammer_Rot_Uncocked; private float Hammer_Rot_Cocked; private int m_curChamber; private float m_curChamberLerp; private float m_tarChamberLerp; private float timeSinceColFire = 999f; private bool m_isSpinning; private float xSpinRot; private float xSpinVel; private bool mWasShotgunChamberFull; private bool mToggleDebounce; private Vector3 m_TargetSelectorRotation; private float m_SelectorPinSpeed = 10f; private bool mLemat_HasUnlockedBreak; private bool mLemat_HasEjectedThisOpen; private Vector3 m_HingeStartPos; public bool m_IsLatchHeldOpen; public bool TriggerReset = true; private float prevTriggerFloat = 0f; private bool m_isStateToggled = false; private List m_allChambers = new List(); private bool m_isFilteringChambers = false; private FireArmRoundType? m_lastFilteredType = null; private FireArmRoundType m_savedRoundType; public int CurChamber { get { return m_curChamber; } set { m_curChamber = value % Cylinder.NumChambers; } } public int PrevChamber { get { int num = m_curChamber - 1; return (num >= 0) ? num : (Cylinder.NumChambers - 1); } } public int PrevChamber2 { get { int num = m_curChamber - 2; return (num >= 0) ? num : (Cylinder.NumChambers + num); } } public override void Awake() { //IL_000f: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) if (!m_hasInitializedRoundTypes) { m_originalRoundType = ((FVRFireArm)this).RoundType; m_hasInitializedRoundTypes = true; } ((BreakActionWeapon)this).Awake(); ((BreakActionWeapon)this).SetHasLatchButton(false); ((FVRFireArm)this).FChambers = new List(); if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null) { val.Firearm = (FVRFireArm)(object)this; ((FVRFireArm)this).FChambers.Add(val); } } } if ((Object)(object)ShotgunChamber != (Object)null) { ShotgunChamber.Firearm = (FVRFireArm)(object)this; ShotgunChamber.RoundType = ShotgunRoundType; if (!((FVRFireArm)this).FChambers.Contains(ShotgunChamber)) { ((FVRFireArm)this).FChambers.Add(ShotgunChamber); } } m_allChambers.Clear(); m_allChambers.AddRange(((FVRFireArm)this).FChambers); CurrentMode = FireMode.Revolver; Hammer_Rot_Uncocked = Hammer_Rot_Uncocked_Revolver; Hammer_Rot_Cocked = Hammer_Rot_Cocked_Revolver; m_TargetSelectorRotation = RevolverPinRotation; if ((Object)(object)FireSelectorPin != (Object)null) { FireSelectorPin.localEulerAngles = RevolverPinRotation; } m_IsLatchHeldOpen = false; m_isShotgunOpen = false; mLemat_HasUnlockedBreak = false; mLemat_HasEjectedThisOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); if ((Object)(object)hinge != (Object)null) { m_HingeStartPos = ((Component)hinge).transform.localPosition; } } public override void BeginInteraction(FVRViveHand hand) { ((FVRFireArm)this).BeginInteraction(hand); if ((Object)(object)hand != (Object)null && hand.Input.TriggerFloat <= 0.45f) { hasTriggeredUpSinceBegin = true; } else { hasTriggeredUpSinceBegin = false; } } public override Transform GetMuzzle() { return (CurrentMode != 0) ? ShotgunMuzzle : RevolverMuzzle; } private void FireMuzzleFire(int index) { ((FVRFireArm)this).FireMuzzleSmoke(index); } public void Fire() { if ((CurrentMode == FireMode.Revolver && m_isGateOpen) || (CurrentMode == FireMode.Shotgun && m_isShotgunOpen)) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); } else if (CurrentMode == FireMode.Revolver) { if ((Object)(object)Cylinder == (Object)null || Cylinder.Chambers == null || Cylinder.NumChambers == 0) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); return; } FVRFireArmChamber val = Cylinder.Chambers[m_curChamber]; if ((Object)(object)val == (Object)null || !val.IsFull || val.IsSpent || (Object)(object)val.GetRound() == (Object)null) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); } else if (val.Fire()) { FVRFireArmRound round = val.GetRound(); ((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); FireMuzzleFire(RevolverMuzzleFireIndex); ((FVRFireArm)this).FireMuzzleSmoke(RevolverMuzzleSmokeIndex); ((FVRFireArm)this).AddGas(RevolverGasOutIndex); ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f); HandleRoundDischarge(val, round); } } else if ((Object)(object)ShotgunChamber == (Object)null || !ShotgunChamber.IsFull || ShotgunChamber.IsSpent || (Object)(object)ShotgunChamber.GetRound() == (Object)null) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); } else if (ShotgunChamber.Fire()) { FVRFireArmRound round2 = ShotgunChamber.GetRound(); ((FVRFireArm)this).Fire(ShotgunChamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); FireMuzzleFire(ShotgunMuzzleFireIndex); ((FVRFireArm)this).FireMuzzleSmoke(ShotgunMuzzleSmokeIndex); ((FVRFireArm)this).AddGas(ShotgunGasOutIndex); ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), ShotgunRecoilProfile, 1f); HandleRoundDischarge(ShotgunChamber, round2); } } private void HandleRoundDischarge(FVRFireArmChamber chamber, FVRFireArmRound round) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)round != (Object)null) { ((FVRFireArm)this).PlayAudioGunShot(round, GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (round.IsCaseless && !chamber.SuppressCaselessDeletion) { chamber.SetRound((FVRFireArmRound)null, false); } } if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { chamber.IsSpent = false; chamber.UpdateProxyDisplay(); } } public override void FVRUpdate() { ((FVRFireArm)this).FVRUpdate(); UpdateHammerShared(); UpdateFanning(); UpdateSpinning(); UpdateTriggerLogic(); if (CurrentMode == FireMode.Revolver) { UpdateCylinderRot(); } UpdateChamberStateFeedback(); UpdateSelectorPin(); UpdateLoadingGate(); if (StateTogglesPose && CurrentMode == FireMode.Revolver) { ToggleRevolverPose(m_isGateOpen); } CheckQuickBeltSlotsForAmmo(); } private void UpdateSelectorPin() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)FireSelectorPin == (Object)null) && (CurrentMode != 0 || !m_isGateOpen)) { float x = FireSelectorPin.localEulerAngles.x; float x2 = m_TargetSelectorRotation.x; float num = Mathf.LerpAngle(x, x2, Time.deltaTime * m_SelectorPinSpeed); FireSelectorPin.localEulerAngles = new Vector3(num, 0f, 0f); } } private void UpdateLoadingGate() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (m_isShotgunOpen) { if ((Object)(object)LoadingGate != (Object)null) { LoadingGate.localEulerAngles = new Vector3(0f, 0f, LoadingGate_Rot_Closed); } } else if (CurrentMode == FireMode.Revolver && (Object)(object)LoadingGate != (Object)null) { float num = ((!m_isGateOpen) ? LoadingGate_Rot_Closed : LoadingGate_Rot_Open); LoadingGate.localEulerAngles = new Vector3(0f, 0f, num); } else if ((Object)(object)LoadingGate != (Object)null) { LoadingGate.localEulerAngles = new Vector3(0f, 0f, LoadingGate_Rot_Closed); } } public override void FVRFixedUpdate() { ((BreakActionWeapon)this).FVRFixedUpdate(); timeSinceColFire += Time.deltaTime; if (m_isShotgunOpen && !((BreakActionWeapon)this).IsLatched && (Object)(object)hinge != (Object)null && !mLemat_HasEjectedThisOpen && Mathf.Abs(hinge.angle) >= hingeEjectLimit) { mLemat_HasEjectedThisOpen = true; if (base.m_EjectsOnOpen) { PopOutEmpties(); } } UpdateChamberAccessibility(); } private void UpdateChamberAccessibility() { if (CurrentMode == FireMode.Shotgun && (Object)(object)ShotgunChamber != (Object)null) { ShotgunChamber.IsAccessible = m_isShotgunOpen && !((BreakActionWeapon)this).IsLatched; } } private void UpdateChamberStateFeedback() { if ((Object)(object)ShotgunChamber != (Object)null && ShotgunChamber.IsFull && !mWasShotgunChamberFull) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)20, 1f); } mWasShotgunChamberFull = (Object)(object)ShotgunChamber != (Object)null && ShotgunChamber.IsFull; } public override void UpdateInteraction(FVRViveHand hand) { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) ((BreakActionWeapon)this).UpdateInteraction(hand); if ((Object)(object)hand == (Object)null) { return; } if (hand.IsInStreamlinedMode) { if (CurrentMode == FireMode.Revolver) { if (hand.Input.BYButtonDown) { ToggleRevolverGate(!m_isGateOpen); } if (hand.Input.AXButtonDown) { if (m_isGateOpen) { AdvanceCylinder(); } else if (!m_isHammerCocked && !m_isHammerCocking) { CockHammerRevolver(5f); } else if (m_isHammerCocked) { ToggleFireMode(); } } } else { if (hand.Input.BYButtonPressed) { m_IsLatchHeldOpen = true; } else { m_IsLatchHeldOpen = false; } if (hand.Input.AXButtonDown) { if (!m_isHammerCocked && !m_isHammerCocking) { CockHammerShotgun(5f); } else if (m_isHammerCocked) { ToggleFireMode(); } } } } else { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (CurrentMode == FireMode.Revolver) { if (hand.Input.TouchpadDown) { float num = Vector2.Angle(touchpadAxes, Vector2.up); float num2 = Vector2.Angle(touchpadAxes, Vector2.down); float num3 = Vector2.Angle(touchpadAxes, Vector2.left); float num4 = Vector2.Angle(touchpadAxes, Vector2.right); if (num < 45f) { m_isSpinning = true; } else if (num2 < 45f) { if (!m_isHammerCocked && !m_isHammerCocking) { CockHammerRevolver(5f); } else if (m_isHammerCocked) { ToggleFireMode(); } } else if (num3 < 45f) { ToggleRevolverGate(!m_isGateOpen); } else if (num4 < 45f && m_isGateOpen) { AdvanceCylinder(); } } } else if (hand.Input.TouchpadPressed) { if (touchpadAxes.y > 0.1f) { m_IsLatchHeldOpen = true; } else { m_IsLatchHeldOpen = false; } if (hand.Input.TouchpadDown && touchpadAxes.y < -0.1f) { if (!m_isHammerCocked && !m_isHammerCocking) { CockHammerShotgun(5f); } else if (m_isHammerCocked) { ToggleFireMode(); } } } else { m_IsLatchHeldOpen = false; } } m_IsLatchHeldOpen = m_IsLatchHeldOpen || foregripLatch; if (m_IsLatchHeldOpen) { if (!m_isShotgunOpen && !m_isGateOpen) { ((BreakActionWeapon)this).SetIsExternallyUnlatched(true); BreakOpen(); } } else if ((Object)(object)hinge != (Object)null && ((Component)hinge).transform.localEulerAngles.x <= 1f) { BreakClose(); } } public override void EndInteraction(FVRViveHand hand) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) ((BreakActionWeapon)this).EndInteraction(hand); if (m_isSpinning && (Object)(object)PoseSpinHolder != (Object)null && (Object)(object)hand != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.AddRelativeTorque(new Vector3(xSpinVel, 0f, 0f), (ForceMode)1); } m_isSpinning = false; } private void UpdateTriggerLogic() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) float num = ((!((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)) ? 0f : ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat); if ((Object)(object)Trigger != (Object)null) { Trigger.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, num), 0f, 0f); } if (num <= 0.45f) { hasTriggeredUpSinceBegin = true; TriggerReset = true; } float num2 = ((!hasTriggeredUpSinceBegin) ? 0f : num); if (!(num2 > TriggerThreshold)) { return; } if (CurrentMode == FireMode.Revolver) { if (m_isGateOpen && !m_isShotgunOpen) { if (TriggerReset) { EjectAccessibleRevolverChamber(); TriggerReset = false; } } else if (!m_isGateOpen && m_isShotgunOpen) { if (m_isHammerCocked && TriggerReset) { ResetHammerState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); TriggerReset = false; } } else if (m_isHammerCocked) { m_isHammerCocked = false; m_isHammerCocking = false; m_hammerCockLerp = 0f; Fire(); } } else { if (CurrentMode != FireMode.Shotgun) { return; } if (m_isShotgunOpen) { if (m_isHammerCocked && TriggerReset) { ResetHammerState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); TriggerReset = false; } } else if (m_isHammerCocked) { ResetHammerState(); Fire(); } } } private void ResetHammerState() { m_isHammerCocked = false; m_isHammerCocking = false; m_hammerCockLerp = 0f; } private void UpdateHammerShared() { //IL_016f: Unknown result type (might be due to invalid IL or missing references) if (m_isHammerCocking) { if (m_hammerCockLerp < 1f) { m_hammerCockLerp += Time.deltaTime * m_hammerCockSpeed; } else { m_hammerCockLerp = 1f; m_isHammerCocking = false; m_isHammerCocked = true; if (CurrentMode == FireMode.Revolver && (Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { m_curChamber++; if (m_curChamber >= Cylinder.NumChambers) { m_curChamber = 0; } m_curChamberLerp = 0f; m_tarChamberLerp = 0f; } } } if (CurrentMode == FireMode.Revolver && m_isGateOpen && !m_isHammerCocking && !m_isHammerCocked) { float num = Hammer_Rot_Cocked_Revolver - Hammer_Rot_Uncocked_Revolver; if (Mathf.Abs(num) > 0.001f) { float num2 = (Hammer_Rot_Halfcock_Revolver - Hammer_Rot_Uncocked_Revolver) / num; num2 = Mathf.Clamp01(num2); m_hammerCockLerp = num2; } } if ((Object)(object)Hammer != (Object)null) { float num3 = Mathf.Lerp(Hammer_Rot_Uncocked, Hammer_Rot_Cocked, m_hammerCockLerp); Hammer.localEulerAngles = new Vector3(num3, 0f, 0f); } } private void UpdateFanning() { //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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00d9: Unknown result type (might be due to invalid IL or missing references) if (!CanFan || !((FVRInteractiveObject)this).IsHeld || (Object)(object)((FVRInteractiveObject)this).m_hand == (Object)null || (Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand == (Object)null || (Object)(object)HammerFanDir == (Object)null || m_isHammerCocked || m_isHammerCocking || (CurrentMode == FireMode.Revolver && m_isGateOpen)) { return; } Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld; float num = Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, HammerFanDir.position); if (num < FanDistance && Vector3.Angle(velLinearWorld, HammerFanDir.forward) < FanAngle && ((Vector3)(ref velLinearWorld)).magnitude > FanVelocityThreshold) { if (CurrentMode == FireMode.Revolver) { CockHammerRevolver(10f); } else { CockHammerShotgun(10f); } } } private void UpdateSpinning() { //IL_01f6: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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) if (!CanSpin || !((FVRInteractiveObject)this).IsHeld || (Object)(object)PoseSpinHolder == (Object)null) { return; } bool isSpinning = false; if (!m_isGateOpen && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null && !m_isHammerCocking && !m_isHammerCocked && !((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed) { Vector2 touchpadAxes = ((FVRInteractiveObject)this).m_hand.Input.TouchpadAxes; if (Vector2.Angle(touchpadAxes, Vector2.up) < 45f) { isSpinning = true; } } m_isSpinning = isSpinning; if (m_isSpinning) { Vector3 velLinearLocal = ((FVRInteractiveObject)this).m_hand.Input.VelLinearLocal; float num = Vector3.Dot(((Vector3)(ref velLinearLocal)).normalized, ((Component)this).transform.up); if (Mathf.Abs(xSpinVel) < 90f) { xSpinVel += num * Time.deltaTime * 600f; } else if (Mathf.Sign(num) == Mathf.Sign(xSpinVel)) { xSpinVel += num * Time.deltaTime * 600f; } xSpinVel = Mathf.Clamp(xSpinVel, -500f, 500f); xSpinRot += xSpinVel * Time.deltaTime * 5f; PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f); xSpinVel = Mathf.Lerp(xSpinVel, 0f, Time.deltaTime * 0.6f); } else { xSpinRot = 0f; xSpinVel = 0f; PoseSpinHolder.localRotation = Quaternion.RotateTowards(PoseSpinHolder.localRotation, Quaternion.identity, Time.deltaTime * 500f); PoseSpinHolder.localEulerAngles = new Vector3(PoseSpinHolder.localEulerAngles.x, 0f, 0f); } } private void UpdateCylinderRot() { //IL_01fd: 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_0215: 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) //IL_00e5: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) if (m_isShotgunOpen) { for (int i = 0; i < Cylinder.Chambers.Length; i++) { Cylinder.Chambers[i].IsAccessible = false; } } else if (m_isStateToggled || m_isGateOpen) { int num = PrevChamber; if (IsAccessTwoChambersBack) { num = PrevChamber2; } for (int j = 0; j < Cylinder.Chambers.Length; j++) { Cylinder.Chambers[j].IsAccessible = j == num; } if (DoesHalfCockHalfRotCylinder) { int num2 = (CurChamber + 1) % Cylinder.NumChambers; ((Component)Cylinder).transform.localRotation = Quaternion.Slerp(Cylinder.GetLocalRotationFromCylinder(CurChamber), Cylinder.GetLocalRotationFromCylinder(num2), 0.5f); } else { ((Component)Cylinder).transform.localRotation = Cylinder.GetLocalRotationFromCylinder(CurChamber); } if (DoesCylinderTranslateForward) { ((Component)Cylinder).transform.localPosition = CylinderBackPos; } } else { for (int k = 0; k < Cylinder.Chambers.Length; k++) { Cylinder.Chambers[k].IsAccessible = false; } m_tarChamberLerp = ((!m_isHammerCocking) ? 0f : m_hammerCockLerp); m_curChamberLerp = Mathf.Lerp(m_curChamberLerp, m_tarChamberLerp, Time.deltaTime * 16f); int num3 = (CurChamber + 1) % Cylinder.NumChambers; ((Component)Cylinder).transform.localRotation = Quaternion.Slerp(Cylinder.GetLocalRotationFromCylinder(CurChamber), Cylinder.GetLocalRotationFromCylinder(num3), m_curChamberLerp); if (DoesCylinderTranslateForward) { ((Component)Cylinder).transform.localPosition = Vector3.Lerp(CylinderBackPos, CylinderFrontPos, m_hammerCockLerp); } } } private void CockHammerRevolver(float speed) { if (!m_isHammerCocked && !m_isHammerCocking) { m_hammerCockSpeed = speed; m_isHammerCocking = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } private void CockHammerShotgun(float speed) { if (!m_isHammerCocked && !m_isHammerCocking) { m_hammerCockSpeed = speed; m_isHammerCocking = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } private void ToggleFireMode() { //IL_0085: 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_0053: 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_00a8: 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_00ad: Unknown result type (might be due to invalid IL or missing references) if (!m_isGateOpen) { bool isHammerCocked = m_isHammerCocked; bool isHammerCocking = m_isHammerCocking; float hammerCockLerp = m_hammerCockLerp; if (CurrentMode == FireMode.Revolver) { CurrentMode = FireMode.Shotgun; Hammer_Rot_Uncocked = Hammer_Rot_Uncocked_Shotgun; Hammer_Rot_Cocked = Hammer_Rot_Cocked_Shotgun; ((FVRFireArm)this).RoundType = ShotgunRoundType; } else { CurrentMode = FireMode.Revolver; Hammer_Rot_Uncocked = Hammer_Rot_Uncocked_Revolver; Hammer_Rot_Cocked = Hammer_Rot_Cocked_Revolver; ((FVRFireArm)this).RoundType = m_originalRoundType; } m_TargetSelectorRotation = ((CurrentMode != 0) ? ShotgunPinRotation : RevolverPinRotation); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f); m_isHammerCocked = isHammerCocked; m_isHammerCocking = isHammerCocking; m_hammerCockLerp = hammerCockLerp; } } private void ToggleRevolverPose(bool openGatePose) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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) if ((Object)(object)Pose_Main == (Object)null || (Object)(object)Pose_Toggled == (Object)null || ((FVRPhysicalObject)this).IsAltHeld || !((FVRInteractiveObject)this).IsHeld) { return; } if (!openGatePose) { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation; } } else { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation; } } } private void ToggleRevolverGate(bool open) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (m_isShotgunOpen || CurrentMode != 0 || m_isGateOpen == open) { return; } m_isGateOpen = open; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)((!open) ? 31 : 30), 1f); if (!open) { ResetHammerState(); if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(Hammer_Rot_Uncocked, 0f, 0f); } return; } m_isHammerCocking = false; m_isHammerCocked = false; float num = Hammer_Rot_Cocked_Revolver - Hammer_Rot_Uncocked_Revolver; if (Mathf.Abs(num) > 0.001f) { float num2 = (Hammer_Rot_Halfcock_Revolver - Hammer_Rot_Uncocked_Revolver) / num; num2 = Mathf.Clamp01(num2); m_hammerCockLerp = num2; } } private void AdvanceCylinder() { m_curChamber++; if (m_curChamber >= Cylinder.NumChambers) { m_curChamber = 0; } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)0, 1f); } private void EjectAccessibleRevolverChamber() { //IL_0068: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Cylinder == (Object)null || Cylinder.Chambers == null) { return; } for (int i = 0; i < Cylinder.Chambers.Length; i++) { FVRFireArmChamber val = Cylinder.Chambers[i]; if (val.IsAccessible) { if (val.IsFull) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } val.EjectRound(((Component)val).transform.position + ((Component)val).transform.forward * 0.0025f, -((Component)val).transform.forward, Vector3.zero, false); break; } } } public void PopOutEmpties() { if ((Object)(object)ShotgunChamber != (Object)null && ShotgunChamber.IsFull && ShotgunChamber.IsSpent) { PopOutRound(ShotgunChamber); } } public void PopOutRound(FVRFireArmChamber chamber) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)21, 1f); chamber.EjectRound(((Component)chamber).transform.position + ((Component)chamber).transform.forward * base.EjectOffset, ((Component)chamber).transform.forward * base.EjectSpeed, Vector3.right, false); ((FVRFireArm)this).AddGas(ShotgunGasOutIndex); } public void BreakOpen() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (!m_isShotgunOpen && !m_isGateOpen) { m_isShotgunOpen = true; ((BreakActionWeapon)this).SetIsExternallyUnlatched(true); if (CurrentMode == FireMode.Revolver) { ((FVRFireArm)this).RoundType = ShotgunRoundType; } if ((Object)(object)hinge != (Object)null) { JointLimits limits = hinge.limits; ((JointLimits)(ref limits)).max = hingeLimit; hinge.limits = limits; } if ((Object)(object)ShotgunChamber != (Object)null) { ShotgunChamber.IsAccessible = true; } } } public void BreakClose() { //IL_0034: 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_0057: 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_006f: 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_isShotgunOpen) { m_isShotgunOpen = false; mLemat_HasEjectedThisOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); if (CurrentMode == FireMode.Revolver) { ((FVRFireArm)this).RoundType = m_originalRoundType; } if ((Object)(object)hinge != (Object)null) { JointLimits limits = hinge.limits; ((JointLimits)(ref limits)).max = 0f; hinge.limits = limits; ((Component)hinge).transform.localPosition = m_HingeStartPos; } if ((Object)(object)ShotgunChamber != (Object)null) { ShotgunChamber.IsAccessible = false; } } } private void CheckQuickBeltSlotsForAmmo() { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) FVRViveHand val = null; FVRViveHand[] hands = GM.CurrentMovementManager.Hands; foreach (FVRViveHand val2 in hands) { if ((Object)(object)val2.CurrentInteractable == (Object)(object)this) { val = val2; break; } } if ((Object)(object)val == (Object)null) { return; } FVRViveHand val3 = ((!((Object)(object)val == (Object)(object)GM.CurrentMovementManager.Hands[0])) ? GM.CurrentMovementManager.Hands[0] : GM.CurrentMovementManager.Hands[1]); if ((Object)(object)val3.CurrentHoveredQuickbeltSlot != (Object)null && val3.CurrentHoveredQuickbeltSlot.HeldObject is FVRFireArmRound) { FVRInteractiveObject heldObject = val3.CurrentHoveredQuickbeltSlot.HeldObject; FVRFireArmRound val4 = (FVRFireArmRound)(object)((heldObject is FVRFireArmRound) ? heldObject : null); if (m_isFilteringChambers) { FireArmRoundType? lastFilteredType = m_lastFilteredType; if (lastFilteredType.GetValueOrDefault() == val4.RoundType && lastFilteredType.HasValue) { return; } } FilterChambersForRoundType(val4.RoundType); } else if (m_isFilteringChambers) { RestoreAllChambers(); } } private void FilterChambersForRoundType(FireArmRoundType roundType) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) m_isFilteringChambers = true; m_lastFilteredType = roundType; m_savedRoundType = ((FVRFireArm)this).RoundType; ((FVRFireArm)this).RoundType = roundType; ((FVRFireArm)this).FChambers.Clear(); foreach (FVRFireArmChamber allChamber in m_allChambers) { if (allChamber.RoundType == roundType) { ((FVRFireArm)this).FChambers.Add(allChamber); } } } private void RestoreAllChambers() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).RoundType = m_savedRoundType; m_isFilteringChambers = false; m_lastFilteredType = null; ((FVRFireArm)this).FChambers.Clear(); ((FVRFireArm)this).FChambers.AddRange(m_allChambers); } } public class LematForegrip : FVRAlternateGrip { [Header("Shotgun Setup")] public Transform ShotgunBase; public HingeJoint Hinge; private Vector3 localPosStart; private Rigidbody RB; private Lemat Wep; private float m_initialDamp = 0.05f; private float m_initialSpring = 0.05f; public override void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) ((FVRAlternateGrip)this).Awake(); localPosStart = ((Component)Hinge).transform.localPosition; RB = ((Component)Hinge).gameObject.GetComponent(); Wep = ((Component)((Joint)Hinge).connectedBody).gameObject.GetComponent(); if ((Object)(object)Wep != (Object)null) { Wep.ForegripRef = this; } JointSpring spring = Hinge.spring; m_initialSpring = spring.spring; m_initialDamp = spring.damper; } public override void FVRUpdate() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (Vector3.Distance(((Component)Hinge).transform.localPosition, localPosStart) > 0.01f) { ((Component)Hinge).transform.localPosition = localPosStart; } } public override void FVRFixedUpdate() { ((FVRInteractiveObject)this).FVRFixedUpdate(); if (((FVRInteractiveObject)Wep).IsHeld && ((FVRPhysicalObject)Wep).IsAltHeld) { RB.mass = 0.001f; } else { RB.mass = 0.1f; } } public override bool IsInteractable() { return true; } public override void UpdateInteraction(FVRViveHand hand) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: 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_0243: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) ((FVRAlternateGrip)this).UpdateInteraction(hand); bool flag = ((FVRInteractiveObject)Wep).IsHeld && ((FVRInteractiveObject)this).IsHeld; if (hand.IsInStreamlinedMode) { if (flag) { Wep.m_IsLatchHeldOpen = hand.Input.BYButtonPressed; Wep.foregripLatch = hand.Input.BYButtonPressed; } else { Wep.m_IsLatchHeldOpen = hand.Input.BYButtonPressed; Wep.foregripLatch = hand.Input.BYButtonPressed; } } else { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (flag) { if (hand.Input.TouchpadPressed && touchpadAxes.y > 0.1f) { Wep.m_IsLatchHeldOpen = true; Wep.foregripLatch = true; } else { Wep.m_IsLatchHeldOpen = false; Wep.foregripLatch = false; } } else if (hand.Input.TouchpadPressed && touchpadAxes.y > 0.1f) { Wep.m_IsLatchHeldOpen = true; Wep.foregripLatch = true; } else { Wep.m_IsLatchHeldOpen = false; Wep.foregripLatch = false; } } Vector3 val = ((HandInput)(ref hand.Input)).Pos - ((Component)Hinge).transform.position; Vector3 val2 = Vector3.ProjectOnPlane(val, ShotgunBase.right); if (Vector3.Angle(val2, -ShotgunBase.up) > 90f) { val2 = ShotgunBase.forward; } if (Vector3.Angle(val2, ShotgunBase.forward) > 90f) { val2 = -ShotgunBase.up; } float num = Vector3.Angle(val2, ShotgunBase.forward); JointSpring spring = Hinge.spring; spring.spring = 10f; spring.damper = 0f; JointLimits limits = Hinge.limits; spring.targetPosition = Mathf.Clamp(num, 0f, ((JointLimits)(ref limits)).max); Hinge.spring = spring; ((Component)Hinge).transform.localPosition = localPosStart; } public override void EndInteraction(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_0039: Unknown result type (might be due to invalid IL or missing references) JointSpring spring = Hinge.spring; spring.spring = m_initialSpring; spring.damper = m_initialDamp; spring.targetPosition = 45f; Hinge.spring = spring; ((FVRAlternateGrip)this).EndInteraction(hand); } } } public class PlayRandomSoundOnSpawn : MonoBehaviour { public AudioClip[] spawnSounds; public float volume = 1f; [Header("Pitch Settings")] public float minPitch = 0.9f; public float maxPitch = 1.1f; private AudioSource audioSource; private void Start() { if (spawnSounds.Length > 0) { audioSource = ((Component)this).gameObject.AddComponent(); audioSource.playOnAwake = false; audioSource.spatialBlend = 1f; audioSource.volume = volume; AudioClip val = spawnSounds[Random.Range(0, spawnSounds.Length)]; audioSource.pitch = Random.Range(minPitch, maxPitch); audioSource.PlayOneShot(val); } } } public class RandomSpinOnSpawn : MonoBehaviour { public float spinForce = 0.5f; public Vector3 torqueAxis = new Vector3(1f, 0f, 0f); private Rigidbody rb; private void Start() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) rb = ((Component)this).GetComponent(); if ((Object)(object)rb != (Object)null) { ((Component)this).transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); rb.AddTorque(((Vector3)(ref torqueAxis)).normalized * spinForce, (ForceMode)1); } } } namespace BitWizrd.Revolver { public class Schofield : BreakActionWeapon { [Header("Break Action Setup")] public bool foregripLatch; [Tooltip("How far the latch rotates when clicking")] public float LatchClickRot = 15f; private float m_latchClickLerp = 0f; [Header("Ejector Setup")] [Tooltip("Speed at which the ejector moves")] public float EjectorSpeed = 1f; [Tooltip("Minimum velocity required for automatic ejection")] public float MinEjectVelocity = 10f; [Tooltip("Velocity range for force multiplier calculation (relative to min velocity)")] public float EjectForceRange = 40f; [Tooltip("Minimum force multiplier for ejection (at min velocity)")] public float MinEjectForce = 0.05f; [Tooltip("Maximum force multiplier for ejection (at max velocity)")] public float MaxEjectForce = 0.8f; [Tooltip("Angle at which the ejector starts moving up")] public float EjectorStartAngle = 45f; [Tooltip("Angle at which the extractor reaches maximum travel")] public float EjectorMaxAngle = 60f; [Header("Revolver Mechanics")] public Transform RevolverMuzzle; public Transform Hammer; public Transform Trigger; [Header("Revolver Speeds")] [Tooltip("Speed of normal hammer cocking")] public float NormalCockSpeed = 5f; [Tooltip("Speed of hammer cocking when fanning")] public float FanCockSpeed = 10f; [Tooltip("Speed of cylinder rotation after cocking")] public float CylinderRotSpeed = 16f; [Tooltip("Speed of spin recovery")] public float SpinRecoverySpeed = 500f; [Tooltip("Speed of spin damping")] public float SpinDampingSpeed = 0.6f; [Tooltip("Trigger rotates on X-axis.")] public float Trigger_Rot_Forward = 0f; public float Trigger_Rot_Rearward = 25f; private bool hasTriggeredUpSinceBegin = false; private bool hasLatchButtonUpSinceBegin = false; private bool hasForegripUpSinceBegin = false; [Tooltip("Revolver hammer angles (X-axis).")] public float Hammer_Rot_Uncocked = 0f; public float Hammer_Rot_Cocked = 30f; public float Hammer_Rot_Halfcock = 15f; [Tooltip("Trigger threshold to fire.")] public float TriggerThreshold = 0.9f; [Header("Cylinder Mechanics (Classic Single-Action)")] public SingleActionRevolverCylinder Cylinder; public bool DoesHalfCockHalfRotCylinder; public bool HasTransferBarSafety; [Header("Optional Spin Feature")] public Transform PoseSpinHolder; public bool CanSpin = true; [Tooltip("Allows revolve gate toggling (half-cock).")] public bool StateToggles = true; [Header("Fanning")] public bool CanFan = true; public Transform HammerFanDir; public float FanDistance = 0.15f; public float FanAngle = 60f; public float FanVelocityThreshold = 1f; [Header("Foregrip Reference")] public SchofieldForegrip ForegripRef; [Tooltip("Force applied to close the gun when using foregrip")] public float ForegripCloseForce = 5f; private bool _inputsBlocked = false; private bool m_isBreakOpen; private bool m_hasEjectedThisOpen; private bool m_isHammerCocked; private bool m_isHammerCocking; private float m_hammerCockLerp; private float m_hammerCockSpeed = 10f; private int m_curChamber; private float m_curChamberLerp; private float m_tarChamberLerp; private float timeSinceColFire = 999f; private bool m_isSpinning; private float xSpinRot; private float xSpinVel; public bool TriggerReset = true; private float prevTriggerFloat = 0f; private bool m_isStateToggled = false; private bool m_hasPassedSnapPoint = false; private bool m_wasMovingForward = true; private float m_snapAngle = 0f; private bool m_wasHingeLocked = false; private float m_lockedHingeAngle = 0f; private ConfigurableJoint m_hingeJoint; private bool m_isLatchHeldOpen = false; private bool m_prevShouldLatchBeOpen = false; public bool IsBreakOpen => m_isBreakOpen; public int CurChamber { get { return m_curChamber; } set { m_curChamber = value % Cylinder.NumChambers; } } public int PrevChamber { get { int num = m_curChamber - 1; return (num >= 0) ? num : (Cylinder.NumChambers - 1); } } public int PrevChamber2 { get { int num = m_curChamber - 2; return (num >= 0) ? num : (Cylinder.NumChambers + num); } } public override void Awake() { ((BreakActionWeapon)this).Awake(); ((BreakActionWeapon)this).SetHasLatchButton(false); ((BreakActionWeapon)this).SetEjectOnOpen(false); if ((Object)(object)base.Hinge == (Object)null) { Debug.LogError((object)string.Concat(new string[3] { "[Schofield] CRITICAL: HingeJoint is not assigned on ", ((Object)((Component)this).gameObject).name, ". Weapon will not function correctly. Please assign the Hinge field in the Inspector." })); } ((FVRFireArm)this).FChambers = new List(); if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null) { val.Firearm = (FVRFireArm)(object)this; ((FVRFireArm)this).FChambers.Add(val); } } } m_isBreakOpen = false; m_hasEjectedThisOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); if ((Object)(object)base.Hinge != (Object)null) { m_hingeJoint = ((Component)base.Hinge).GetComponent(); } } public override void BeginInteraction(FVRViveHand hand) { ((FVRFireArm)this).BeginInteraction(hand); if ((Object)(object)hand != (Object)null) { hasTriggeredUpSinceBegin = hand.Input.TriggerFloat <= 0.45f; hasLatchButtonUpSinceBegin = !hand.Input.TouchpadPressed && !hand.Input.BYButtonPressed; hasForegripUpSinceBegin = !foregripLatch; } else { hasTriggeredUpSinceBegin = false; hasLatchButtonUpSinceBegin = false; hasForegripUpSinceBegin = false; } } public override Transform GetMuzzle() { return RevolverMuzzle; } private void HandleRevolverFire() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) if (m_isBreakOpen) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); return; } if ((Object)(object)Cylinder == (Object)null || Cylinder.Chambers == null || Cylinder.NumChambers == 0) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); return; } FVRFireArmChamber val = Cylinder.Chambers[m_curChamber]; if ((Object)(object)val == (Object)null || !val.IsFull || val.IsSpent || (Object)(object)val.GetRound() == (Object)null) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); return; } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); if (val.Fire()) { ((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); ((FVRFireArm)this).PlayAudioGunShot(val.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { val.IsSpent = false; val.UpdateProxyDisplay(); } } } private void UpdateTriggerLogic() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) float num = ((!((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)) ? 0f : ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat); if ((Object)(object)Trigger != (Object)null) { Trigger.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, num), 0f, 0f); } if (num <= 0.45f) { hasTriggeredUpSinceBegin = true; TriggerReset = true; } float num2 = ((!hasTriggeredUpSinceBegin) ? 0f : num); if (num2 > TriggerThreshold && !m_isBreakOpen && m_isHammerCocked) { m_isHammerCocked = false; m_isHammerCocking = false; m_hammerCockLerp = 0f; HandleRevolverFire(); } } public override void OnCollisionEnter(Collision col) { //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) ((FVRPhysicalObject)this).OnCollisionEnter(col); if (!HasTransferBarSafety && (Object)(object)col.collider.attachedRigidbody == (Object)null && Cylinder.Chambers[m_curChamber].IsFull && !Cylinder.Chambers[m_curChamber].IsSpent && !m_isHammerCocked && !m_isHammerCocking && !m_isStateToggled) { Vector3 relativeVelocity = col.relativeVelocity; if (((Vector3)(ref relativeVelocity)).magnitude > 2f) { HandleRevolverFire(); } } } public override void FVRUpdate() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).FVRUpdate(); UpdateHammerShared(); UpdateFanning(); UpdateSpinning(); UpdateTriggerLogic(); UpdateCylinderRot(); UpdateEjector(); if (m_latchClickLerp > 0f) { m_latchClickLerp -= Time.deltaTime * 10f; if (m_latchClickLerp < 0f) { m_latchClickLerp = 0f; } float num = Mathf.Sin(m_latchClickLerp * (float)Math.PI) * LatchClickRot; ((FVRPhysicalObject)this).SetAnimatedComponent(base.Latch, num, (InterpStyle)1, base.LatchAxis); } } public override void FVRFixedUpdate() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (m_isBreakOpen && (Object)(object)base.Hinge != (Object)null && Mathf.Abs(((Component)base.Hinge).transform.localEulerAngles.x) <= 5f && !m_isLatchHeldOpen && !base.IsLatchHeldOpen) { ForceGunClosed(); } if ((Object)(object)base.Hinge != (Object)null) { ((BreakActionWeapon)this).FVRFixedUpdate(); } } private void ForceGunClosed() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) bool isHammerCocked = m_isHammerCocked; float hammerCockLerp = m_hammerCockLerp; m_isBreakOpen = false; m_hasEjectedThisOpen = false; m_isLatchHeldOpen = false; base.IsLatchHeldOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); hasLatchButtonUpSinceBegin = false; hasForegripUpSinceBegin = false; foregripLatch = false; m_prevShouldLatchBeOpen = false; if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null) { val.IsAccessible = false; } } } if ((Object)(object)base.Hinge != (Object)null) { JointLimits limits = base.Hinge.limits; ((JointLimits)(ref limits)).max = 0f; base.Hinge.limits = limits; ((Component)base.Hinge).transform.localEulerAngles = Vector3.zero; } typeof(BreakActionWeapon).GetField("m_isLatched", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(this, true); typeof(BreakActionWeapon).GetField("m_latchRot", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(this, 0f); m_hammerCockLerp = 0f; m_isHammerCocking = false; typeof(BreakActionWeapon).GetMethod("SetChambersAccessible", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(this, new object[1] { false }); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); if (isHammerCocked) { m_isHammerCocked = true; m_hammerCockLerp = 1f; if (base.Barrels != null && base.Barrels.Length > 0) { base.Barrels[0].m_isHammerCocked = true; } } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0074: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hand == (Object)null) { return; } if (hand.Input.TriggerFloat <= 0.45f) { hasTriggeredUpSinceBegin = true; } if (!hand.Input.TouchpadPressed && !hand.Input.BYButtonPressed) { hasLatchButtonUpSinceBegin = true; } if (!foregripLatch) { hasForegripUpSinceBegin = true; } bool isLatchHeldOpen = m_isLatchHeldOpen; Vector2 touchpadAxes = hand.Input.TouchpadAxes; bool flag = false; flag = ((!hand.IsInStreamlinedMode) ? (hand.Input.TouchpadPressed && hasLatchButtonUpSinceBegin && touchpadAxes.y > 0.1f) : (hand.Input.BYButtonPressed && hasLatchButtonUpSinceBegin)); bool flag2 = foregripLatch && hasForegripUpSinceBegin; bool flag3 = flag || flag2; if (flag3 != m_isLatchHeldOpen) { m_isLatchHeldOpen = flag3; ((BreakActionWeapon)this).SetIsExternallyUnlatched(flag3); ((FVRPhysicalObject)this).SetAnimatedComponent(base.Latch, (!flag3) ? 0f : base.MaxRotExtent, (InterpStyle)1, base.LatchAxis); } if (flag3 != m_prevShouldLatchBeOpen) { if (flag3 && !m_isBreakOpen) { BreakOpen(); } else if (!flag3 && m_isBreakOpen && (Object)(object)base.Hinge != (Object)null && ((Component)base.Hinge).transform.localEulerAngles.x <= 1f) { BreakClose(); if (!flag3) { m_latchClickLerp = 1f; } } } m_prevShouldLatchBeOpen = flag3; if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown && !m_isBreakOpen && !m_isHammerCocked && !m_isHammerCocking) { CockHammer(NormalCockSpeed); } return; } if (hand.Input.TouchpadPressed && hasLatchButtonUpSinceBegin && hand.Input.TouchpadDown && touchpadAxes.y < -0.1f && !m_isBreakOpen && !m_isHammerCocked && !m_isHammerCocking) { CockHammer(NormalCockSpeed); } if (hand.Input.TouchpadDown) { float num = Vector2.Angle(touchpadAxes, Vector2.up); if (num < 45f && !m_isBreakOpen) { m_isSpinning = true; } } } public override void EndInteraction(FVRViveHand hand) { //IL_0024: 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) ((BreakActionWeapon)this).EndInteraction(hand); m_isLatchHeldOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); ((FVRPhysicalObject)this).SetAnimatedComponent(base.Latch, 0f, (InterpStyle)1, base.LatchAxis); if (m_isSpinning && (Object)(object)PoseSpinHolder != (Object)null && (Object)(object)hand != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.AddRelativeTorque(new Vector3(xSpinVel, 0f, 0f), (ForceMode)1); } m_isSpinning = false; } private void UpdateHammerShared() { //IL_0159: Unknown result type (might be due to invalid IL or missing references) if (m_isHammerCocking) { if (m_hammerCockLerp < 1f) { m_hammerCockLerp += Time.deltaTime * m_hammerCockSpeed; } else { m_hammerCockLerp = 1f; m_isHammerCocking = false; m_isHammerCocked = true; if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { m_curChamber++; if (m_curChamber >= Cylinder.NumChambers) { m_curChamber = 0; } m_curChamberLerp = 0f; m_tarChamberLerp = 0f; } } } if (m_isBreakOpen && !m_isHammerCocking && !m_isHammerCocked) { float num = Hammer_Rot_Cocked - Hammer_Rot_Uncocked; if (Mathf.Abs(num) > 0.001f) { float num2 = (Hammer_Rot_Halfcock - Hammer_Rot_Uncocked) / num; num2 = Mathf.Clamp01(num2); m_hammerCockLerp = num2; } } if ((Object)(object)Hammer != (Object)null) { float num3 = Mathf.Lerp(Hammer_Rot_Uncocked, Hammer_Rot_Cocked, m_hammerCockLerp); Hammer.localEulerAngles = new Vector3(num3, 0f, 0f); } } private void UpdateFanning() { //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_00a5: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (CanFan && ((FVRInteractiveObject)this).IsHeld && !((Object)(object)((FVRInteractiveObject)this).m_hand == (Object)null) && !((Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand == (Object)null) && !((Object)(object)HammerFanDir == (Object)null) && !m_isHammerCocked && !m_isHammerCocking && !m_isBreakOpen) { Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld; float num = Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, HammerFanDir.position); if (num < FanDistance && Vector3.Angle(velLinearWorld, HammerFanDir.forward) < FanAngle && ((Vector3)(ref velLinearWorld)).magnitude > FanVelocityThreshold) { CockHammer(FanCockSpeed); } } } private void UpdateSpinning() { //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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) if (!CanSpin || !((FVRInteractiveObject)this).IsHeld || (Object)(object)PoseSpinHolder == (Object)null) { return; } bool isSpinning = false; if (!m_isBreakOpen && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null && !m_isHammerCocking && !m_isHammerCocked && !((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed) { Vector2 touchpadAxes = ((FVRInteractiveObject)this).m_hand.Input.TouchpadAxes; if (Vector2.Angle(touchpadAxes, Vector2.up) < 45f) { isSpinning = true; } } m_isSpinning = isSpinning; if (m_isSpinning) { Vector3 velLinearLocal = ((FVRInteractiveObject)this).m_hand.Input.VelLinearLocal; float num = Vector3.Dot(((Vector3)(ref velLinearLocal)).normalized, ((Component)this).transform.up); if (Mathf.Abs(xSpinVel) < 90f) { xSpinVel += num * Time.deltaTime * 600f; } else if (Mathf.Sign(num) == Mathf.Sign(xSpinVel)) { xSpinVel += num * Time.deltaTime * 600f; } xSpinVel = Mathf.Clamp(xSpinVel, -500f, 500f); xSpinRot += xSpinVel * Time.deltaTime * 5f; PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f); } else { xSpinRot = 0f; xSpinVel = 0f; PoseSpinHolder.localRotation = Quaternion.RotateTowards(PoseSpinHolder.localRotation, Quaternion.identity, Time.deltaTime * SpinRecoverySpeed); PoseSpinHolder.localEulerAngles = new Vector3(PoseSpinHolder.localEulerAngles.x, 0f, 0f); } xSpinVel = Mathf.Lerp(xSpinVel, 0f, Time.deltaTime * SpinDampingSpeed); } private void UpdateCylinderRot() { //IL_0055: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) if (m_isBreakOpen) { for (int i = 0; i < Cylinder.Chambers.Length; i++) { Cylinder.Chambers[i].IsAccessible = true; } ((Component)Cylinder).transform.localRotation = Cylinder.GetLocalRotationFromCylinder(CurChamber); } else if (m_isStateToggled) { int prevChamber = PrevChamber; for (int j = 0; j < Cylinder.Chambers.Length; j++) { Cylinder.Chambers[j].IsAccessible = j == prevChamber; } if (DoesHalfCockHalfRotCylinder) { int num = (CurChamber + 1) % Cylinder.NumChambers; ((Component)Cylinder).transform.localRotation = Quaternion.Slerp(Cylinder.GetLocalRotationFromCylinder(CurChamber), Cylinder.GetLocalRotationFromCylinder(num), 0.5f); } else { ((Component)Cylinder).transform.localRotation = Cylinder.GetLocalRotationFromCylinder(CurChamber); } } else { for (int k = 0; k < Cylinder.Chambers.Length; k++) { Cylinder.Chambers[k].IsAccessible = false; } m_tarChamberLerp = ((!m_isHammerCocking) ? 0f : m_hammerCockLerp); m_curChamberLerp = Mathf.Lerp(m_curChamberLerp, m_tarChamberLerp, Time.deltaTime * CylinderRotSpeed); int num2 = (CurChamber + 1) % Cylinder.NumChambers; ((Component)Cylinder).transform.localRotation = Quaternion.Slerp(Cylinder.GetLocalRotationFromCylinder(CurChamber), Cylinder.GetLocalRotationFromCylinder(num2), m_curChamberLerp); } } private void CockHammer(float speed) { if (!m_isHammerCocked && !m_isHammerCocking) { m_hammerCockSpeed = speed; m_isHammerCocking = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } private void UpdateEjector() { if (!m_isBreakOpen || !base.m_hasEjector || (Object)(object)base.Ejector == (Object)null || (Object)(object)base.Hinge == (Object)null) { return; } float num = Mathf.Abs(base.Hinge.angle); float velocity = base.Hinge.velocity; bool flag = velocity > 0f; float num2 = velocity; bool flag2 = false; if ((Object)(object)ForegripRef != (Object)null && (Object)(object)((FVRInteractiveObject)ForegripRef).m_hand != (Object)null && ((FVRInteractiveObject)ForegripRef).IsHeld) { float magnitude = ((Vector3)(ref ((FVRInteractiveObject)ForegripRef).m_hand.Input.VelLinearWorld)).magnitude; if (magnitude < velocity) { num2 = magnitude; flag2 = true; } } if (num >= base.HingeEjectLimit && flag && !m_hasPassedSnapPoint) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)8, 1f); if (num2 >= MinEjectVelocity) { float forceMultiplier = Mathf.Lerp(MinEjectForce, MaxEjectForce, Mathf.Clamp01((num2 - MinEjectVelocity) / EjectForceRange)); if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null && val.IsFull) { PopOutRound(val, forceMultiplier); } } } } m_hasPassedSnapPoint = true; } else if (num >= EjectorStartAngle && !m_hasPassedSnapPoint) { float num3 = Mathf.InverseLerp(EjectorStartAngle, base.HingeEjectLimit, num); } else if (num < EjectorStartAngle - 5f) { m_hasPassedSnapPoint = false; } } public void PopOutRound(FVRFireArmChamber chamber, float forceMultiplier = 1f) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_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_005f: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_009c: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)21, 1f); Vector3 position = ((Component)chamber).transform.position; Vector3 position2 = ((Component)Cylinder).transform.position; Vector3 val = -((Component)chamber).transform.forward; Vector3 val2 = position - position2; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 forward = ((Component)Cylinder).transform.forward; Vector3 val3 = Vector3.ProjectOnPlane(normalized, forward); normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = Vector3.Cross(forward, normalized); Vector3 normalized2 = ((Vector3)(ref val4)).normalized; Vector3 val5 = val + normalized + normalized2 * 0.2f; Vector3 normalized3 = ((Vector3)(ref val5)).normalized; Vector3 val6 = normalized3 + new Vector3(0f, 0.05f, 0f); normalized3 = ((Vector3)(ref val6)).normalized; Vector3 val7 = default(Vector3); ((Vector3)(ref val7))..ctor(Random.Range(-0.005f, 0.005f), Random.Range(-0.005f, 0.005f), Random.Range(-0.005f, 0.005f)); Vector3 val8 = position + ((Component)chamber).transform.forward * base.EjectOffset; float num = base.EjectSpeed * Mathf.Lerp(0.05f, 0.8f, forceMultiplier); float num2 = ((!chamber.IsSpent) ? num : (num * 1.1f)); Vector3 val9 = val8 + val7; Vector3 val10 = normalized3 + val7; chamber.EjectRound(val9, ((Vector3)(ref val10)).normalized * num2, Vector3.right, false); } public void BreakOpen() { //IL_0037: 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_0050: Unknown result type (might be due to invalid IL or missing references) if (m_isBreakOpen) { return; } m_isBreakOpen = true; ((BreakActionWeapon)this).SetIsExternallyUnlatched(true); if ((Object)(object)base.Hinge != (Object)null) { JointLimits limits = base.Hinge.limits; ((JointLimits)(ref limits)).max = base.HingeLimit; base.Hinge.limits = limits; } if (!((Object)(object)Cylinder != (Object)null) || Cylinder.Chambers == null) { return; } FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null) { val.IsAccessible = true; } } } public void BreakClose() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (!m_isBreakOpen) { return; } bool isHammerCocked = m_isHammerCocked; float hammerCockLerp = m_hammerCockLerp; m_isBreakOpen = false; m_hasEjectedThisOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); base.IsLatchHeldOpen = false; m_isLatchHeldOpen = false; hasLatchButtonUpSinceBegin = false; hasForegripUpSinceBegin = false; foregripLatch = false; m_prevShouldLatchBeOpen = false; if ((Object)(object)base.Hinge != (Object)null) { JointLimits limits = base.Hinge.limits; ((JointLimits)(ref limits)).max = 0f; base.Hinge.limits = limits; if (!m_isLatchHeldOpen) { m_latchClickLerp = 1f; } } if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null) { val.IsAccessible = false; } } } typeof(BreakActionWeapon).GetField("m_isLatched", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(this, true); typeof(BreakActionWeapon).GetField("m_latchRot", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(this, 0f); if (isHammerCocked) { m_isHammerCocked = true; m_hammerCockLerp = 1f; if (base.Barrels != null && base.Barrels.Length > 0) { base.Barrels[0].m_isHammerCocked = true; } } } public void LoadFromSpeedloader(SchofieldSpeedloader loader) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) bool flag = false; for (int i = 0; i < ((Speedloader)loader).Chambers.Count && i < Cylinder.Chambers.Length; i++) { SpeedloaderChamber val = ((Speedloader)loader).Chambers[i]; FVRFireArmChamber val2 = Cylinder.Chambers[i]; if (val.IsLoaded && !val2.IsFull && !val.IsSpent) { val2.Autochamber(val.Unload()); flag = true; } } if (flag) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)20, 1f); } } } public class SchofieldForegrip : FVRAlternateGrip { [Header("Break Action Setup")] public Transform BreakBase; public HingeJoint Hinge; private Vector3 localPosStart; private Rigidbody RB; private Schofield Wep; private float m_initialDamp = 0.05f; private float m_initialSpring = 0.05f; private float m_initialTargetPos; private bool wasLatchHeldOpen = false; public override void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) ((FVRAlternateGrip)this).Awake(); localPosStart = ((Component)Hinge).transform.localPosition; RB = ((Component)Hinge).gameObject.GetComponent(); Wep = ((Component)((Joint)Hinge).connectedBody).gameObject.GetComponent(); if ((Object)(object)Wep != (Object)null) { Wep.ForegripRef = this; } if ((Object)(object)RB != (Object)null) { RB.mass = 2f; } JointSpring spring = Hinge.spring; m_initialSpring = spring.spring; m_initialDamp = spring.damper; m_initialTargetPos = spring.targetPosition; } public override void FVRUpdate() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (Vector3.Distance(((Component)Hinge).transform.localPosition, localPosStart) > 0.01f) { ((Component)Hinge).transform.localPosition = localPosStart; } } public override void FVRFixedUpdate() { ((FVRInteractiveObject)this).FVRFixedUpdate(); if (((FVRInteractiveObject)Wep).IsHeld && ((FVRPhysicalObject)Wep).IsAltHeld) { RB.mass = 0.001f; } else { RB.mass = 0.1f; } } public override bool IsInteractable() { return true; } public override void UpdateInteraction(FVRViveHand hand) { //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) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) ((FVRAlternateGrip)this).UpdateInteraction(hand); bool flag = ((FVRInteractiveObject)Wep).IsHeld && ((FVRInteractiveObject)this).IsHeld; bool flag2 = false; if (hand.IsInStreamlinedMode) { flag2 = hand.Input.BYButtonPressed; } else { Vector2 touchpadAxes = hand.Input.TouchpadAxes; flag2 = hand.Input.TouchpadPressed && touchpadAxes.y > 0.1f; } Wep.foregripLatch = flag2; if (!Wep.IsBreakOpen || (((FVRInteractiveObject)Wep).IsHeld && ((FVRInteractiveObject)this).IsHeld)) { Vector3 val = ((HandInput)(ref hand.Input)).Pos - ((Component)Hinge).transform.position; Vector3 val2 = Vector3.ProjectOnPlane(val, BreakBase.right); if (Vector3.Angle(val2, -BreakBase.up) > 90f) { val2 = BreakBase.forward; } if (Vector3.Angle(val2, BreakBase.forward) > 90f) { val2 = -BreakBase.up; } float num = Vector3.Angle(val2, BreakBase.forward); JointSpring spring = Hinge.spring; spring.spring = 10f; spring.damper = 0f; JointLimits limits = Hinge.limits; spring.targetPosition = Mathf.Clamp(num, 0f, ((JointLimits)(ref limits)).max); Hinge.spring = spring; } else { JointSpring spring2 = Hinge.spring; spring2.spring = 0f; spring2.damper = 0.1f; spring2.targetPosition = Hinge.angle; Hinge.spring = spring2; } ((Component)Hinge).transform.localPosition = localPosStart; } public override void EndInteraction(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_003a: Unknown result type (might be due to invalid IL or missing references) JointSpring spring = Hinge.spring; spring.spring = m_initialSpring; spring.damper = m_initialDamp; spring.targetPosition = m_initialTargetPos; Hinge.spring = spring; ((FVRAlternateGrip)this).EndInteraction(hand); } } } namespace BitWizrd.Speedloader { public class SchofieldSpeedloader : Speedloader { private RevolverCylinder _hoveredCylinder; private Schofield HoveredSchofield; private SingleActionRevolverCylinder HoveredSingleActionCylinder; private RevolvingShotgunTrigger _hoveredRSTrigger; public override GameObject DuplicateFromSpawnLock(FVRViveHand hand) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) GameObject val = ((Speedloader)this).DuplicateFromSpawnLock(hand); SchofieldSpeedloader component = val.GetComponent(); for (int i = 0; i < base.Chambers.Count; i++) { if (base.Chambers[i].IsLoaded) { ((Speedloader)component).Chambers[i].Load(base.Chambers[i].LoadedClass, false); } else { ((Speedloader)component).Chambers[i].Unload(); } } return val; } public override void FVRFixedUpdate() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) ((Speedloader)this).FVRFixedUpdate(); if ((Object)(object)_hoveredCylinder != (Object)null && base.TimeTilLoadAttempt <= 0f && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null && ((FVRInteractiveObject)_hoveredCylinder).IsInteractable()) { bool flag = false; for (int i = 0; i < base.Chambers.Count; i++) { if (base.Chambers[i].IsLoaded) { flag = true; } } if (flag && _hoveredCylinder.Revolver.UsesSpeedLoadedEjection && _hoveredCylinder.HasSpeedLoadedIn) { flag = false; } float num = Vector3.Angle(((Component)this).transform.forward, ((Component)_hoveredCylinder).transform.forward); if (flag && (num < 20f || base.IgnoreAlignmentCheck)) { base.TimeTilLoadAttempt = 0.25f; _hoveredCylinder.LoadFromSpeedLoader((Speedloader)(object)this); if (base.InjectsOnInsertion) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } else if ((Object)(object)HoveredSingleActionCylinder != (Object)null && base.TimeTilLoadAttempt <= 0f && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null) { bool flag2 = true; FVRFireArmChamber[] chambers = HoveredSingleActionCylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if (!val.IsAccessible) { flag2 = false; break; } } if (flag2) { base.TimeTilLoadAttempt = 0.25f; LoadIntoSingleActionCylinder(HoveredSingleActionCylinder); if (base.InjectsOnInsertion) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } if ((Object)(object)_hoveredRSTrigger != (Object)null && base.TimeTilLoadAttempt <= 0f && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null && (Object)(object)_hoveredRSTrigger.Shotgun != (Object)null && !_hoveredRSTrigger.Shotgun.CylinderLoaded) { _hoveredRSTrigger.Shotgun.LoadCylinder((Speedloader)(object)this); Object.Destroy((Object)(object)((Component)this).gameObject); } if ((Object)(object)_hoveredRSTrigger != (Object)null && base.TimeTilLoadAttempt <= 0f && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null && (Object)(object)_hoveredRSTrigger.GrappleGun != (Object)null && !_hoveredRSTrigger.GrappleGun.IsMagLoaded) { _hoveredRSTrigger.GrappleGun.LoadCylinder((Speedloader)(object)this); Object.Destroy((Object)(object)((Component)this).gameObject); } if (base.TimeTilLoadAttempt > 0f) { base.TimeTilLoadAttempt -= Time.deltaTime; } } public override void Start() { ((Speedloader)this).Start(); for (int i = 0; i < base.Chambers.Count; i++) { base.Chambers[i].UpdateViz(); } } public override void FVRUpdate() { ((Speedloader)this).FVRUpdate(); if ((Object)(object)_hoveredRSTrigger != (Object)null && base.TimeTilLoadAttempt <= 0f && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null && (Object)(object)_hoveredRSTrigger.Shotgun != (Object)null && !_hoveredRSTrigger.Shotgun.CylinderLoaded) { _hoveredRSTrigger.Shotgun.LoadCylinder((Speedloader)(object)this); Object.Destroy((Object)(object)((Component)this).gameObject); } if ((Object)(object)_hoveredRSTrigger != (Object)null && base.TimeTilLoadAttempt <= 0f && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null && (Object)(object)_hoveredRSTrigger.GrappleGun != (Object)null && !_hoveredRSTrigger.GrappleGun.IsMagLoaded) { _hoveredRSTrigger.GrappleGun.LoadCylinder((Speedloader)(object)this); Object.Destroy((Object)(object)((Component)this).gameObject); } } public void ReloadClipWithType(FireArmRoundClass rClass) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < base.Chambers.Count; i++) { base.Chambers[i].Load(rClass, false); } } public void ReloadSpeedLoaderWithList(List list) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) for (int num = base.Chambers.Count - 1; num >= 0; num--) { int num2 = list.Count - 1 - num; if (num2 >= 0) { base.Chambers[num].Load(list[num2], false); } } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_0288: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_029d: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: 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_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) bool flag = false; if (hand.IsInStreamlinedMode && hand.Input.BYButtonDown) { flag = true; } else if (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f) { flag = true; } if (!flag || !base.CanManuallyEjectRounds) { return; } SpeedloaderChamber val = null; bool flag2 = false; bool flag3 = false; for (int i = 0; i < base.Chambers.Count; i++) { if (base.Chambers[i].IsLoaded) { val = base.Chambers[i]; flag2 = true; flag3 = base.Chambers[i].IsSpent; break; } } if (!flag2) { return; } if ((Object)(object)base.ProfileOverride != (Object)null) { SM.PlayGenericSound(base.ProfileOverride.MagazineEjectRound, ((Component)this).transform.position); } Vector3 val2 = ((Component)val).transform.position + ((Component)val).transform.forward * (0.02f + base.forwardEjectionDisplacement); Quaternion rotation = ((Component)val).transform.rotation; if ((Object)(object)hand.OtherHand.CurrentInteractable == (Object)null && hand.OtherHand.Input.IsGrabbing && Vector3.Distance(val2, ((HandInput)(ref hand.OtherHand.Input)).Pos) < 0.15f && !flag3) { GameObject gameObject = ((AnvilAsset)AM.GetRoundSelfPrefab(val.Type, val.LoadedClass)).GetGameObject(); GameObject val3 = Object.Instantiate(gameObject, val2, rotation); FVRFireArmRound component = val3.GetComponent(); ((FVRPhysicalObject)component).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); hand.OtherHand.ForceSetInteractable((FVRInteractiveObject)(object)component); ((FVRInteractiveObject)component).BeginInteraction(hand.OtherHand); if (val.IsSpent) { component.Fire(); component.SetKillCounting(true); } val.Unload(); } else if (hand.OtherHand.CurrentInteractable is FVRFireArmRound && ((FVRFireArmRound)hand.OtherHand.CurrentInteractable).RoundType == val.Type && ((FVRFireArmRound)hand.OtherHand.CurrentInteractable).ProxyRounds.Count < ((FVRFireArmRound)hand.OtherHand.CurrentInteractable).MaxPalmedAmount && Vector3.Distance(((HandInput)(ref hand.Input)).Pos, ((HandInput)(ref hand.OtherHand.Input)).Pos) < 0.15f && !flag3) { FireArmRoundClass loadedClass = val.LoadedClass; FVRObject roundSelfPrefab = AM.GetRoundSelfPrefab(val.Type, val.LoadedClass); ((FVRFireArmRound)hand.OtherHand.CurrentInteractable).AddProxy(loadedClass, roundSelfPrefab); ((FVRFireArmRound)hand.OtherHand.CurrentInteractable).UpdateProxyDisplay(); val.Unload(); } else if ((Object)(object)hand.CurrentHoveredQuickbeltSlotDirty != (Object)null && (Object)(object)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject == (Object)null && !flag3) { GameObject gameObject2 = ((AnvilAsset)AM.GetRoundSelfPrefab(val.Type, val.LoadedClass)).GetGameObject(); GameObject val4 = Object.Instantiate(gameObject2, val2, rotation); FVRFireArmRound component2 = val4.GetComponent(); ((FVRPhysicalObject)component2).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); ((FVRPhysicalObject)component2).SetQuickBeltSlot(hand.CurrentHoveredQuickbeltSlotDirty); if (val.IsSpent) { component2.Fire(); component2.SetKillCounting(true); } val.Unload(); } else if ((Object)(object)hand.CurrentHoveredQuickbeltSlotDirty != (Object)null && hand.CurrentHoveredQuickbeltSlotDirty.HeldObject is FVRFireArmRound && ((FVRFireArmRound)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).RoundType == val.Type && ((FVRFireArmRound)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).ProxyRounds.Count < ((FVRFireArmRound)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).MaxPalmedAmount && !flag3) { FireArmRoundClass loadedClass2 = val.LoadedClass; FVRObject roundSelfPrefab2 = AM.GetRoundSelfPrefab(val.Type, val.LoadedClass); ((FVRFireArmRound)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).AddProxy(loadedClass2, roundSelfPrefab2); ((FVRFireArmRound)hand.CurrentHoveredQuickbeltSlotDirty.HeldObject).UpdateProxyDisplay(); val.Unload(); } else { GameObject gameObject3 = ((AnvilAsset)AM.GetRoundSelfPrefab(val.Type, val.LoadedClass)).GetGameObject(); GameObject val5 = Object.Instantiate(gameObject3, val2, rotation); FVRFireArmRound component3 = val5.GetComponent(); ((FVRPhysicalObject)val5.GetComponent()).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); val5.GetComponent().AddForce(val5.transform.forward * 0.5f); if (val.IsSpent) { component3.Fire(); component3.SetKillCounting(true); } val.Unload(); } } public void OnTriggerEnter(Collider c) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null) { RevolverCylinder component = ((Component)c).GetComponent(); if ((Object)(object)component != (Object)null && ((FVRFireArm)component.Revolver).RoundType == base.Chambers[0].Type && component.CanAccept()) { _hoveredCylinder = component; } else { _hoveredCylinder = null; } SingleActionRevolverCylinder component2 = ((Component)c).GetComponent(); if ((Object)(object)component2 != (Object)null && component2.Chambers != null && component2.Chambers.Length == base.Chambers.Count) { HoveredSingleActionCylinder = component2; } RevolvingShotgunTrigger component3 = ((Component)c).GetComponent(); bool flag = false; if ((Object)(object)component3 != (Object)null && (Object)(object)component3.Shotgun != (Object)null && ((FVRFireArm)component3.Shotgun).EjectDelay <= 0f && ((Component)c).gameObject.CompareTag("FVRFireArmReloadTriggerWell") && ((FVRFireArm)component3.Shotgun).RoundType == base.Chambers[0].Type && base.SLType == component3.Shotgun.SLType) { flag = true; } if ((Object)(object)component3 != (Object)null && (Object)(object)component3.GrappleGun != (Object)null && ((FVRFireArm)component3.GrappleGun).EjectDelay <= 0f && ((Component)c).gameObject.CompareTag("FVRFireArmReloadTriggerWell") && ((FVRFireArm)component3.GrappleGun).RoundType == base.Chambers[0].Type && base.SLType == component3.GrappleGun.SLType && base.Chambers[0].IsLoaded && !base.Chambers[0].IsSpent && base.Chambers[1].IsLoaded && !base.Chambers[1].IsSpent) { flag = true; } if (flag) { _hoveredRSTrigger = component3; } } } public void OnTriggerExit(Collider c) { RevolverCylinder component = ((Component)c).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)_hoveredCylinder == (Object)(object)component) { _hoveredCylinder = null; } SingleActionRevolverCylinder component2 = ((Component)c).GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)HoveredSingleActionCylinder == (Object)(object)component2) { HoveredSingleActionCylinder = null; } RevolvingShotgunTrigger component3 = ((Component)c).GetComponent(); if ((Object)(object)component3 != (Object)null) { _hoveredRSTrigger = null; } } private void LoadIntoSingleActionCylinder(SingleActionRevolverCylinder cylinder) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cylinder == (Object)null || cylinder.Chambers == null) { return; } bool flag = false; for (int i = 0; i < base.Chambers.Count && i < cylinder.Chambers.Length; i++) { SpeedloaderChamber val = base.Chambers[i]; FVRFireArmChamber val2 = cylinder.Chambers[i]; if (val.IsLoaded && !val2.IsFull && !val.IsSpent) { val2.Autochamber(val.Unload()); flag = true; } } if (flag) { FVRFireArm componentInParent = ((Component)cylinder).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { componentInParent.PlayAudioEvent((FirearmAudioEventType)20, 1f); } } } } } namespace BitWizrd.Revolver { public class SingleActionCylinderAxis : SingleActionRevolver { public enum RotationAxis { X, Y, Z } public RotationAxis cylinderRotationAxis = RotationAxis.Z; private void AdjustCylinderRotation(int chamberIndex) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.Cylinder == (Object)null) { return; } int numChambers = base.Cylinder.NumChambers; if (numChambers > 0) { Quaternion localRotationFromCylinder = base.Cylinder.GetLocalRotationFromCylinder(chamberIndex); Vector3 eulerAngles = ((Quaternion)(ref localRotationFromCylinder)).eulerAngles; switch (cylinderRotationAxis) { case RotationAxis.X: ((Vector3)(ref eulerAngles))..ctor(eulerAngles.z, 0f, 0f); break; case RotationAxis.Y: ((Vector3)(ref eulerAngles))..ctor(0f, eulerAngles.z, 0f); break; default: ((Vector3)(ref eulerAngles))..ctor(0f, 0f, eulerAngles.z); break; } ((Component)base.Cylinder).transform.localRotation = Quaternion.Euler(eulerAngles); } } public void CustomCockHammer(float speed) { ((SingleActionRevolver)this).CockHammer(speed); AdjustCylinderRotation(((SingleActionRevolver)this).CurChamber); } public void SetChamberAndRotate(int chamberIndex) { base.m_curChamber = chamberIndex; AdjustCylinderRotation(base.m_curChamber); } } } namespace BitWizrd.Speedloader { public class Speedloader_38Special : Speedloader { [Header("Empty Check Settings")] public Transform transformToMove; public Vector3 emptyPosition; public Vector3 loadedPosition; private bool wasEmpty; public override void FVRFixedUpdate() { //IL_007b: 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) ((Speedloader)this).FVRFixedUpdate(); bool flag = true; for (int i = 0; i < base.Chambers.Count; i++) { if (base.Chambers[i].IsLoaded) { flag = false; break; } } if (flag != wasEmpty && (Object)(object)transformToMove != (Object)null) { transformToMove.localPosition = ((!flag) ? loadedPosition : emptyPosition); wasEmpty = flag; } } } } namespace BitWizrd.Revolver { public static class WaggleJoint { public static float Approach(float rate, float time) { return 1f - Mathf.Pow(1f - rate, time); } public static Vector3 Approach(Vector3 point, Vector3 target, float rate, float time) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Vector3.Lerp(point, target, Approach(rate, time)); } public static float SignedAngle(Vector3 from, Vector3 to, Vector3 axis) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(from, to); float num2 = (float)((double)from.y * (double)to.z - (double)from.z * (double)to.y); float num3 = (float)((double)from.z * (double)to.x - (double)from.x * (double)to.z); float num4 = (float)((double)from.x * (double)to.y - (double)from.y * (double)to.x); float num5 = Mathf.Sign((float)((double)axis.x * (double)num2 + (double)axis.y * (double)num3 + (double)axis.z * (double)num4)); return num * num5; } public static float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) Vector3 val = Vector3.ProjectOnPlane(point - hingePivot, hingeAxis); Vector3 normalized = ((Vector3)(ref val)).normalized; return SignedAngle(hingeDirection, normalized, hingeAxis); } public static Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) return Quaternion.AngleAxis(Mathf.Clamp(ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection), angleMin, angleMax), hingeAxis) * hingeDirection * distanceLimit + hingePivot; } public static bool DetectOnHitLimit(float angle, float minAngle, float maxAngle, ref bool minCatchState, ref bool maxCatchState, float catchThreshold = 0.5f, float releaseThreshold = 5f) { float num = Mathf.Abs(maxAngle - minAngle); float num2 = Mathf.Min(releaseThreshold, num - catchThreshold); float num3 = angle - minAngle; float num4 = (float)(0.0 - ((double)angle - (double)maxAngle)); bool flag = minCatchState; bool flag2 = maxCatchState; minCatchState = (double)num3 <= ((!minCatchState) ? ((double)catchThreshold) : ((double)num2)); maxCatchState = (double)num4 <= ((!maxCatchState) ? ((double)catchThreshold) : ((double)num2)); return (!flag && minCatchState) || (!flag2 && maxCatchState); } } }