using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using ModularWorkshop; using OpenScripts2; 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] public class SuppressorAddSound : Suppressor { public bool PlaysTail = true; public AudioEvent AudEvent_SoundToPlay; public override void OnShot(FVRFireArm f, FVRTailSoundClass tailClass) { //IL_0072: 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_0080: Unknown result type (might be due to invalid IL or missing references) FVRFirearmAudioSet audioClipSet = f.AudioClipSet; if (PlaysTail) { f.PlayShotTail((FVRTailSoundClass)11, (FVRSoundEnvironment)12, 1f); int playerIFF = GM.CurrentPlayerBody.GetPlayerIFF(); GM.CurrentSceneSettings.OnPerceiveableSound(200f, 80f, ((Component)this).transform.position, playerIFF, GM.CurrentPlayerBody.PlayerEntities[0]); } else { f.PlayAudioAsHandling(AudEvent_SoundToPlay, ((Component)this).transform.position); } ((MuzzleDevice)this).OnShot(f, tailClass); } public override void OnShot(AttachableFirearm f, FVRTailSoundClass tailClass) { //IL_0072: 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_0080: Unknown result type (might be due to invalid IL or missing references) FVRFirearmAudioSet audioClipSet = f.AudioClipSet; if (PlaysTail) { f.PlayShotTail((FVRTailSoundClass)11, (FVRSoundEnvironment)12, 1f); int playerIFF = GM.CurrentPlayerBody.GetPlayerIFF(); GM.CurrentSceneSettings.OnPerceiveableSound(200f, 80f, ((Component)this).transform.position, playerIFF, GM.CurrentPlayerBody.PlayerEntities[0]); } else { f.PlayAudioAsHandling(AudEvent_SoundToPlay, ((Component)this).transform.position); } ((MuzzleDevice)this).OnShot(f, tailClass); } [ContextMenu("Copy Suppressor")] public void CopySuppressor() { Suppressor[] components = ((Component)this).GetComponents(); Suppressor val = components.Single((Suppressor c) => (Object)(object)c != (Object)(object)this); foreach (FVRFireArmAttachmentMount attachmentMount in ((FVRPhysicalObject)val).AttachmentMounts) { attachmentMount.MyObject = (FVRPhysicalObject)(object)this; attachmentMount.Parent = (FVRPhysicalObject)(object)this; } ((FVRFireArmAttachment)val).AttachmentInterface.Attachment = (FVRFireArmAttachment)(object)this; ((FVRFireArmAttachment)val).Sensor.Attachment = (FVRFireArmAttachment)(object)this; UniversalCopy.CopyComponent((Component)(object)this, val); } } public class ModularReloadTriggerWellBinder : MonoBehaviour { [Header("Bind Settings")] [Tooltip("If true, assigns AFireArm (Attachable Firearm). If false, assigns FireArm.")] public bool UseAttachableFireArm = false; [Header("Round Type")] public bool ChangesFireArmRoundType = false; public FireArmRoundType CustomRoundType; [Header("Recoil Profile")] public bool ChangesRecoilProfile = false; public FVRFireArmRecoilProfile CustomRecoilProfile; public FVRFireArmRecoilProfile CustomRecoilProfileStocked; [Header("Magazine Mounting")] public bool ChangesMagazineMountPoint = false; public Transform CustomMagMountPoint; public Transform CustomMagEjectPoint; [Header("Magazine Type")] public bool ChangesMagazineType = false; public FireArmMagazineType CustomMagazineType; [Header("Audio Set")] public bool ChangesAudioSet = false; public FVRFirearmAudioSet CustomAudioSet; private FVRFireArmReloadTriggerWell _well; private FVRFireArm _boundFireArm; private bool _hasOriginals; private FireArmRoundType _origRoundType; private FVRFireArmRecoilProfile _origRecoilProfile; private FVRFireArmRecoilProfile _origRecoilProfileStocked; private bool _origUsesStockedRecoilProfile; private Transform _origMagazineMountPos; private Transform _origMagazineEjectPos; private FireArmMagazineType _origMagazineType; private FVRFirearmAudioSet _origAudioSet; private void Awake() { _well = ((Component)this).GetComponent(); if ((Object)(object)_well == (Object)null) { ModularWorkshopManager.LogWarning((MonoBehaviour)(object)this, "No FVRFireArmReloadTriggerWell found!"); } } private void OnEnable() { BindToParentFirearm(); } private void OnDisable() { Unbind(); } private void BindToParentFirearm() { if ((Object)(object)_well == (Object)null) { return; } if (UseAttachableFireArm) { AttachableFirearm componentInParent = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { ModularWorkshopManager.LogWarning((MonoBehaviour)(object)this, "Parent AttachableFirearm not found!"); } else { _well.AFireArm = componentInParent; } return; } FVRFireArm componentInParent2 = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent2 == (Object)null) { ModularWorkshopManager.LogWarning((MonoBehaviour)(object)this, "Parent FVRFireArm not found!"); return; } _well.FireArm = componentInParent2; ApplyOverrides(componentInParent2); } private void Unbind() { if (!((Object)(object)_well == (Object)null)) { if ((Object)(object)_boundFireArm != (Object)null) { RestoreOverrides(_boundFireArm); _boundFireArm = null; } _well.FireArm = null; _well.AFireArm = null; } } private void ApplyOverrides(FVRFireArm firearm) { //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_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)firearm == (Object)null) { return; } if (!_hasOriginals) { _origRoundType = firearm.RoundType; _origRecoilProfile = firearm.RecoilProfile; _origRecoilProfileStocked = firearm.RecoilProfileStocked; _origUsesStockedRecoilProfile = firearm.UsesStockedRecoilProfile; _origMagazineMountPos = firearm.MagazineMountPos; _origMagazineEjectPos = firearm.MagazineEjectPos; _origMagazineType = firearm.MagazineType; _origAudioSet = firearm.AudioClipSet; _hasOriginals = true; } _boundFireArm = firearm; if (ChangesFireArmRoundType) { firearm.RoundType = CustomRoundType; } if (ChangesRecoilProfile) { firearm.RecoilProfile = CustomRecoilProfile; if ((Object)(object)CustomRecoilProfileStocked != (Object)null) { firearm.UsesStockedRecoilProfile = true; firearm.RecoilProfileStocked = CustomRecoilProfileStocked; } else { firearm.UsesStockedRecoilProfile = false; } } if (ChangesMagazineMountPoint) { firearm.MagazineMountPos = CustomMagMountPoint; firearm.MagazineEjectPos = CustomMagEjectPoint; } if (ChangesMagazineType) { firearm.MagazineType = CustomMagazineType; } if (ChangesAudioSet) { firearm.AudioClipSet = CustomAudioSet; } } private void RestoreOverrides(FVRFireArm firearm) { //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_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) if (!((Object)(object)firearm == (Object)null) && _hasOriginals) { firearm.RoundType = _origRoundType; firearm.RecoilProfile = _origRecoilProfile; firearm.RecoilProfileStocked = _origRecoilProfileStocked; firearm.UsesStockedRecoilProfile = _origUsesStockedRecoilProfile; firearm.MagazineMountPos = _origMagazineMountPos; firearm.MagazineEjectPos = _origMagazineEjectPos; firearm.MagazineType = _origMagazineType; firearm.AudioClipSet = _origAudioSet; _hasOriginals = false; } } } public class MuzzleDeviceParentMonitor : MuzzleDevice { public bool DisableParentBehavior = true; private FVRFireArmAttachmentMount monitoredAttachmentMount; public override void Start() { ((FVRInteractiveObject)this).Start(); FindAttachmentMount(); } private void Update() { if (DisableParentBehavior) { if ((Object)(object)monitoredAttachmentMount == (Object)null) { FindAttachmentMount(); } if ((Object)(object)monitoredAttachmentMount != (Object)null && monitoredAttachmentMount.ParentToThis) { KeepObjectInPlaceWhileParented(); } } } private void FindAttachmentMount() { monitoredAttachmentMount = ((Component)this).GetComponentInParent(); } private void KeepObjectInPlaceWhileParented() { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)monitoredAttachmentMount != (Object)null) { Vector3 position = ((Component)this).transform.position; Quaternion rotation = ((Component)this).transform.rotation; monitoredAttachmentMount.ParentToThis = false; ((Component)this).transform.position = position; ((Component)this).transform.rotation = rotation; } } } public class LeverActionDustCover : FVRInteractiveObject { public LeverActionFirearm LeverAction; public Transform DustCoverGeo; public float OpenRot; public float ClosedRot; public float RotSpeed = 360f; public AudioEvent AudEvent_CoverOpen; public AudioEvent AudEvent_CoverClose; private bool m_isOpen; private float m_curRot; private float m_tarRot; public override void Awake() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).Awake(); m_curRot = ClosedRot; m_tarRot = ClosedRot; m_isOpen = false; if ((Object)(object)DustCoverGeo != (Object)null) { DustCoverGeo.localEulerAngles = new Vector3(0f, 0f, ClosedRot); } } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); ToggleDustCoverState(); } private void ToggleDustCoverState() { if (m_isOpen) { Close(); } else { Open(); } } public override void FVRUpdate() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (!m_isOpen && (Object)(object)LeverAction != (Object)null && (int)LeverAction.m_curLeverPos != 0) { Open(); } if (Mathf.Abs(m_tarRot - m_curRot) > 0.01f) { m_curRot = Mathf.MoveTowards(m_curRot, m_tarRot, Time.deltaTime * RotSpeed); if ((Object)(object)DustCoverGeo != (Object)null) { DustCoverGeo.localEulerAngles = new Vector3(0f, 0f, m_curRot); } } } private void Open() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!m_isOpen) { m_isOpen = true; m_tarRot = OpenRot; RotSpeed = 1900f; if (AudEvent_CoverOpen != null && AudEvent_CoverOpen.Clips.Count > 0) { AudioSource.PlayClipAtPoint(AudEvent_CoverOpen.Clips[0], ((Component)this).transform.position, AudEvent_CoverOpen.VolumeRange.x); } } } private void Close() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (m_isOpen) { m_isOpen = false; m_tarRot = ClosedRot; RotSpeed = 800f; if (AudEvent_CoverClose != null && AudEvent_CoverClose.Clips.Count > 0) { AudioSource.PlayClipAtPoint(AudEvent_CoverClose.Clips[0], ((Component)this).transform.position, AudEvent_CoverClose.VolumeRange.x); } } } } public class LeverActionMagRelease : FVRInteractiveObject { public LeverActionFirearm LeverActionWeapon; public Transform MagazineReleaseButton; public Vector3 MagReleaseUnpressed = Vector3.zero; public Vector3 MagReleasePressed = new Vector3(0f, -5f, 0f); public InterpStyle MagReleaseInterp = (InterpStyle)0; private bool isHeldDown = false; public override void SimpleInteraction(FVRViveHand hand) { TryReleaseMag(hand); } public override void UpdateInteraction(FVRViveHand hand) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); bool flag = hand.Input.TriggerDown || hand.Input.TouchpadDown || hand.Input.AXButtonDown; bool flag2 = hand.Input.TriggerPressed || hand.Input.TouchpadPressed || hand.Input.AXButtonPressed; if (flag) { TryReleaseMag(hand); } if ((Object)(object)MagazineReleaseButton != (Object)null) { if (flag2 && !isHeldDown) { SetAnimatedComponent(MagazineReleaseButton, MagReleasePressed, MagReleaseInterp); isHeldDown = true; } else if (!flag2 && isHeldDown) { SetAnimatedComponent(MagazineReleaseButton, MagReleaseUnpressed, MagReleaseInterp); isHeldDown = false; } } } private void TryReleaseMag(FVRViveHand hand) { if ((Object)(object)LeverActionWeapon != (Object)null && (Object)(object)((FVRFireArm)LeverActionWeapon).Magazine != (Object)null) { FVRFireArmMagazine magazine = ((FVRFireArm)LeverActionWeapon).Magazine; ((FVRFireArm)LeverActionWeapon).EjectMag(false); if ((Object)(object)hand != (Object)null) { hand.ForceSetInteractable((FVRInteractiveObject)(object)magazine); ((FVRInteractiveObject)magazine).BeginInteraction(hand); } } } private void SetAnimatedComponent(Transform t, Vector3 value, InterpStyle interp) { //IL_0001: 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_0015: Invalid comparison between Unknown and I4 //IL_0008: 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 ((int)interp == 0) { t.localPosition = value; } else if ((int)interp == 1) { t.localEulerAngles = value; } } } namespace Volks.HuntScopesPack; [BepInPlugin("Volks.HuntScopesPack", "HuntScopesPack", "1.1.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class HuntScopesPackPlugin : 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(), "Volks.HuntScopesPack"); OtherLoader.RegisterDirectLoad(BasePath, "Volks.HuntScopesPack", "", "", "huntscopespack", ""); } } public class FVRTorch : FVRPhysicalObject { public GameObject FireGO; public GameObject LinkedObject; public AudioSource fireAud; public float BurnDuration = 120f; public float DestructionDelay = 5f; private bool m_isBurning = false; private bool m_hasBeenLit = false; private bool m_canDestroy = false; private float m_burnTimer; private float m_unheldTimer; public override void Awake() { ((FVRPhysicalObject)this).Awake(); if ((Object)(object)FireGO != (Object)null) { fireAud = FireGO.GetComponent(); FireGO.SetActive(false); } if ((Object)(object)LinkedObject != (Object)null) { LinkedObject.SetActive(false); } } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); if (m_isBurning) { m_burnTimer -= Time.deltaTime; if ((Object)(object)fireAud != (Object)null) { fireAud.volume = Mathf.Lerp(fireAud.volume, 0f, Time.deltaTime / BurnDuration); } if (m_burnTimer <= 0f) { StopBurning(); } } if (m_canDestroy && !((FVRInteractiveObject)this).IsHeld) { m_unheldTimer -= Time.deltaTime; if (m_unheldTimer <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } else if (((FVRInteractiveObject)this).IsHeld) { m_unheldTimer = DestructionDelay; } } public void Ignite() { if (!m_hasBeenLit) { m_hasBeenLit = true; m_isBurning = true; m_burnTimer = BurnDuration; if ((Object)(object)FireGO != (Object)null) { FireGO.SetActive(true); } if ((Object)(object)fireAud != (Object)null) { fireAud.Play(); } if ((Object)(object)LinkedObject != (Object)null) { LinkedObject.SetActive(true); } } } private void StopBurning() { m_isBurning = false; m_canDestroy = true; if ((Object)(object)FireGO != (Object)null) { FireGO.SetActive(false); } if ((Object)(object)fireAud != (Object)null) { fireAud.Stop(); } Debug.Log((object)"Torch fire has died out."); } private void OnCollisionEnter(Collision col) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //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) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (m_hasBeenLit && m_isBurning && (Object)(object)col.collider.attachedRigidbody != (Object)null) { IFVRDamageable val = ((Component)col.collider).GetComponent() ?? ((Component)col.collider.attachedRigidbody).GetComponent(); if (val != null) { Damage val2 = new Damage(); val2.Dam_Thermal = 50f; val2.Dam_TotalEnergetic = 50f; val2.point = ((ContactPoint)(ref col.contacts[0])).point; val2.hitNormal = ((ContactPoint)(ref col.contacts[0])).normal; val2.strikeDir = ((Component)this).transform.forward; val.Damage(val2); } } } } public class TorchTrigger : MonoBehaviour { public FVRTorch Torch; public Collider collider; private void OnTriggerEnter(Collider col) { collider.enabled = false; ((Component)collider).gameObject.layer = LayerMask.NameToLayer("NoCol"); Torch.Ignite(); } }