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 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.HuntDrilling
{
[BepInProcess("h3vr.exe")]
[BepInPlugin("BitWizrd.HuntDrilling", "HuntDrilling", "1.0.6")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
[Description("Built with MeatKit")]
public class HuntDrillingPlugin : 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.HuntDrilling");
OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntDrilling", "", "drillingrifle", "", "");
}
}
}
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;
}
}
}
namespace BitWizrd.Break
{
public class BreakActionForegrip : FVRShotgunForegrip
{
public override void FVRFixedUpdate()
{
if (!((Object)(object)base.RB == (Object)null))
{
((FVRShotgunForegrip)this).FVRFixedUpdate();
}
}
public override bool IsInteractable()
{
return ((FVRShotgunForegrip)this).IsInteractable();
}
public override void FVRUpdate()
{
if (!((Object)(object)base.Hinge == (Object)null))
{
((FVRShotgunForegrip)this).FVRUpdate();
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
if (!((Object)(object)base.Hinge == (Object)null))
{
((FVRShotgunForegrip)this).UpdateInteraction(hand);
}
}
public override void EndInteraction(FVRViveHand hand)
{
if ((Object)(object)base.Hinge != (Object)null)
{
((FVRShotgunForegrip)this).EndInteraction(hand);
return;
}
((FVRInteractiveObject)this).m_isHeld = false;
((FVRInteractiveObject)this).m_hand = null;
if (((FVRAlternateGrip)this).FunctionalityEnabled && (Object)(object)((FVRAlternateGrip)this).PrimaryObject != (Object)null && (Object)(object)((FVRAlternateGrip)this).PrimaryObject.AltGrip == (Object)(object)this)
{
((FVRAlternateGrip)this).PrimaryObject.AltGrip = null;
}
}
}
public class BreakActionModded : BreakActionWeapon
{
private GameObject m_hingeGO;
private Transform m_hingeOriginalParent;
private Rigidbody m_hingeRB;
private float m_cachedMass;
private float m_cachedDrag;
private float m_cachedAngularDrag;
private bool m_cachedUseGravity;
private RigidbodyInterpolation m_cachedInterpolation;
private CollisionDetectionMode m_cachedCollisionDetection;
private RigidbodyConstraints m_cachedConstraints;
private Vector3 m_cachedAxis;
private Vector3 m_cachedAnchor;
private Vector3 m_cachedConnectedAnchor;
private Rigidbody m_cachedConnectedBody;
private JointLimits m_cachedLimits;
private bool m_cachedUseSpring;
private JointSpring m_cachedSpring;
private bool m_cachedUseMotor;
private JointMotor m_cachedMotor;
private bool m_initialized;
private FVRShotgunForegrip m_foregrip;
private Vector3 m_weldedLocalPos;
private Quaternion m_weldedLocalRot;
private bool m_needsPreciseSnap;
public override void Awake()
{
//IL_00a1: 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_00b2: 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_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_00d4: 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)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_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_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0178: 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_0182: 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_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: 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)
((BreakActionWeapon)this).Awake();
if (!((Object)(object)base.Hinge == (Object)null))
{
m_hingeGO = ((Component)base.Hinge).gameObject;
m_hingeRB = m_hingeGO.GetComponent<Rigidbody>();
m_hingeOriginalParent = m_hingeGO.transform.parent;
m_cachedMass = m_hingeRB.mass;
m_cachedDrag = m_hingeRB.drag;
m_cachedAngularDrag = m_hingeRB.angularDrag;
m_cachedUseGravity = m_hingeRB.useGravity;
m_cachedInterpolation = m_hingeRB.interpolation;
m_cachedCollisionDetection = m_hingeRB.collisionDetectionMode;
m_cachedConstraints = m_hingeRB.constraints;
m_cachedAxis = ((Joint)base.Hinge).axis;
m_cachedAnchor = ((Joint)base.Hinge).anchor;
m_cachedConnectedAnchor = ((Joint)base.Hinge).connectedAnchor;
m_cachedConnectedBody = ((Joint)base.Hinge).connectedBody;
m_cachedLimits = base.Hinge.limits;
m_cachedUseSpring = base.Hinge.useSpring;
m_cachedSpring = base.Hinge.spring;
m_cachedUseMotor = base.Hinge.useMotor;
m_cachedMotor = base.Hinge.motor;
m_weldedLocalPos = ((Component)this).transform.InverseTransformPoint(m_hingeGO.transform.position);
m_weldedLocalRot = Quaternion.Inverse(((Component)this).transform.rotation) * m_hingeGO.transform.rotation;
m_foregrip = m_hingeGO.GetComponentInChildren<FVRShotgunForegrip>(true);
}
}
private void WeldBarrel()
{
//IL_0030: 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_007c: 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)
if (!((Object)(object)m_hingeGO == (Object)null))
{
if ((Object)(object)m_hingeRB != (Object)null)
{
m_hingeRB.velocity = Vector3.zero;
m_hingeRB.angularVelocity = Vector3.zero;
}
if ((Object)(object)base.Hinge != (Object)null)
{
Object.Destroy((Object)(object)base.Hinge);
base.Hinge = null;
}
m_hingeGO.transform.localPosition = base.m_foreStartPos;
m_hingeGO.transform.localEulerAngles = Vector3.zero;
if ((Object)(object)m_hingeRB != (Object)null)
{
Object.Destroy((Object)(object)m_hingeRB);
m_hingeRB = null;
}
m_hingeGO.transform.SetParent(((Component)this).transform, true);
m_needsPreciseSnap = true;
}
}
private void SeparateBarrel()
{
//IL_008b: 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_00ad: 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_00cd: 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_00f1: 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_0122: 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_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)m_hingeGO == (Object)null))
{
m_hingeGO.transform.SetParent(m_hingeOriginalParent, true);
m_hingeRB = m_hingeGO.AddComponent<Rigidbody>();
m_hingeRB.mass = m_cachedMass;
m_hingeRB.drag = m_cachedDrag;
m_hingeRB.angularDrag = m_cachedAngularDrag;
m_hingeRB.useGravity = m_cachedUseGravity;
m_hingeRB.interpolation = m_cachedInterpolation;
m_hingeRB.collisionDetectionMode = m_cachedCollisionDetection;
m_hingeRB.constraints = m_cachedConstraints;
m_hingeRB.velocity = Vector3.zero;
m_hingeRB.angularVelocity = Vector3.zero;
HingeJoint val = m_hingeGO.AddComponent<HingeJoint>();
((Joint)val).axis = m_cachedAxis;
((Joint)val).anchor = m_cachedAnchor;
((Joint)val).autoConfigureConnectedAnchor = false;
((Joint)val).connectedAnchor = m_cachedConnectedAnchor;
((Joint)val).connectedBody = m_cachedConnectedBody;
val.useLimits = true;
JointLimits cachedLimits = m_cachedLimits;
((JointLimits)(ref cachedLimits)).max = base.HingeLimit;
val.limits = cachedLimits;
val.useSpring = m_cachedUseSpring;
if (m_cachedUseSpring)
{
val.spring = m_cachedSpring;
}
val.useMotor = m_cachedUseMotor;
if (m_cachedUseMotor)
{
val.motor = m_cachedMotor;
}
base.Hinge = val;
if ((Object)(object)m_foregrip != (Object)null)
{
m_foregrip.Hinge = val;
m_foregrip.RB = m_hingeRB;
}
}
}
public override void FVRFixedUpdate()
{
if (!m_initialized)
{
m_initialized = true;
if (base.m_isLatched)
{
WeldBarrel();
}
}
if (base.m_isLatched && (Object)(object)base.Hinge == (Object)null && (Mathf.Abs(base.m_latchRot) > 5f || base.m_isExternallyUnlatched))
{
SeparateBarrel();
}
if ((Object)(object)base.Hinge == (Object)null)
{
base.m_isLatched = true;
base.m_latchRot = 0f;
base.m_isExternallyUnlatched = false;
base.IsLatchHeldOpen = false;
}
bool isLatched = base.m_isLatched;
((BreakActionWeapon)this).FVRFixedUpdate();
if (!isLatched && base.m_isLatched)
{
WeldBarrel();
}
}
public override void FVRUpdate()
{
//IL_002a: 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)
if (m_needsPreciseSnap && (Object)(object)m_hingeGO != (Object)null)
{
m_hingeGO.transform.localPosition = m_weldedLocalPos;
m_hingeGO.transform.localRotation = m_weldedLocalRot;
m_needsPreciseSnap = false;
}
((FVRFireArm)this).FVRUpdate();
}
}
}
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();
}
}
}
namespace BitWizrd.DrillingRifle
{
public class Drilling : BreakActionWeapon
{
public enum FireMode
{
Rifle,
Shotgun
}
[Header("Drilling Additions")]
public FVRFireArmChamber ShotgunChamber;
public Transform ShotgunMuzzle;
public Transform RifleSight;
public Vector3 RifleSightRotation_Rifle = Vector3.zero;
public Vector3 RifleSightRotation_Shotgun = new Vector3(90f, 0f, 0f);
[Header("Switch Transform")]
public Transform SwitchTransform;
public Vector3 SwitchPosition_Rifle;
public Vector3 SwitchPosition_Shotgun;
[Header("Shotgun Trigger")]
public Transform ShotgunTrigger;
public float ShotgunTriggerUnpulled;
public float ShotgunTriggerPulled;
public InterpStyle ShotgunTriggerInterpStyle = (InterpStyle)1;
public Axis ShotgunTriggerAxis;
private float m_shotgunTriggerFloat;
[Header("Shotgun Effects")]
public int ShotgunMuzzleFireIndex = 0;
public int ShotgunMuzzleSmokeIndex = 1;
public int ShotgunGasOutIndex = 2;
[Header("Recoil Profile (Shotgun)")]
public FVRFireArmRecoilProfile ShotgunRecoilProfile;
[Header("Ammo Type Configuration")]
public FireArmRoundType ShotgunRoundType = (FireArmRoundType)21;
private FireArmRoundType m_originalRoundType;
private bool m_hasInitializedRoundTypes = false;
private FireMode currentMode = FireMode.Rifle;
private bool m_isShotgunHammerCocked;
private bool m_wasUnlatchedLastFrame;
private bool m_hasEjectedShell;
private static FieldInfo m_ejectsOnOpenField;
private List<FVRFireArmChamber> m_allChambers = new List<FVRFireArmChamber>();
private bool m_isFilteringChambers = false;
private FireArmRoundType? m_lastFilteredType = null;
private FireArmRoundType m_savedRoundType;
private GameObject m_hingeGO;
private Transform m_hingeOriginalParent;
private Rigidbody m_hingeRB;
private FVRShotgunForegrip m_foregrip;
private float m_cachedMass;
private float m_cachedDrag;
private float m_cachedAngularDrag;
private bool m_cachedUseGravity;
private RigidbodyInterpolation m_cachedInterpolation;
private CollisionDetectionMode m_cachedCollisionDetection;
private RigidbodyConstraints m_cachedConstraints;
private Vector3 m_cachedAxis;
private Vector3 m_cachedAnchor;
private Vector3 m_cachedConnectedAnchor;
private Rigidbody m_cachedConnectedBody;
private JointLimits m_cachedLimits;
private bool m_cachedUseSpring;
private JointSpring m_cachedSpring;
private bool m_cachedUseMotor;
private JointMotor m_cachedMotor;
private Vector3 m_weldedLocalPos;
private Quaternion m_weldedLocalRot;
private bool m_needsPreciseSnap;
private bool m_initialized;
public FireMode CurrentMode
{
get
{
return currentMode;
}
private set
{
currentMode = value;
UpdateRifleSight();
UpdateSwitchTransform();
((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin = false;
base.HasTriggerReset = true;
}
}
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_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_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: 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_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: 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_01e7: 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_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: 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_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: 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_014d: 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_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
if (!m_hasInitializedRoundTypes)
{
m_originalRoundType = ((FVRFireArm)this).RoundType;
m_hasInitializedRoundTypes = true;
}
((BreakActionWeapon)this).Awake();
if ((Object)(object)ShotgunChamber != (Object)null)
{
ShotgunChamber.Firearm = (FVRFireArm)(object)this;
ShotgunChamber.IsAccessible = false;
ShotgunChamber.RoundType = ShotgunRoundType;
if (!((FVRFireArm)this).FChambers.Contains(ShotgunChamber))
{
((FVRFireArm)this).FChambers.Add(ShotgunChamber);
}
}
m_allChambers.Clear();
m_allChambers.AddRange(((FVRFireArm)this).FChambers);
if ((Object)(object)base.Hinge != (Object)null)
{
m_hingeGO = ((Component)base.Hinge).gameObject;
m_hingeRB = m_hingeGO.GetComponent<Rigidbody>();
m_hingeOriginalParent = m_hingeGO.transform.parent;
if ((Object)(object)m_hingeRB != (Object)null)
{
m_cachedMass = m_hingeRB.mass;
m_cachedDrag = m_hingeRB.drag;
m_cachedAngularDrag = m_hingeRB.angularDrag;
m_cachedUseGravity = m_hingeRB.useGravity;
m_cachedInterpolation = m_hingeRB.interpolation;
m_cachedCollisionDetection = m_hingeRB.collisionDetectionMode;
m_cachedConstraints = m_hingeRB.constraints;
}
m_cachedAxis = ((Joint)base.Hinge).axis;
m_cachedAnchor = ((Joint)base.Hinge).anchor;
m_cachedConnectedAnchor = ((Joint)base.Hinge).connectedAnchor;
m_cachedConnectedBody = ((Joint)base.Hinge).connectedBody;
m_cachedLimits = base.Hinge.limits;
m_cachedUseSpring = base.Hinge.useSpring;
m_cachedSpring = base.Hinge.spring;
m_cachedUseMotor = base.Hinge.useMotor;
m_cachedMotor = base.Hinge.motor;
m_weldedLocalPos = ((Component)this).transform.InverseTransformPoint(m_hingeGO.transform.position);
m_weldedLocalRot = Quaternion.Inverse(((Component)this).transform.rotation) * m_hingeGO.transform.rotation;
m_foregrip = m_hingeGO.GetComponentInChildren<FVRShotgunForegrip>(true);
}
if ((object)m_ejectsOnOpenField == null)
{
m_ejectsOnOpenField = typeof(BreakActionWeapon).GetField("m_EjectsOnOpen", BindingFlags.Instance | BindingFlags.NonPublic);
}
UpdateRifleSight();
UpdateSwitchTransform();
((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin = false;
base.HasTriggerReset = true;
}
private void WeldBarrel()
{
//IL_002f: 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_007b: 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)
if (!((Object)(object)m_hingeGO == (Object)null))
{
if ((Object)(object)m_hingeRB != (Object)null)
{
m_hingeRB.velocity = Vector3.zero;
m_hingeRB.angularVelocity = Vector3.zero;
}
if ((Object)(object)base.Hinge != (Object)null)
{
Object.Destroy((Object)(object)base.Hinge);
base.Hinge = null;
}
m_hingeGO.transform.localPosition = base.m_foreStartPos;
m_hingeGO.transform.localEulerAngles = Vector3.zero;
if ((Object)(object)m_hingeRB != (Object)null)
{
Object.Destroy((Object)(object)m_hingeRB);
m_hingeRB = null;
}
m_hingeGO.transform.SetParent(((Component)this).transform, true);
m_needsPreciseSnap = true;
}
}
private void SeparateBarrel()
{
//IL_008a: 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_00ac: 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_00cc: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0135: 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_017a: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)m_hingeGO == (Object)null))
{
m_hingeGO.transform.SetParent(m_hingeOriginalParent, true);
m_hingeRB = m_hingeGO.AddComponent<Rigidbody>();
m_hingeRB.mass = m_cachedMass;
m_hingeRB.drag = m_cachedDrag;
m_hingeRB.angularDrag = m_cachedAngularDrag;
m_hingeRB.useGravity = m_cachedUseGravity;
m_hingeRB.interpolation = m_cachedInterpolation;
m_hingeRB.collisionDetectionMode = m_cachedCollisionDetection;
m_hingeRB.constraints = m_cachedConstraints;
m_hingeRB.velocity = Vector3.zero;
m_hingeRB.angularVelocity = Vector3.zero;
HingeJoint val = m_hingeGO.AddComponent<HingeJoint>();
((Joint)val).axis = m_cachedAxis;
((Joint)val).anchor = m_cachedAnchor;
((Joint)val).autoConfigureConnectedAnchor = false;
((Joint)val).connectedAnchor = m_cachedConnectedAnchor;
((Joint)val).connectedBody = m_cachedConnectedBody;
val.useLimits = true;
JointLimits cachedLimits = m_cachedLimits;
((JointLimits)(ref cachedLimits)).max = base.HingeLimit;
val.limits = cachedLimits;
val.useSpring = m_cachedUseSpring;
if (m_cachedUseSpring)
{
val.spring = m_cachedSpring;
}
val.useMotor = m_cachedUseMotor;
if (m_cachedUseMotor)
{
val.motor = m_cachedMotor;
}
base.Hinge = val;
if ((Object)(object)m_foregrip != (Object)null)
{
m_foregrip.Hinge = val;
m_foregrip.RB = m_hingeRB;
}
}
}
private bool GetBaseEjectsOnOpen()
{
if ((object)m_ejectsOnOpenField != null)
{
return (bool)m_ejectsOnOpenField.GetValue(this);
}
return true;
}
public override Transform GetMuzzle()
{
if (CurrentMode == FireMode.Shotgun && (Object)(object)ShotgunMuzzle != (Object)null)
{
return ShotgunMuzzle;
}
return ((BreakActionWeapon)this).GetMuzzle();
}
private void UpdateRifleSight()
{
//IL_002a: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)RifleSight != (Object)null)
{
Vector3 val = ((CurrentMode != FireMode.Rifle) ? RifleSightRotation_Shotgun : RifleSightRotation_Rifle);
RifleSight.localRotation = Quaternion.Euler(val);
}
}
private void UpdateSwitchTransform()
{
//IL_002a: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)SwitchTransform != (Object)null)
{
Vector3 localPosition = ((CurrentMode != FireMode.Rifle) ? SwitchPosition_Shotgun : SwitchPosition_Rifle);
SwitchTransform.localPosition = localPosition;
}
}
public void SyncShotgunHammerWithBase()
{
if ((Object)(object)ShotgunChamber != (Object)null)
{
m_isShotgunHammerCocked = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
UpdateVisualHammers();
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Invalid comparison between Unknown and I4
//IL_00fb: 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_00d9: 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: Expected I4, but got Unknown
//IL_00ee: 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_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Expected I4, but got Unknown
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
if (hand.IsInStreamlinedMode)
{
if (hand.Input.AXButtonDown)
{
ToggleMode();
}
}
else
{
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (hand.Input.TouchpadDown && touchpadAxes.y < 0.1f)
{
ToggleMode();
}
}
if (CurrentMode == FireMode.Shotgun)
{
if ((Object)(object)ShotgunTrigger != (Object)null)
{
if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
{
m_shotgunTriggerFloat = hand.Input.TriggerFloat;
}
else
{
m_shotgunTriggerFloat = 0f;
}
float num = Mathf.Lerp(ShotgunTriggerUnpulled, ShotgunTriggerPulled, m_shotgunTriggerFloat);
if ((int)ShotgunTriggerInterpStyle == 1)
{
Vector3 localEulerAngles = ShotgunTrigger.localEulerAngles;
((Vector3)(ref localEulerAngles))[(int)ShotgunTriggerAxis] = num;
ShotgunTrigger.localEulerAngles = localEulerAngles;
}
else if ((int)ShotgunTriggerInterpStyle == 0)
{
Vector3 localPosition = ShotgunTrigger.localPosition;
((Vector3)(ref localPosition))[(int)ShotgunTriggerAxis] = num;
ShotgunTrigger.localPosition = localPosition;
}
}
if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
{
base.m_triggerFloat = hand.Input.TriggerFloat;
}
else
{
base.m_triggerFloat = 0f;
}
if (!base.HasTriggerReset && base.m_triggerFloat <= 0.45f)
{
base.HasTriggerReset = true;
}
if (!((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && hand.Input.TriggerUp)
{
((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin = true;
}
if (base.m_triggerFloat >= 0.9f && base.HasTriggerReset && ((BreakActionWeapon)this).IsLatched)
{
FireShotgun();
base.HasTriggerReset = false;
}
((BreakActionWeapon)this).UpdateInteraction(hand);
}
else
{
((BreakActionWeapon)this).UpdateInteraction(hand);
}
}
private void ToggleMode()
{
//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_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)
if (currentMode == FireMode.Rifle)
{
CurrentMode = FireMode.Shotgun;
((FVRFireArm)this).RoundType = ShotgunRoundType;
}
else
{
CurrentMode = FireMode.Rifle;
((FVRFireArm)this).RoundType = m_originalRoundType;
}
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
}
private void FireShotgun()
{
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
if (!m_isShotgunHammerCocked)
{
return;
}
m_isShotgunHammerCocked = false;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
if ((Object)(object)ShotgunChamber == (Object)null || !ShotgunChamber.IsFull || !ShotgunChamber.Fire())
{
UpdateVisualHammers();
return;
}
FVRFireArmRound round = ShotgunChamber.GetRound();
((FVRFireArm)this).Fire(ShotgunChamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
((FVRFireArm)this).FireMuzzleSmoke(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);
if ((Object)(object)round != (Object)null)
{
((FVRFireArm)this).PlayAudioGunShot(round, GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
}
UpdateVisualHammers();
}
public override void ConfigureFromFlagDic(Dictionary<string, string> f)
{
//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_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_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)
if (!m_hasInitializedRoundTypes)
{
m_originalRoundType = ((FVRFireArm)this).RoundType;
m_hasInitializedRoundTypes = true;
}
((BreakActionWeapon)this).ConfigureFromFlagDic(f);
if (f.TryGetValue("DrillingMode", out var value))
{
FireMode fireMode = (CurrentMode = ((value == "Shotgun") ? FireMode.Shotgun : FireMode.Rifle));
if (fireMode == FireMode.Shotgun)
{
((FVRFireArm)this).RoundType = ShotgunRoundType;
}
else
{
((FVRFireArm)this).RoundType = m_originalRoundType;
}
}
}
public override Dictionary<string, string> GetFlagDic()
{
Dictionary<string, string> flagDic = ((BreakActionWeapon)this).GetFlagDic();
flagDic.Add("DrillingMode", CurrentMode.ToString());
return flagDic;
}
public override void FVRFixedUpdate()
{
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: 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_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: 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_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)
if (!m_initialized)
{
m_initialized = true;
if (((BreakActionWeapon)this).IsLatched)
{
WeldBarrel();
}
}
if (base.m_isLatched && (Object)(object)base.Hinge == (Object)null && (Mathf.Abs(base.m_latchRot) > 5f || base.m_isExternallyUnlatched))
{
SeparateBarrel();
}
if ((Object)(object)base.Hinge == (Object)null)
{
base.m_isLatched = true;
base.m_latchRot = 0f;
base.m_isExternallyUnlatched = false;
base.IsLatchHeldOpen = false;
}
bool isLatched = ((BreakActionWeapon)this).IsLatched;
((BreakActionWeapon)this).FVRFixedUpdate();
if (!isLatched && ((BreakActionWeapon)this).IsLatched)
{
WeldBarrel();
}
if ((Object)(object)ShotgunChamber != (Object)null)
{
ShotgunChamber.IsAccessible = !((BreakActionWeapon)this).IsLatched;
}
if (!((BreakActionWeapon)this).IsLatched && !m_wasUnlatchedLastFrame)
{
m_isShotgunHammerCocked = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
UpdateVisualHammers();
m_wasUnlatchedLastFrame = true;
m_hasEjectedShell = false;
}
else if (((BreakActionWeapon)this).IsLatched)
{
m_wasUnlatchedLastFrame = false;
m_hasEjectedShell = false;
}
if (GetBaseEjectsOnOpen() && !((BreakActionWeapon)this).IsLatched && !m_hasEjectedShell && (Object)(object)base.Hinge != (Object)null && Mathf.Abs(((Component)base.Hinge).transform.localEulerAngles.x) >= base.HingeEjectLimit)
{
if ((Object)(object)ShotgunChamber != (Object)null && ShotgunChamber.IsFull && ShotgunChamber.IsSpent)
{
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f);
ShotgunChamber.EjectRound(((Component)ShotgunChamber).transform.position + ((Component)ShotgunChamber).transform.forward * base.EjectOffset, ((Component)ShotgunChamber).transform.forward * base.EjectSpeed, Vector3.right, false);
}
m_hasEjectedShell = true;
}
}
public void UpdateVisualHammers()
{
((BreakActionWeapon)this).UpdateVisualHammers();
}
public override void FVRUpdate()
{
//IL_002a: 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)
if (m_needsPreciseSnap && (Object)(object)m_hingeGO != (Object)null)
{
m_hingeGO.transform.localPosition = m_weldedLocalPos;
m_hingeGO.transform.localRotation = m_weldedLocalRot;
m_needsPreciseSnap = false;
}
((FVRFireArm)this).FVRUpdate();
CheckQuickBeltSlotsForAmmo();
}
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 FireLightFlicker : MonoBehaviour
{
public Light Light;
public float BaseIntensity = 1f;
public float FlickerMin = 1f;
public float FlickerMax = 1f;
public float FlickerSpeed = 1f;
private float noiseOffset;
private void Awake()
{
if ((Object)(object)Light == (Object)null)
{
Light = ((Component)this).GetComponent<Light>();
}
noiseOffset = Random.value * 1000f;
}
private void Update()
{
if (!((Object)(object)Light == (Object)null))
{
float num = Mathf.PerlinNoise(Time.time * FlickerSpeed + noiseOffset, 0f);
Light.intensity = BaseIntensity * Mathf.Lerp(FlickerMin, FlickerMax, num);
}
}
}
public class GunStockLace : MonoBehaviour
{
public float length = 0.5f;
public float gravity = 9.81f;
public float damping = 0.05f;
public float maxDeviationAngle = 45f;
public LayerMask collisionMask;
public bool showGizmos = false;
private Vector3 pendulumDirection;
private Vector3 angularVelocity;
private Quaternion baseRotation;
private Vector3 restDirection;
private Vector3 previousPosition;
private void Start()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
baseRotation = ((Component)this).transform.rotation;
restDirection = baseRotation * -Vector3.up;
pendulumDirection = restDirection;
previousPosition = ((Component)this).transform.position;
}
private void FixedUpdate()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)this).transform.position - previousPosition;
previousPosition = ((Component)this).transform.position;
float fixedDeltaTime = Time.fixedDeltaTime;
Vector3 val2 = Vector3.Cross(((Vector3)(ref pendulumDirection)).normalized, Vector3.down) * gravity / length;
Vector3 val3 = val * 10f / fixedDeltaTime;
angularVelocity += (val2 + val3) * fixedDeltaTime;
angularVelocity *= Mathf.Clamp01(1f - damping * fixedDeltaTime);
Quaternion val4 = Quaternion.Euler(angularVelocity * fixedDeltaTime * 57.29578f);
pendulumDirection = val4 * pendulumDirection;
HandleCollisionLimits();
ClampToMaxAngle();
((Component)this).transform.rotation = Quaternion.FromToRotation(-Vector3.up, pendulumDirection) * baseRotation;
}
private void HandleCollisionLimits()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)this).transform.position, pendulumDirection, ref val, length, LayerMask.op_Implicit(collisionMask)))
{
Vector3 normal = ((RaycastHit)(ref val)).normal;
Vector3 val2 = Vector3.ProjectOnPlane(pendulumDirection, normal);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
float num = Vector3.Angle(pendulumDirection, normalized);
pendulumDirection = Vector3.RotateTowards(pendulumDirection, normalized, num * ((float)Math.PI / 180f), 0f);
angularVelocity = Vector3.ProjectOnPlane(angularVelocity, normal);
}
}
private void ClampToMaxAngle()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Angle(restDirection, pendulumDirection);
if (num > maxDeviationAngle)
{
pendulumDirection = Vector3.RotateTowards(restDirection, pendulumDirection, maxDeviationAngle * ((float)Math.PI / 180f), 0f);
angularVelocity *= 0.5f;
}
}
private void OnDrawGizmos()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
if (showGizmos)
{
Gizmos.color = Color.yellow;
Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + pendulumDirection * length);
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(((Component)this).transform.position + pendulumDirection * length, 0.02f);
}
}
}
public class HuntDollarSR : MonoBehaviour
{
private IEnumerator Start()
{
yield return (object)new WaitForSeconds(3f);
string str = "CharcoalBriquette(Clone)";
((Object)((Component)this).gameObject).name = str;
Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
Component val = (Component)(object)componentsInChildren[i];
((Object)val.gameObject).name = str;
}
}
}
public class MotionAffectorRuntime : MonoBehaviour
{
public ParticleSystem Ps;
public bool HasGravity;
public string GravityType = "Spherical";
public float GravityAccel;
public float GravityDecay = 10f;
public Vector3 GravityAxis = Vector3.up;
public Transform GravityTarget;
public bool HasVortex;
public float VortexSpeed;
public float VortexDecay = 10f;
public Vector3 VortexAxis = Vector3.up;
public Transform VortexTarget;
private Particle[] buffer;
private void Awake()
{
if ((Object)(object)Ps == (Object)null)
{
Ps = ((Component)this).GetComponent<ParticleSystem>();
}
}
private void LateUpdate()
{
//IL_0143: 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_0148: 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_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: 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_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: 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_0203: 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_0217: 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_0353: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: 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_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: 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_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: 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_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//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_0238: 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_023c: 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_0245: 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_024f: 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_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_0319: 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_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: 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_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Ps == (Object)null || (!HasGravity && !HasVortex))
{
return;
}
int particleCount = Ps.particleCount;
if (particleCount == 0)
{
return;
}
if (buffer == null || buffer.Length < particleCount)
{
buffer = (Particle[])(object)new Particle[Mathf.Max(particleCount, 64)];
}
int particles = Ps.GetParticles(buffer);
float deltaTime = Time.deltaTime;
if (deltaTime <= 0f)
{
return;
}
float num = ((!HasGravity || !(GravityDecay > 0f)) ? 0f : (1f / (GravityDecay * GravityDecay)));
float num2 = ((!HasVortex || !(VortexDecay > 0f)) ? 0f : (1f / (VortexDecay * VortexDecay)));
bool flag = string.Equals(GravityType, "Cylindrical", StringComparison.OrdinalIgnoreCase);
Vector3 val = ((!(((Vector3)(ref GravityAxis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref GravityAxis)).normalized);
Vector3 val2 = ((!(((Vector3)(ref VortexAxis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref VortexAxis)).normalized);
Vector3 val3 = ((!HasGravity || !((Object)(object)GravityTarget != (Object)null)) ? ((Component)this).transform.position : GravityTarget.position);
Vector3 val4 = ((!HasVortex || !((Object)(object)VortexTarget != (Object)null)) ? ((Component)this).transform.position : VortexTarget.position);
for (int i = 0; i < particles; i++)
{
Vector3 position = ((Particle)(ref buffer[i])).position;
Vector3 val5 = ((Particle)(ref buffer[i])).velocity;
if (HasGravity)
{
Vector3 val7;
if (flag)
{
Vector3 val6 = position - val3;
val7 = val3 + val * Vector3.Dot(val, val6) - position;
}
else
{
val7 = val3 - position;
}
float sqrMagnitude = ((Vector3)(ref val7)).sqrMagnitude;
if (sqrMagnitude > 1E-08f)
{
float num3 = GravityAccel / (1f + num * sqrMagnitude);
val5 += ((Vector3)(ref val7)).normalized * (num3 * deltaTime);
}
}
if (HasVortex)
{
Vector3 val8 = position - val4;
Vector3 val9 = val4 + val2 * Vector3.Dot(val2, val8) - position;
float sqrMagnitude2 = ((Vector3)(ref val9)).sqrMagnitude;
if (sqrMagnitude2 > 1E-08f)
{
float num4 = VortexSpeed / (1f + num2 * sqrMagnitude2);
val5 += Vector3.Cross(((Vector3)(ref val9)).normalized, val2) * (num4 * deltaTime);
}
}
((Particle)(ref buffer[i])).position = position;
((Particle)(ref buffer[i])).velocity = val5;
}
Ps.SetParticles(buffer, particles);
}
}
public class PlayRandomSoundOnSpawn : MonoBehaviour
{
public AudioClip[] spawnSounds;
public float volume = 1f;
[Header("Pitch Settings")]
public float minPitch = 0.9f;
public float maxPitch = 1.1f;
private AudioSource audioSource;
private void Start()
{
if (spawnSounds.Length > 0)
{
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.playOnAwake = false;
audioSource.spatialBlend = 1f;
audioSource.volume = volume;
AudioClip val = spawnSounds[Random.Range(0, spawnSounds.Length)];
audioSource.pitch = Random.Range(minPitch, maxPitch);
audioSource.PlayOneShot(val);
}
}
}
public class RandomSpinOnSpawn : MonoBehaviour
{
public float spinForce = 0.5f;
public Vector3 torqueAxis = new Vector3(1f, 0f, 0f);
private Rigidbody rb;
private void Start()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
rb = ((Component)this).GetComponent<Rigidbody>();
if ((Object)(object)rb != (Object)null)
{
((Component)this).transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
rb.AddTorque(((Vector3)(ref torqueAxis)).normalized * spinForce, (ForceMode)1);
}
}
}