using System; using System.Collections; 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: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace BitWizrd.HuntSpencer1882 { [BepInPlugin("BitWizrd.HuntSpencer1882", "HuntSpencer1882", "1.0.7")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class HuntSpencer1882Plugin : 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.HuntSpencer1882"); OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntSpencer1882", "", "spencer1882", "", ""); } } } public class BloodBondSR : MonoBehaviour { private void Awake() { string name = "Ammo_69_CashMoney_D100(Clone)"; ((Object)((Component)this).gameObject).name = name; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Object)((Component)componentsInChildren[i]).gameObject).name = name; } } } public class CooldownSound : MonoBehaviour { public ClosedBoltWeapon weapon; public AudioClip[] audioClips; public float volume = 1f; public int minShots = 5; public int maxShots = 10; public float minDelay = 0.5f; public float maxDelay = 2f; public float resetTime = 1.5f; private AudioSource audioSource; private int shotCounter = 0; private float lastShotTime; private bool lastRoundSpent; private int nextShotThreshold; private bool isPlayingSound = false; private void Start() { if ((Object)(object)weapon == (Object)null) { weapon = ((Component)this).GetComponent(); } if ((Object)(object)weapon == (Object)null) { Debug.LogError((object)"CooldownSound: Weapon reference is missing. Attach this script to a ClosedBoltWeapon."); return; } audioSource = ((Component)weapon).gameObject.GetComponent(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)weapon).gameObject.AddComponent(); } audioSource.spatialBlend = 1f; audioSource.playOnAwake = false; audioSource.rolloffMode = (AudioRolloffMode)0; lastRoundSpent = weapon.Chamber.IsSpent; SetNewShotThreshold(); } private void Update() { DetectFiring(); } private void DetectFiring() { if (weapon.Chamber.IsFull && weapon.Chamber.IsSpent && !lastRoundSpent) { OnWeaponFired(); } lastRoundSpent = weapon.Chamber.IsSpent; } private void OnWeaponFired() { float num = Time.time - lastShotTime; if (num > resetTime) { shotCounter = 0; SetNewShotThreshold(); } shotCounter++; lastShotTime = Time.time; if (shotCounter >= nextShotThreshold) { ((MonoBehaviour)this).StartCoroutine(PlaySoundWithDelay()); shotCounter = 0; SetNewShotThreshold(); } } private IEnumerator PlaySoundWithDelay() { if (!isPlayingSound) { isPlayingSound = true; float delay = Random.Range(minDelay, maxDelay); yield return (object)new WaitForSeconds(delay); if (audioClips.Length > 0) { int index = Random.Range(0, audioClips.Length); audioSource.clip = audioClips[index]; audioSource.PlayOneShot(audioSource.clip, volume); yield return (object)new WaitForSeconds(audioSource.clip.length); } isPlayingSound = false; } } private void SetNewShotThreshold() { nextShotThreshold = Random.Range(minShots, maxShots + 1); } } public class CustomWaggleJoint : MonoBehaviour { public float distanceLimit = 0.25f; public float angleLimitLeft = 45f; public float angleLimitRight = 45f; public float gravityScale = 1f; public bool useSpring; public float springApproachRate = 0.95f; public float damping; public Transform hingeGraphic; public Vector3 hingeGraphicRotationOffset; public bool invertWaggleAxis; public bool ManualExecution; public float onHitLimitCooldown = 0.05f; public Vector3 waggleAxis = Vector3.up; public Vector3 rotationAxis = Vector3.up; [Header("Gizmo Options")] public bool debugGizmos = false; public bool showRotationExtremes = false; public bool showRotationDirectionArrows = false; private Vector3 particlePos; private Vector3 particleVel; private bool leftCatchState; private bool rightCatchState; private float lastTouchTime = float.MinValue; private Vector3 EffectiveWaggleDir() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.TransformDirection((!invertWaggleAxis) ? waggleAxis : (-waggleAxis)); } private void GetEffectiveAngleLimits(out float effectiveAngleMin, out float effectiveAngleMax) { if (invertWaggleAxis) { effectiveAngleMin = 0f - angleLimitLeft; effectiveAngleMax = angleLimitRight; } else { effectiveAngleMin = 0f - angleLimitRight; effectiveAngleMax = angleLimitLeft; } } public void ResetParticlePos() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) particlePos = ((Component)this).transform.position + EffectiveWaggleDir() * distanceLimit; particleVel = Vector3.zero; } private void OnHitLimit(float angularVelocity) { } public void Execute() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) float deltaTime = Time.deltaTime; Transform transform = ((Component)this).transform; Vector3 val = Physics.gravity * gravityScale; Vector3 val2 = particlePos; Vector3 val3 = particleVel * Mathf.Pow(1f - damping, deltaTime) + val * deltaTime; Vector3 val4 = val2 + val3 * deltaTime; Vector3 val5 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized); Vector3 val6 = EffectiveWaggleDir(); Vector3 position = transform.position; if (useSpring) { val4 = Vector3.Lerp(val4, position + val6 * distanceLimit, 1f - Mathf.Pow(1f - springApproachRate, deltaTime)); } GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax); particlePos = ProjectOnHinge(val4, position, val5, val6, distanceLimit, effectiveAngleMin, effectiveAngleMax); particleVel = (particlePos - val2) / deltaTime; if ((Object)(object)hingeGraphic != (Object)null) { hingeGraphic.rotation = Quaternion.LookRotation(particlePos - transform.position, val5) * Quaternion.Euler(hingeGraphicRotationOffset); } } private Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) float num = ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection); num = Mathf.Clamp(num, angleMin, angleMax); Vector3 val = Quaternion.AngleAxis(num, hingeAxis) * hingeDirection; return val * distanceLimit + hingePivot; } private float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - hingePivot; Vector3 val2 = Vector3.ProjectOnPlane(val, hingeAxis); Vector3 normalized = ((Vector3)(ref val2)).normalized; return SignedAngle(hingeDirection, normalized, hingeAxis); } private float SignedAngle(Vector3 from, Vector3 to, Vector3 axis) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(from, to); return num * Mathf.Sign(Vector3.Dot(axis, Vector3.Cross(from, to))); } private void Start() { ResetParticlePos(); } private void Update() { if (!ManualExecution) { Execute(); } } } namespace BitWizrd.ShotgunMod { public class FullyAutomaticShotgun : TubeFedShotgun { public float fireRate = 5f; private float nextFireTime = 0f; private bool m_triggerWasHeldOnGrab = false; public override void BeginInteraction(FVRViveHand hand) { ((FVRFireArm)this).BeginInteraction(hand); m_triggerWasHeldOnGrab = hand.Input.TriggerFloat >= base.TriggerBreakThreshold; } public override void UpdateInteraction(FVRViveHand hand) { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) base.m_triggerFloat = Mathf.Clamp(hand.Input.TriggerFloat, 0f, 1f); if (base.m_triggerFloat >= base.TriggerBreakThreshold && Time.time >= nextFireTime && !m_triggerWasHeldOnGrab && base.m_isHammerCocked && (int)base.Bolt.CurPos == 0) { ((TubeFedShotgun)this).ReleaseHammer(); nextFireTime = Time.time + 1f / fireRate; } if (base.m_triggerFloat < base.TriggerResetThreshold) { m_triggerWasHeldOnGrab = false; } ((FVRPhysicalObject)this).SetAnimatedComponent(base.Trigger, Mathf.Lerp(base.TriggerUnheld, base.TriggerHeld, base.m_triggerFloat), base.TriggerInterp, base.TriggerAxis); } } } public class GunStockLace : MonoBehaviour { public float length = 0.5f; public float gravity = 9.81f; public float damping = 0.05f; public float maxDeviationAngle = 45f; public LayerMask collisionMask; public bool showGizmos = false; private Vector3 pendulumDirection; private Vector3 angularVelocity; private Quaternion baseRotation; private Vector3 restDirection; private Vector3 previousPosition; private void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) baseRotation = ((Component)this).transform.rotation; restDirection = baseRotation * -Vector3.up; pendulumDirection = restDirection; previousPosition = ((Component)this).transform.position; } private void FixedUpdate() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - previousPosition; previousPosition = ((Component)this).transform.position; float fixedDeltaTime = Time.fixedDeltaTime; Vector3 val2 = Vector3.Cross(((Vector3)(ref pendulumDirection)).normalized, Vector3.down) * gravity / length; Vector3 val3 = val * 10f / fixedDeltaTime; angularVelocity += (val2 + val3) * fixedDeltaTime; angularVelocity *= Mathf.Clamp01(1f - damping * fixedDeltaTime); Quaternion val4 = Quaternion.Euler(angularVelocity * fixedDeltaTime * 57.29578f); pendulumDirection = val4 * pendulumDirection; HandleCollisionLimits(); ClampToMaxAngle(); ((Component)this).transform.rotation = Quaternion.FromToRotation(-Vector3.up, pendulumDirection) * baseRotation; } private void HandleCollisionLimits() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position, pendulumDirection, ref val, length, LayerMask.op_Implicit(collisionMask))) { Vector3 normal = ((RaycastHit)(ref val)).normal; Vector3 val2 = Vector3.ProjectOnPlane(pendulumDirection, normal); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Vector3.Angle(pendulumDirection, normalized); pendulumDirection = Vector3.RotateTowards(pendulumDirection, normalized, num * ((float)Math.PI / 180f), 0f); angularVelocity = Vector3.ProjectOnPlane(angularVelocity, normal); } } private void ClampToMaxAngle() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(restDirection, pendulumDirection); if (num > maxDeviationAngle) { pendulumDirection = Vector3.RotateTowards(restDirection, pendulumDirection, maxDeviationAngle * ((float)Math.PI / 180f), 0f); angularVelocity *= 0.5f; } } private void OnDrawGizmos() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (showGizmos) { Gizmos.color = Color.yellow; Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + pendulumDirection * length); Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position + pendulumDirection * length, 0.02f); } } } public class HuntDollarSR : MonoBehaviour { private IEnumerator Start() { yield return (object)new WaitForSeconds(3f); string str = "CharcoalBriquette(Clone)"; ((Object)((Component)this).gameObject).name = str; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Component val = (Component)(object)componentsInChildren[i]; ((Object)val.gameObject).name = str; } } } public class PlayRandomSoundOnSpawn : MonoBehaviour { public AudioClip[] spawnSounds; public float volume = 1f; [Header("Pitch Settings")] public float minPitch = 0.9f; public float maxPitch = 1.1f; private AudioSource audioSource; private void Start() { if (spawnSounds.Length > 0) { audioSource = ((Component)this).gameObject.AddComponent(); audioSource.playOnAwake = false; audioSource.spatialBlend = 1f; audioSource.volume = volume; AudioClip val = spawnSounds[Random.Range(0, spawnSounds.Length)]; audioSource.pitch = Random.Range(minPitch, maxPitch); audioSource.PlayOneShot(val); } } } public class RandomSpinOnSpawn : MonoBehaviour { public float spinForce = 0.5f; public Vector3 torqueAxis = new Vector3(1f, 0f, 0f); private Rigidbody rb; private void Start() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) rb = ((Component)this).GetComponent(); if ((Object)(object)rb != (Object)null) { ((Component)this).transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); rb.AddTorque(((Vector3)(ref torqueAxis)).normalized * spinForce, (ForceMode)1); } } } namespace BitWizrd.Shotgun { public class ToggleLinkShotgun : TubeFedShotgun { public ToggleLinkShotgunBolt ToggleBolt; public Transform CockingTrigger; public float CockedTriggerAngle = 20f; public float UncockedTriggerAngle = 0f; public bool LockProxyRoundInChamber = true; private bool _hasReleasedHammer = false; private float _lastTriggerValue = 0f; public override void FVRUpdate() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00f8: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) ((TubeFedShotgun)this).FVRUpdate(); if ((Object)(object)base.Chamber != (Object)null && base.Chamber.IsFull) { float boltLerpBetweenRearAndFore = ToggleBolt.GetBoltLerpBetweenRearAndFore(); float num = 1f - boltLerpBetweenRearAndFore; if (num >= ToggleBolt.ToggleDropThreshold || !ToggleBolt.IsToggleLinkDown) { base.Chamber.ProxyRound.position = ((Component)base.Chamber).transform.position; base.Chamber.ProxyRound.rotation = ((Component)base.Chamber).transform.rotation; } else { float num2 = Mathf.Clamp01((ToggleBolt.ToggleDropThreshold - num) / (ToggleBolt.ToggleDropThreshold - ToggleBolt.FullyRearThreshold)); base.Chamber.ProxyRound.position = Vector3.Lerp(((Component)base.Chamber).transform.position, base.RoundPos_Ejection.position, num2); base.Chamber.ProxyRound.rotation = Quaternion.Slerp(((Component)base.Chamber).transform.rotation, base.RoundPos_Ejection.rotation, num2); } } } private void Update() { if ((Object)(object)base.Handle == (Object)null) { return; } ToggleBolt.UpdateBolt(); ((TubeFedShotgun)this).UpdateCarrier(); UpdateCockingTrigger(); if (!((TubeFedShotgun)this).IsHammerCocked) { return; } FieldInfo field = typeof(TubeFedShotgun).GetField("m_triggerFloat", BindingFlags.Instance | BindingFlags.NonPublic); float num = 0f; if ((object)field != null) { num = (float)field.GetValue(this); } if (num >= base.TriggerBreakThreshold && _lastTriggerValue < base.TriggerBreakThreshold && !_hasReleasedHammer) { if ((Object)(object)base.Chamber != (Object)null && base.Chamber.IsFull && ToggleBolt.IsBoltAtRest) { ((TubeFedShotgun)this).ReleaseHammer(); _hasReleasedHammer = true; } } else if (num < base.TriggerResetThreshold) { _hasReleasedHammer = false; } _lastTriggerValue = num; } private void UpdateCockingTrigger() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)CockingTrigger == (Object)null)) { float num = ((!((TubeFedShotgun)this).IsHammerCocked) ? UncockedTriggerAngle : CockedTriggerAngle); CockingTrigger.localRotation = Quaternion.Euler(num, 0f, 0f); } } public override void UpdateInteraction(FVRViveHand hand) { ((TubeFedShotgun)this).UpdateInteraction(hand); if (!((Object)(object)ToggleBolt != (Object)null) || ToggleBolt.IsBoltAtRest) { return; } FieldInfo field = typeof(TubeFedShotgun).GetField("m_triggerFloat", BindingFlags.Instance | BindingFlags.NonPublic); if ((object)field != null) { float num = (float)field.GetValue(this); if (num < base.TriggerBreakThreshold) { field.SetValue(this, 0f); } } } public override void FVRFixedUpdate() { ((FVRFireArm)this).FVRFixedUpdate(); ((FVRFireArm)this).IsBreachOpenForGasOut = !ToggleBolt.IsBoltAtRest; } } public class ToggleLinkShotgunBolt : TubeFedShotgunBolt { private enum PumpState { Forward, Rearward, SpringUp, AtRear, ForwardMotion } public Transform ToggleBolt; public float ToggleDownAngle = -13f; public float ToggleEjectAngle = 15f; public float ToggleResetAngle = 0f; public float FullyRearThreshold = 0.05f; public float FullyForwardThreshold = 0.99f; public float ToggleDropThreshold = 0.5f; public float springDuration = 0.08f; public float minBounceFactor = 0.3f; public float maxBounceFactor = 0.6f; private TubeFedShotgun parentShotgun; private TubeFedShotgunHandle pumpHandle; private float customProgress = 1f; private PumpState currentState = PumpState.Forward; private float springTimer = 0f; private float springStartAngle = 0f; private float springBounceFactor = 0f; public Transform ClipToRotate; public float ClipMaxZAngle = 15f; public float ClipRotationBeginProgress = 0.8f; public float ClipRotationEndProgress = 0.75f; private bool isToggleLinkDown = false; private float forwardStartProgress = 0f; public bool IsBoltAtRest => currentState == PumpState.Forward; public bool IsToggleLinkDown => isToggleLinkDown; public override void Start() { //IL_00a7: 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_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) parentShotgun = ((Component)this).GetComponentInParent(); if ((Object)(object)parentShotgun != (Object)null) { pumpHandle = parentShotgun.Handle; } if ((Object)(object)ToggleBolt != (Object)null) { if ((Object)(object)ToggleBolt.parent != (Object)null) { ToggleBolt.localRotation = ToggleBolt.parent.rotation * Quaternion.Euler(ToggleResetAngle, 0f, 0f); } else { ToggleBolt.rotation = Quaternion.Euler(ToggleResetAngle, 0f, 0f); } } if ((Object)(object)pumpHandle != (Object)null) { customProgress = pumpHandle.GetBoltLerpBetweenRearAndFore(); } ((FVRInteractiveObject)this).Start(); } private void Update() { //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pumpHandle == (Object)null || (Object)(object)ToggleBolt == (Object)null) { return; } customProgress = Mathf.Clamp01(pumpHandle.GetBoltLerpBetweenRearAndFore()); float num = ToggleResetAngle; switch (currentState) { case PumpState.Forward: num = ToggleResetAngle; if (customProgress < FullyForwardThreshold) { currentState = PumpState.Rearward; } break; case PumpState.Rearward: num = ((!(customProgress >= ToggleDropThreshold)) ? ToggleDownAngle : Mathf.Lerp(ToggleResetAngle, ToggleDownAngle, (1f - customProgress) / (1f - ToggleDropThreshold))); if (customProgress < ToggleDropThreshold) { isToggleLinkDown = true; } if (customProgress <= FullyRearThreshold) { springBounceFactor = Random.Range(minBounceFactor, maxBounceFactor); currentState = PumpState.SpringUp; springTimer = 0f; springStartAngle = ToggleDownAngle; BoltEvent_SmackRear(); BoltEvent_ExtractRoundFromMag(); BoltEvent_EjectRound(); } else if (customProgress >= FullyForwardThreshold) { currentState = PumpState.Forward; num = ToggleResetAngle; } break; case PumpState.SpringUp: { springTimer += Time.deltaTime; float num4 = Mathf.Clamp01(springTimer / springDuration); float num5 = ElasticBounce(num4, springBounceFactor); num = Mathf.Lerp(springStartAngle, ToggleEjectAngle, num5); if (springTimer > 0f) { isToggleLinkDown = false; } if (num4 >= 1f) { currentState = PumpState.AtRear; num = ToggleEjectAngle; if ((Object)(object)parentShotgun != (Object)null) { parentShotgun.CockHammer(); } } break; } case PumpState.AtRear: num = ToggleEjectAngle; if (GetBoltLerpBetweenRearAndFore() <= ClipRotationEndProgress + 0.12f) { forwardStartProgress = customProgress; currentState = PumpState.ForwardMotion; } break; case PumpState.ForwardMotion: { float num2 = FullyForwardThreshold - forwardStartProgress; float num3 = ((!(num2 > 0f)) ? 1f : Mathf.Clamp01((customProgress - forwardStartProgress) / num2)); num = Mathf.Lerp(ToggleEjectAngle, ToggleResetAngle, num3); if (customProgress >= FullyForwardThreshold) { currentState = PumpState.Forward; num = ToggleResetAngle; BoltEvent_ArriveAtFore(); if ((Object)(object)parentShotgun != (Object)null && (Object)(object)parentShotgun.Bolt != (Object)null && parentShotgun.Bolt.m_isBoltLocked) { BoltEvent_BoltCaught(); } } break; } } ToggleBolt.localRotation = Quaternion.Euler(num, 0f, 0f); if (currentState == PumpState.Forward) { base.CurPos = (BoltPos)0; } else { base.CurPos = (BoltPos)1; } float boltLerpBetweenRearAndFore = GetBoltLerpBetweenRearAndFore(); if ((Object)(object)ClipToRotate != (Object)null) { float num6 = 0f; if (boltLerpBetweenRearAndFore >= ClipRotationBeginProgress) { num6 = ClipMaxZAngle; } else if (boltLerpBetweenRearAndFore <= ClipRotationEndProgress) { num6 = 0f; } else { float num7 = (boltLerpBetweenRearAndFore - ClipRotationEndProgress) / (ClipRotationBeginProgress - ClipRotationEndProgress); num6 = Mathf.Lerp(0f, ClipMaxZAngle, num7); } Quaternion localRotation = ClipToRotate.localRotation; Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles; ClipToRotate.localRotation = Quaternion.Euler(eulerAngles.x, eulerAngles.y, num6); } if ((Object)(object)parentShotgun != (Object)null) { typeof(TubeFedShotgun).GetField("IsBreachOpenForGasOut", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(parentShotgun, !IsBoltAtRest); } } private float ElasticBounce(float t, float amplitude) { if (t == 0f) { return 0f; } if (t == 1f) { return 1f; } float num = (float)Math.PI * 2f / 3f; return Mathf.Pow(2f, -10f * t) * Mathf.Sin((t * 10f - 0.75f) * num) * amplitude + 1f; } private void InvokeBaseMethod(string methodName) { typeof(TubeFedShotgunBolt).GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(this, null); } protected void BoltEvent_ArriveAtFore() { InvokeBaseMethod("BoltEvent_ArriveAtFore"); } protected void BoltEvent_EjectRound() { InvokeBaseMethod("BoltEvent_EjectRound"); } protected void BoltEvent_ExtractRoundFromMag() { InvokeBaseMethod("BoltEvent_ExtractRoundFromMag"); } protected void BoltEvent_SmackRear() { InvokeBaseMethod("BoltEvent_SmackRear"); } protected void BoltEvent_BoltCaught() { InvokeBaseMethod("BoltEvent_BoltCaught"); } public float GetBoltLerpBetweenRearAndFore() { return 1f - customProgress; } public void UpdateBolt() { Update(); } } }