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 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.HuntQuadDerringer
{
[BepInPlugin("BitWizrd.HuntQuadDerringer", "HuntQuadDerringer", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HuntQuadDerringerPlugin : 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.HuntQuadDerringer");
OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntQuadDerringer", "", "quadderringer", "", "");
}
}
}
public class BloodBondSR : MonoBehaviour
{
private void Awake()
{
string name = "Ammo_69_CashMoney_D100(Clone)";
((Object)((Component)this).gameObject).name = name;
Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
((Object)((Component)componentsInChildren[i]).gameObject).name = name;
}
}
}
public class CooldownSound : MonoBehaviour
{
public ClosedBoltWeapon weapon;
public AudioClip[] audioClips;
public float volume = 1f;
public int minShots = 5;
public int maxShots = 10;
public float minDelay = 0.5f;
public float maxDelay = 2f;
public float resetTime = 1.5f;
private AudioSource audioSource;
private int shotCounter = 0;
private float lastShotTime;
private bool lastRoundSpent;
private int nextShotThreshold;
private bool isPlayingSound = false;
private void Start()
{
if ((Object)(object)weapon == (Object)null)
{
weapon = ((Component)this).GetComponent<ClosedBoltWeapon>();
}
if ((Object)(object)weapon == (Object)null)
{
Debug.LogError((object)"CooldownSound: Weapon reference is missing. Attach this script to a ClosedBoltWeapon.");
return;
}
audioSource = ((Component)weapon).gameObject.GetComponent<AudioSource>();
if ((Object)(object)audioSource == (Object)null)
{
audioSource = ((Component)weapon).gameObject.AddComponent<AudioSource>();
}
audioSource.spatialBlend = 1f;
audioSource.playOnAwake = false;
audioSource.rolloffMode = (AudioRolloffMode)0;
lastRoundSpent = weapon.Chamber.IsSpent;
SetNewShotThreshold();
}
private void Update()
{
DetectFiring();
}
private void DetectFiring()
{
if (weapon.Chamber.IsFull && weapon.Chamber.IsSpent && !lastRoundSpent)
{
OnWeaponFired();
}
lastRoundSpent = weapon.Chamber.IsSpent;
}
private void OnWeaponFired()
{
float num = Time.time - lastShotTime;
if (num > resetTime)
{
shotCounter = 0;
SetNewShotThreshold();
}
shotCounter++;
lastShotTime = Time.time;
if (shotCounter >= nextShotThreshold)
{
((MonoBehaviour)this).StartCoroutine(PlaySoundWithDelay());
shotCounter = 0;
SetNewShotThreshold();
}
}
private IEnumerator PlaySoundWithDelay()
{
if (!isPlayingSound)
{
isPlayingSound = true;
float delay = Random.Range(minDelay, maxDelay);
yield return (object)new WaitForSeconds(delay);
if (audioClips.Length > 0)
{
int index = Random.Range(0, audioClips.Length);
audioSource.clip = audioClips[index];
audioSource.PlayOneShot(audioSource.clip, volume);
yield return (object)new WaitForSeconds(audioSource.clip.length);
}
isPlayingSound = false;
}
}
private void SetNewShotThreshold()
{
nextShotThreshold = Random.Range(minShots, maxShots + 1);
}
}
public class CustomWaggleJoint : MonoBehaviour
{
public float distanceLimit = 0.25f;
public float angleLimitLeft = 45f;
public float angleLimitRight = 45f;
public float gravityScale = 1f;
public bool useSpring;
public float springApproachRate = 0.95f;
public float damping;
public Transform hingeGraphic;
public Vector3 hingeGraphicRotationOffset;
public bool invertWaggleAxis;
public bool ManualExecution;
public float onHitLimitCooldown = 0.05f;
public Vector3 waggleAxis = Vector3.up;
public Vector3 rotationAxis = Vector3.up;
[Header("Gizmo Options")]
public bool debugGizmos = false;
public bool showRotationExtremes = false;
public bool showRotationDirectionArrows = false;
private Vector3 particlePos;
private Vector3 particleVel;
private bool leftCatchState;
private bool rightCatchState;
private float lastTouchTime = float.MinValue;
private Vector3 EffectiveWaggleDir()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
return ((Component)this).transform.TransformDirection((!invertWaggleAxis) ? waggleAxis : (-waggleAxis));
}
private void GetEffectiveAngleLimits(out float effectiveAngleMin, out float effectiveAngleMax)
{
if (invertWaggleAxis)
{
effectiveAngleMin = 0f - angleLimitLeft;
effectiveAngleMax = angleLimitRight;
}
else
{
effectiveAngleMin = 0f - angleLimitRight;
effectiveAngleMax = angleLimitLeft;
}
}
public void ResetParticlePos()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
particlePos = ((Component)this).transform.position + EffectiveWaggleDir() * distanceLimit;
particleVel = Vector3.zero;
}
private void OnHitLimit(float angularVelocity)
{
}
public void Execute()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
float deltaTime = Time.deltaTime;
Transform transform = ((Component)this).transform;
Vector3 val = Physics.gravity * gravityScale;
Vector3 val2 = particlePos;
Vector3 val3 = particleVel * Mathf.Pow(1f - damping, deltaTime) + val * deltaTime;
Vector3 val4 = val2 + val3 * deltaTime;
Vector3 val5 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized);
Vector3 val6 = EffectiveWaggleDir();
Vector3 position = transform.position;
if (useSpring)
{
val4 = Vector3.Lerp(val4, position + val6 * distanceLimit, 1f - Mathf.Pow(1f - springApproachRate, deltaTime));
}
GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax);
particlePos = ProjectOnHinge(val4, position, val5, val6, distanceLimit, effectiveAngleMin, effectiveAngleMax);
particleVel = (particlePos - val2) / deltaTime;
if ((Object)(object)hingeGraphic != (Object)null)
{
hingeGraphic.rotation = Quaternion.LookRotation(particlePos - transform.position, val5) * Quaternion.Euler(hingeGraphicRotationOffset);
}
}
private Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
float num = ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection);
num = Mathf.Clamp(num, angleMin, angleMax);
Vector3 val = Quaternion.AngleAxis(num, hingeAxis) * hingeDirection;
return val * distanceLimit + hingePivot;
}
private float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = point - hingePivot;
Vector3 val2 = Vector3.ProjectOnPlane(val, hingeAxis);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
return SignedAngle(hingeDirection, normalized, hingeAxis);
}
private float SignedAngle(Vector3 from, Vector3 to, Vector3 axis)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Angle(from, to);
return num * Mathf.Sign(Vector3.Dot(axis, Vector3.Cross(from, to)));
}
private void Start()
{
ResetParticlePos();
}
private void Update()
{
if (!ManualExecution)
{
Execute();
}
}
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);
}
}
}
}
public class GunStockLace : MonoBehaviour
{
public float length = 0.5f;
public float gravity = 9.81f;
public float damping = 0.05f;
public float maxDeviationAngle = 45f;
public LayerMask collisionMask;
public bool showGizmos = false;
private Vector3 pendulumDirection;
private Vector3 angularVelocity;
private Quaternion baseRotation;
private Vector3 restDirection;
private Vector3 previousPosition;
private void Start()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
baseRotation = ((Component)this).transform.rotation;
restDirection = baseRotation * -Vector3.up;
pendulumDirection = restDirection;
previousPosition = ((Component)this).transform.position;
}
private void FixedUpdate()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)this).transform.position - previousPosition;
previousPosition = ((Component)this).transform.position;
float fixedDeltaTime = Time.fixedDeltaTime;
Vector3 val2 = Vector3.Cross(((Vector3)(ref pendulumDirection)).normalized, Vector3.down) * gravity / length;
Vector3 val3 = val * 10f / fixedDeltaTime;
angularVelocity += (val2 + val3) * fixedDeltaTime;
angularVelocity *= Mathf.Clamp01(1f - damping * fixedDeltaTime);
Quaternion val4 = Quaternion.Euler(angularVelocity * fixedDeltaTime * 57.29578f);
pendulumDirection = val4 * pendulumDirection;
HandleCollisionLimits();
ClampToMaxAngle();
((Component)this).transform.rotation = Quaternion.FromToRotation(-Vector3.up, pendulumDirection) * baseRotation;
}
private void HandleCollisionLimits()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)this).transform.position, pendulumDirection, ref val, length, LayerMask.op_Implicit(collisionMask)))
{
Vector3 normal = ((RaycastHit)(ref val)).normal;
Vector3 val2 = Vector3.ProjectOnPlane(pendulumDirection, normal);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
float num = Vector3.Angle(pendulumDirection, normalized);
pendulumDirection = Vector3.RotateTowards(pendulumDirection, normalized, num * ((float)Math.PI / 180f), 0f);
angularVelocity = Vector3.ProjectOnPlane(angularVelocity, normal);
}
}
private void ClampToMaxAngle()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Angle(restDirection, pendulumDirection);
if (num > maxDeviationAngle)
{
pendulumDirection = Vector3.RotateTowards(restDirection, pendulumDirection, maxDeviationAngle * ((float)Math.PI / 180f), 0f);
angularVelocity *= 0.5f;
}
}
private void OnDrawGizmos()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
if (showGizmos)
{
Gizmos.color = Color.yellow;
Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + pendulumDirection * length);
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(((Component)this).transform.position + pendulumDirection * length, 0.02f);
}
}
}
public class HuntDollarSR : MonoBehaviour
{
private IEnumerator Start()
{
yield return (object)new WaitForSeconds(3f);
string str = "CharcoalBriquette(Clone)";
((Object)((Component)this).gameObject).name = str;
Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
Component val = (Component)(object)componentsInChildren[i];
((Object)val.gameObject).name = str;
}
}
}
public class PlayRandomSoundOnSpawn : MonoBehaviour
{
public AudioClip[] spawnSounds;
public float volume = 1f;
[Header("Pitch Settings")]
public float minPitch = 0.9f;
public float maxPitch = 1.1f;
private AudioSource audioSource;
private void Start()
{
if (spawnSounds.Length > 0)
{
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.playOnAwake = false;
audioSource.spatialBlend = 1f;
audioSource.volume = volume;
AudioClip val = spawnSounds[Random.Range(0, spawnSounds.Length)];
audioSource.pitch = Random.Range(minPitch, maxPitch);
audioSource.PlayOneShot(val);
}
}
}
namespace BitWizrd.Derringer
{
public class QuadDerringer : FVRFireArm
{
[Serializable]
public class DBarrel
{
public Transform MuzzlePoint;
public FVRFireArmChamber Chamber;
}
public enum HingeState
{
Closed,
Closing,
Open,
Opening
}
[Header("Derringer Params")]
public List<DBarrel> Barrels;
private int m_curBarrel;
public bool DoesHammerIterateBarrel = true;
public bool DoesFiringIterateBarrel = true;
public bool DoesBarrelIterationPlaySound;
public bool UsesBarrelIterationPiece;
public Transform BarrelIteration_Piece;
public Axis BarrelIteration_Axis;
public InterpStyle BarrelIteration_InterpStyle;
public List<float> BarrelIteration_Values = new List<float>();
public Transform Hinge;
public Axis Hinge_Axis;
public InterpStyle Hinge_InterpStyle;
public Vector2 HingeValues;
private float m_hingeLerp;
private HingeState m_hingeState;
private bool m_isBarrelOpen = false;
public bool DoesAutoEjectRounds;
public bool HasLatchPiece;
public Transform LatchPiece;
public Axis Latch_Axis;
public InterpStyle Latch_InterpStyle;
public Vector2 LatchValues;
public bool HasExternalHammer;
private bool m_isExternalHammerCocked;
public Transform ExternalHammer;
public Axis ExternalHammer_Axis;
public InterpStyle ExternalHammer_InterpStyle;
public Vector2 ExternalHammer_Values;
public bool HasExtractor;
public Transform Extractor;
public Axis Extractor_Axis;
public InterpStyle Extractor_InterpStyle;
public Vector2 Extractor_Values;
public Transform Trigger;
public Axis Trigger_Axis;
public InterpStyle Trigger_InterpStyle;
public Vector2 Trigger_Values;
public bool IsTriggerDoubleAction;
private bool m_hasTriggerReset;
public bool DeletesCartridgeOnFire;
public bool UseInvertedFlick;
private float triggerFloat;
[Header("Foregrip Hinge Control")]
[Tooltip("Reference to the foregrip that can open/close the hinge")]
public QuadDerringerForegrip ForegripRef;
[Tooltip("Set by foregrip when player requests latch toggle via off-hand input")]
public bool foregripLatch;
[Tooltip("Threshold (0-1) at which the hinge snaps fully open")]
public float HingeSnapOpenThreshold = 0.8f;
[Tooltip("Threshold (0-1) at which the hinge snaps fully closed")]
public float HingeSnapCloseThreshold = 0.2f;
public bool IsHingeLinear => (int)Hinge_InterpStyle == 0;
public bool IsBarrelOpen => m_isBarrelOpen;
public Vector3 GetHingeAxisVector()
{
//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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected I4, but got Unknown
//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_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_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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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)
if ((Object)(object)Hinge == (Object)null)
{
return Vector3.forward;
}
Axis hinge_Axis = Hinge_Axis;
return (Vector3)((int)hinge_Axis switch
{
0 => Hinge.right,
1 => Hinge.up,
2 => Hinge.forward,
_ => Hinge.forward,
});
}
public float GetHingeTravelRange()
{
return Mathf.Abs(HingeValues.y - HingeValues.x);
}
public HingeState GetHingeState()
{
return m_hingeState;
}
public bool IsExternalHammerCocked()
{
return m_isExternalHammerCocked;
}
public float GetHingeLerp()
{
return m_hingeLerp;
}
public void SetHingeLerp(float value)
{
//IL_0036: 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_007b: 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_00c1: 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)
m_hingeLerp = Mathf.Clamp01(value);
((FVRPhysicalObject)this).SetAnimatedComponent(Hinge, Mathf.Lerp(HingeValues.x, HingeValues.y, m_hingeLerp), Hinge_InterpStyle, Hinge_Axis);
if (HasLatchPiece)
{
((FVRPhysicalObject)this).SetAnimatedComponent(LatchPiece, Mathf.Lerp(LatchValues.x, LatchValues.y, m_hingeLerp), Latch_InterpStyle, Latch_Axis);
}
if (HasExtractor)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Extractor, Mathf.Lerp(Extractor_Values.x, Extractor_Values.y, m_hingeLerp), Extractor_InterpStyle, Extractor_Axis);
}
}
public void SetHingeState(HingeState state)
{
m_hingeState = state;
}
public void SetChambersAccessible(bool accessible)
{
m_isBarrelOpen = accessible;
for (int i = 0; i < Barrels.Count; i++)
{
Barrels[i].Chamber.IsAccessible = accessible;
}
}
public void OnHingeFullyOpened()
{
//IL_0037: 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_004e: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
if (DoesAutoEjectRounds)
{
bool flag = false;
for (int i = 0; i < Barrels.Count; i++)
{
FVRFireArmChamber chamber = Barrels[i].Chamber;
if (chamber.IsFull)
{
flag = true;
Vector3 val = Random.onUnitSphere * 10f;
chamber.EjectRound(((Component)chamber).transform.position + ((Component)chamber).transform.forward * -0.03f, ((Component)chamber).transform.forward * -0.3f, val, false);
}
}
if (flag)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f);
}
}
for (int j = 0; j < Barrels.Count; j++)
{
Barrels[j].Chamber.IsAccessible = true;
}
m_isBarrelOpen = true;
}
public void OnHingeStartClosing()
{
for (int i = 0; i < Barrels.Count; i++)
{
Barrels[i].Chamber.IsAccessible = false;
}
m_isBarrelOpen = false;
}
public void TryAutoEjectRounds()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0078: 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 (!DoesAutoEjectRounds)
{
return;
}
bool flag = false;
for (int i = 0; i < Barrels.Count; i++)
{
FVRFireArmChamber chamber = Barrels[i].Chamber;
if (chamber.IsFull)
{
flag = true;
Vector3 val = Random.onUnitSphere * 10f;
chamber.EjectRound(((Component)chamber).transform.position + ((Component)chamber).transform.forward * -0.03f, ((Component)chamber).transform.forward * -0.3f, val, false);
}
}
if (flag)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f);
}
}
public override void Awake()
{
((FVRFireArm)this).Awake();
foreach (DBarrel barrel in Barrels)
{
base.FChambers.Add(barrel.Chamber);
}
}
public override Transform GetMuzzle()
{
return Barrels[m_curBarrel].MuzzlePoint;
}
private void CockHammer()
{
//IL_0032: 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)
if (HasExternalHammer && !m_isExternalHammerCocked)
{
m_isExternalHammerCocked = true;
((FVRPhysicalObject)this).SetAnimatedComponent(ExternalHammer, ExternalHammer_Values.y, ExternalHammer_InterpStyle, ExternalHammer_Axis);
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
if (DoesHammerIterateBarrel)
{
IterateBarrel();
}
}
}
private void DropHammer()
{
//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)
bool flag = false;
if (HasExternalHammer)
{
if (m_isExternalHammerCocked)
{
m_isExternalHammerCocked = false;
((FVRPhysicalObject)this).SetAnimatedComponent(ExternalHammer, ExternalHammer_Values.x, ExternalHammer_InterpStyle, ExternalHammer_Axis);
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
flag = true;
}
}
else
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
flag = true;
}
if (flag)
{
FireBarrel(m_curBarrel);
}
}
public override void FVRUpdate()
{
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: 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_023b: 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_0385: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00c3: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)this).FVRUpdate();
bool flag = (Object)(object)ForegripRef != (Object)null && ((FVRPhysicalObject)this).IsAltHeld;
if (m_hingeState == HingeState.Opening && !flag)
{
m_hingeLerp += Time.deltaTime * Mathf.Lerp(4f, 30f, m_hingeLerp * m_hingeLerp);
if (m_hingeLerp >= 1f)
{
if (DoesAutoEjectRounds)
{
bool flag2 = false;
for (int i = 0; i < Barrels.Count; i++)
{
FVRFireArmChamber chamber = Barrels[i].Chamber;
if (chamber.IsFull)
{
flag2 = true;
Vector3 val = Random.onUnitSphere * 10f;
chamber.EjectRound(((Component)chamber).transform.position + ((Component)chamber).transform.forward * -0.03f, ((Component)chamber).transform.forward * -0.3f, val, false);
}
}
if (flag2)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f);
}
}
m_hingeState = HingeState.Open;
m_hingeLerp = 1f;
for (int j = 0; j < Barrels.Count; j++)
{
Barrels[j].Chamber.IsAccessible = true;
}
m_isBarrelOpen = true;
}
((FVRPhysicalObject)this).SetAnimatedComponent(Hinge, Mathf.Lerp(HingeValues.x, HingeValues.y, m_hingeLerp), Hinge_InterpStyle, Hinge_Axis);
if (HasLatchPiece)
{
((FVRPhysicalObject)this).SetAnimatedComponent(LatchPiece, Mathf.Lerp(LatchValues.x, LatchValues.y, m_hingeLerp), Latch_InterpStyle, Latch_Axis);
}
if (HasExtractor)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Extractor, Mathf.Lerp(Extractor_Values.x, Extractor_Values.y, m_hingeLerp), Extractor_InterpStyle, Extractor_Axis);
}
}
else if (m_hingeState == HingeState.Closing && !flag)
{
m_hingeLerp -= Time.deltaTime * Mathf.Lerp(3f, 25f, (m_hingeLerp - 1f) * (m_hingeLerp - 1f));
if (m_hingeLerp <= 0f)
{
m_hingeState = HingeState.Closed;
m_hingeLerp = 0f;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f);
}
((FVRPhysicalObject)this).SetAnimatedComponent(Hinge, Mathf.Lerp(HingeValues.x, HingeValues.y, m_hingeLerp), Hinge_InterpStyle, Hinge_Axis);
if (HasLatchPiece)
{
((FVRPhysicalObject)this).SetAnimatedComponent(LatchPiece, Mathf.Lerp(LatchValues.x, LatchValues.y, m_hingeLerp), Latch_InterpStyle, Latch_Axis);
}
if (HasExtractor)
{
((FVRPhysicalObject)this).SetAnimatedComponent(Extractor, Mathf.Lerp(Extractor_Values.x, Extractor_Values.y, m_hingeLerp), Extractor_InterpStyle, Extractor_Axis);
}
}
}
private void Unlatch()
{
if (m_hingeState == HingeState.Closed)
{
m_hingeState = HingeState.Opening;
m_hingeLerp = 0f;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
}
}
public void UnlatchForForegrip()
{
if (m_hingeState == HingeState.Closed)
{
m_hingeState = HingeState.Open;
}
}
private void Latch()
{
if (m_hingeState == HingeState.Open)
{
m_hingeState = HingeState.Closing;
m_hingeLerp = 1f;
for (int i = 0; i < Barrels.Count; i++)
{
Barrels[i].Chamber.IsAccessible = false;
}
m_isBarrelOpen = false;
}
}
public void LatchForForegrip()
{
if (m_hingeState == HingeState.Open)
{
m_hingeState = HingeState.Closed;
for (int i = 0; i < Barrels.Count; i++)
{
Barrels[i].Chamber.IsAccessible = false;
}
m_isBarrelOpen = false;
}
}
private void ToggleLatchState()
{
if (m_hingeState == HingeState.Closed)
{
Unlatch();
}
else if (m_hingeState == HingeState.Open)
{
Latch();
}
}
public void IterateBarrel()
{
//IL_006d: 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)
m_curBarrel++;
if (m_curBarrel >= Barrels.Count)
{
m_curBarrel = 0;
}
if (DoesBarrelIterationPlaySound)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
}
if (UsesBarrelIterationPiece)
{
((FVRPhysicalObject)this).SetAnimatedComponent(BarrelIteration_Piece, BarrelIteration_Values[m_curBarrel], BarrelIteration_InterpStyle, BarrelIteration_Axis);
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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_0046: Invalid comparison between Unknown and I4
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: 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_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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (!((Object)(object)ForegripRef != (Object)null) || !((FVRPhysicalObject)this).IsAltHeld)
{
float num = 0f;
Axis hinge_Axis = Hinge_Axis;
if ((int)hinge_Axis != 0)
{
if ((int)hinge_Axis != 1)
{
if ((int)hinge_Axis == 2)
{
num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).z;
}
}
else
{
num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).y;
}
}
else
{
num = ((Component)this).transform.InverseTransformDirection(hand.Input.VelAngularWorld).x;
}
if (UseInvertedFlick)
{
if (num > 15f)
{
Latch();
}
}
else if (num < -15f)
{
Latch();
}
}
if (hand.IsInStreamlinedMode)
{
if (hand.Input.BYButtonDown)
{
ToggleLatchState();
}
if (!((FVRPhysicalObject)this).IsAltHeld && hand.Input.AXButtonDown)
{
CockHammer();
}
}
else if (hand.Input.TouchpadDown)
{
if (!((FVRPhysicalObject)this).IsAltHeld && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) < 45f)
{
CockHammer();
}
if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f)
{
ToggleLatchState();
}
}
if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !((FVRPhysicalObject)this).IsAltHeld)
{
triggerFloat = hand.Input.TriggerFloat;
}
else
{
triggerFloat = 0f;
}
((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, Mathf.Lerp(Trigger_Values.x, Trigger_Values.y, triggerFloat), Trigger_InterpStyle, Trigger_Axis);
if (triggerFloat > 0.7f && m_hasTriggerReset)
{
m_hasTriggerReset = false;
DropHammer();
}
else if (triggerFloat < 0.2f && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !m_hasTriggerReset)
{
m_hasTriggerReset = true;
if (IsTriggerDoubleAction && DoesFiringIterateBarrel)
{
IterateBarrel();
}
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f);
}
}
public override void EndInteraction(FVRViveHand hand)
{
//IL_0020: 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)
((FVRFireArm)this).EndInteraction(hand);
triggerFloat = 0f;
((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, 0f, Trigger_InterpStyle, Trigger_Axis);
}
private void FireBarrel(int i)
{
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
if (m_hingeState != 0)
{
return;
}
FVRFireArmChamber chamber = Barrels[m_curBarrel].Chamber;
if (chamber.Fire())
{
((FVRFireArm)this).Fire(chamber, ((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(chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo)
{
chamber.IsSpent = false;
chamber.UpdateProxyDisplay();
}
else if (chamber.GetRound().IsCaseless)
{
chamber.SetRound((FVRFireArmRound)null, false);
}
if (DeletesCartridgeOnFire)
{
chamber.SetRound((FVRFireArmRound)null, false);
}
}
}
public override List<FireArmRoundClass> GetChamberRoundList()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
List<FireArmRoundClass> list = new List<FireArmRoundClass>();
for (int i = 0; i < Barrels.Count; i++)
{
if (Barrels[i].Chamber.IsFull)
{
list.Add(Barrels[i].Chamber.GetRound().RoundClass);
flag = true;
}
}
if (flag)
{
return list;
}
return null;
}
public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (rounds.Count <= 0)
{
return;
}
for (int i = 0; i < Barrels.Count; i++)
{
if (i < rounds.Count)
{
Barrels[i].Chamber.Autochamber(rounds[i]);
}
}
}
public override void ConfigureFromFlagDic(Dictionary<string, string> f)
{
//IL_0065: 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)
string empty = string.Empty;
string empty2 = string.Empty;
empty = "HammerState";
if (f.ContainsKey(empty))
{
empty2 = f[empty];
if (empty2 == "Cocked")
{
m_isExternalHammerCocked = true;
if ((Object)(object)ExternalHammer != (Object)null)
{
((FVRPhysicalObject)this).SetAnimatedComponent(ExternalHammer, ExternalHammer_Values.y, ExternalHammer_InterpStyle, ExternalHammer_Axis);
}
}
}
((FVRFireArm)this).ConfigureFromFlagDic(f);
}
public override Dictionary<string, string> GetFlagDic()
{
Dictionary<string, string> flagDic = ((FVRFireArm)this).GetFlagDic();
string key = "HammerState";
string value = "Uncocked";
if (m_isExternalHammerCocked)
{
value = "Cocked";
}
flagDic.Add(key, value);
return flagDic;
}
}
public class QuadDerringerForegrip : FVRAlternateGrip
{
private enum ForePos
{
Rearward,
Mid,
Forward
}
[Header("Foregrip Thresholds")]
[SerializeField]
private float ChamberAccessThreshold = 0.5f;
[SerializeField]
private float ChamberAccessHysteresis = 0.03f;
[SerializeField]
private float PositionHysteresis = 0.02f;
private const float ForegripLerpSpeed = 8f;
private const float ForePosForwardEpsilon = 0.003f;
private const float ForePosRearwardEpsilon = 0.001f;
private QuadDerringer m_weapon;
private bool m_hasUnlatched = false;
private Vector3 m_grabStartPos;
private float m_grabStartHingeLerp;
private ForePos m_curPos = ForePos.Rearward;
private ForePos m_lastPos = ForePos.Rearward;
private bool m_areChambersAccessible = false;
private QuadDerringer.HingeState m_lastHingeState = QuadDerringer.HingeState.Closed;
private float m_lastHingeLerp = 0f;
private float m_smoothedHingeLerp = 0f;
private float m_handAxisOffset = 0f;
private float m_grabStartAngle = 0f;
private bool m_playedCloseSoundThisInteraction = false;
public override void Awake()
{
((FVRAlternateGrip)this).Awake();
m_weapon = ((Component)this).GetComponentInParent<QuadDerringer>();
if ((Object)(object)m_weapon != (Object)null)
{
m_weapon.ForegripRef = this;
}
}
public override bool IsInteractable()
{
return true;
}
public override void BeginInteraction(FVRViveHand hand)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: 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_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_00db: Unknown result type (might be due to invalid IL or missing references)
((FVRAlternateGrip)this).BeginInteraction(hand);
if (!((Object)(object)m_weapon == (Object)null))
{
m_grabStartPos = ((HandInput)(ref hand.Input)).Pos;
m_grabStartHingeLerp = m_weapon.GetHingeLerp();
m_smoothedHingeLerp = m_grabStartHingeLerp;
m_curPos = GetForePos(m_grabStartHingeLerp);
m_lastPos = m_curPos;
m_areChambersAccessible = m_weapon.IsBarrelOpen;
m_lastHingeState = m_weapon.GetHingeState();
m_lastHingeLerp = m_grabStartHingeLerp;
m_playedCloseSoundThisInteraction = false;
Vector3 hingeAxisVector = m_weapon.GetHingeAxisVector();
m_handAxisOffset = Vector3.Dot(((HandInput)(ref hand.Input)).Pos - m_weapon.Hinge.position, hingeAxisVector);
m_grabStartAngle = GetHandAngle(hand, hingeAxisVector);
if (((FVRInteractiveObject)m_weapon).IsHeld)
{
m_weapon.UnlatchForForegrip();
m_hasUnlatched = true;
}
else
{
m_hasUnlatched = false;
}
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//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)
((FVRAlternateGrip)this).UpdateInteraction(hand);
if ((Object)(object)m_weapon == (Object)null)
{
return;
}
if (!m_hasUnlatched && ((FVRInteractiveObject)m_weapon).IsHeld)
{
m_weapon.UnlatchForForegrip();
m_hasUnlatched = true;
m_grabStartPos = ((HandInput)(ref hand.Input)).Pos;
m_grabStartHingeLerp = m_weapon.GetHingeLerp();
m_smoothedHingeLerp = m_grabStartHingeLerp;
m_curPos = GetForePos(m_grabStartHingeLerp);
m_lastPos = m_curPos;
m_areChambersAccessible = m_weapon.IsBarrelOpen;
m_lastHingeState = m_weapon.GetHingeState();
m_lastHingeLerp = m_grabStartHingeLerp;
m_playedCloseSoundThisInteraction = false;
}
if (m_hasUnlatched)
{
float num = CalculateHingeLerp(hand);
m_smoothedHingeLerp = Mathf.MoveTowards(m_smoothedHingeLerp, num, 8f * Time.deltaTime);
float hingeSnapOpenThreshold = m_weapon.HingeSnapOpenThreshold;
float hingeSnapCloseThreshold = m_weapon.HingeSnapCloseThreshold;
if (m_smoothedHingeLerp >= hingeSnapOpenThreshold - 0.003f)
{
m_smoothedHingeLerp = hingeSnapOpenThreshold;
}
m_weapon.SetHingeLerp(m_smoothedHingeLerp);
m_curPos = ClampStep(GetForePos(m_smoothedHingeLerp), m_lastPos);
if (m_curPos == ForePos.Rearward && m_lastPos != 0)
{
m_areChambersAccessible = false;
m_weapon.SetChambersAccessible(accessible: false);
((FVRFireArm)m_weapon).PlayAudioEvent((FirearmAudioEventType)18, 1f);
m_playedCloseSoundThisInteraction = true;
}
else if (m_curPos != 0 && m_lastPos == ForePos.Rearward)
{
m_areChambersAccessible = true;
m_weapon.SetChambersAccessible(accessible: true);
((FVRFireArm)m_weapon).PlayAudioEvent((FirearmAudioEventType)17, 1f);
}
else if (m_curPos == ForePos.Forward && m_lastPos != ForePos.Forward)
{
m_weapon.TryAutoEjectRounds();
}
m_lastPos = m_curPos;
if (m_smoothedHingeLerp >= m_weapon.HingeSnapOpenThreshold)
{
m_weapon.SetHingeState(QuadDerringer.HingeState.Open);
}
else if (m_smoothedHingeLerp <= m_weapon.HingeSnapCloseThreshold)
{
m_weapon.SetHingeState(QuadDerringer.HingeState.Closed);
}
if (m_weapon.GetHingeState() != m_lastHingeState)
{
m_lastHingeState = m_weapon.GetHingeState();
}
m_lastHingeLerp = m_smoothedHingeLerp;
}
}
private ForePos GetForePos(float hingeLerp)
{
float hingeSnapCloseThreshold = m_weapon.HingeSnapCloseThreshold;
float hingeSnapOpenThreshold = m_weapon.HingeSnapOpenThreshold;
if (hingeLerp >= hingeSnapOpenThreshold - 0.003f)
{
return ForePos.Forward;
}
if (hingeLerp <= hingeSnapCloseThreshold + 0.001f)
{
return ForePos.Rearward;
}
return ForePos.Mid;
}
private float CalculateHingeLerp(FVRViveHand hand)
{
//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_00d2: 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_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_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)
//IL_008d: 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_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_009e: 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)
if ((Object)(object)m_weapon.Hinge == (Object)null)
{
return m_grabStartHingeLerp;
}
Transform hinge = m_weapon.Hinge;
float hingeTravelRange = m_weapon.GetHingeTravelRange();
if (hingeTravelRange < 0.0001f)
{
return m_grabStartHingeLerp;
}
if (m_weapon.IsHingeLinear)
{
Vector3 hingeAxisVector = m_weapon.GetHingeAxisVector();
Vector3 val = ((HandInput)(ref hand.Input)).Pos - hingeAxisVector * m_handAxisOffset;
Vector3 val2 = val - m_grabStartPos;
float num = Vector3.Dot(val2, hingeAxisVector);
float num2 = num / hingeTravelRange;
return Mathf.Clamp01(m_grabStartHingeLerp + num2);
}
Vector3 hingeAxisVector2 = m_weapon.GetHingeAxisVector();
float handAngle = GetHandAngle(hand, hingeAxisVector2);
float num3 = handAngle - m_grabStartAngle;
float num4 = num3 / hingeTravelRange;
return Mathf.Clamp01(m_grabStartHingeLerp + num4);
}
private float GetHandAngle(FVRViveHand hand, Vector3 hingeAxisWorld)
{
//IL_0046: 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_0051: 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_0057: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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)
if ((Object)(object)m_weapon == (Object)null || (Object)(object)m_weapon.Hinge == (Object)null)
{
return 0f;
}
Transform hinge = m_weapon.Hinge;
Vector3 val = ((HandInput)(ref hand.Input)).Pos - hinge.position;
Vector3 val2 = Vector3.ProjectOnPlane(val, hingeAxisWorld);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
Vector3 val3 = Vector3.ProjectOnPlane(hinge.forward, hingeAxisWorld);
Vector3 normalized2 = ((Vector3)(ref val3)).normalized;
if (((Vector3)(ref normalized)).sqrMagnitude < 0.001f || ((Vector3)(ref normalized2)).sqrMagnitude < 0.001f)
{
return 0f;
}
float num = Vector3.Angle(normalized2, normalized);
Vector3 val4 = Vector3.Cross(normalized2, normalized);
if (Vector3.Dot(val4, hingeAxisWorld) < 0f)
{
num = 0f - num;
}
return num;
}
private ForePos ClampStep(ForePos desired, ForePos current)
{
return (ForePos)Mathf.Clamp((int)desired, (int)(current - 1), (int)(current + 1));
}
public override void EndInteraction(FVRViveHand hand)
{
if ((Object)(object)m_weapon != (Object)null)
{
m_weapon.foregripLatch = false;
float hingeLerp = m_weapon.GetHingeLerp();
if (hingeLerp <= m_weapon.HingeSnapCloseThreshold)
{
if (m_playedCloseSoundThisInteraction)
{
m_weapon.SetHingeState(QuadDerringer.HingeState.Closed);
}
else
{
m_weapon.SetHingeState(QuadDerringer.HingeState.Closing);
}
}
}
m_hasUnlatched = false;
((FVRAlternateGrip)this).EndInteraction(hand);
}
}
}
public class RandomSpinOnSpawn : MonoBehaviour
{
public float spinForce = 0.5f;
public Vector3 torqueAxis = new Vector3(1f, 0f, 0f);
private Rigidbody rb;
private void Start()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
rb = ((Component)this).GetComponent<Rigidbody>();
if ((Object)(object)rb != (Object)null)
{
((Component)this).transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
rb.AddTorque(((Vector3)(ref torqueAxis)).normalized * spinForce, (ForceMode)1);
}
}
}