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 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 JerryAr.Pistol_Magazine_Slide
{
[BepInPlugin("JerryAr.Pistol_Magazine_Slide", "Pistol_Magazine_Slide", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
public class Pistol_Magazine_SlidePlugin : 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(), "JerryAr.Pistol_Magazine_Slide");
}
}
}
namespace JerryPistol
{
[BepInPlugin("JerryPistol", "JP", "1.0.0")]
[BepInProcess("h3vr.exe")]
public class PistolMagSlide : BaseUnityPlugin
{
private void Update()
{
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: 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_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_031f: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_039f: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable != (Object)null && (Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable != (Object)null)
{
if ((Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<Handgun>() != (Object)null && Object.op_Implicit((Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRFireArmMagazine>()) && ((FVRFireArm)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<Handgun>()).UsesMagazines && ((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<FVRFireArmMagazine>().MagazineType == ((FVRFireArm)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<Handgun>()).MagazineType && (Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponentInChildren<FVRFireArmReloadTriggerWell>() != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponentInChildren<FVRFireArmReloadTriggerMag>() != (Object)null && Vector3.Distance(((Component)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponentInChildren<FVRFireArmReloadTriggerWell>()).gameObject.transform.position, ((Component)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponentInChildren<FVRFireArmReloadTriggerMag>()).gameObject.transform.position) <= 0.2f)
{
AxisLookAt(((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.transform, ((Component)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponentInChildren<FVRFireArmReloadTriggerWell>()).gameObject.transform.position, Vector3.up);
}
if ((Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<Handgun>() != (Object)null && Object.op_Implicit((Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRFireArmMagazine>()) && ((FVRFireArm)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<Handgun>()).UsesMagazines && ((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponent<FVRFireArmMagazine>().MagazineType == ((FVRFireArm)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponent<Handgun>()).MagazineType && (Object)(object)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponentInChildren<FVRFireArmReloadTriggerWell>() != (Object)null && (Object)(object)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponentInChildren<FVRFireArmReloadTriggerMag>() != (Object)null && Vector3.Distance(((Component)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponentInChildren<FVRFireArmReloadTriggerWell>()).gameObject.transform.position, ((Component)((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.GetComponentInChildren<FVRFireArmReloadTriggerMag>()).gameObject.transform.position) <= 0.2f)
{
AxisLookAt(((Component)GM.CurrentMovementManager.Hands[0].m_currentInteractable).gameObject.transform, ((Component)((Component)GM.CurrentMovementManager.Hands[1].m_currentInteractable).gameObject.GetComponentInChildren<FVRFireArmReloadTriggerWell>()).gameObject.transform.position, Vector3.up);
}
}
}
private void AxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_001c: 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_0023: 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_0029: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_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_007e: Unknown result type (might be due to invalid IL or missing references)
Quaternion rotation = tr_self.rotation;
Vector3 val = lookPos - tr_self.position;
Vector3 val2 = tr_self.rotation * directionAxis;
Vector3 val3 = Vector3.Cross(val2, val);
Vector3 normalized = ((Vector3)(ref val3)).normalized;
float num = Vector3.Angle(val2, val);
tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation;
tr_self.localEulerAngles = new Vector3(tr_self.localEulerAngles.x, tr_self.localEulerAngles.y, tr_self.localEulerAngles.z);
}
}
}