Decompiled source of ClimbingHand v1.1.0
ClimbingHand.dll
Decompiled a year agousing 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 NGA { public class climbing_hands : FVRMeleeWeapon { public FVRViveHand MarriedHand; public bool EndedMarriedHandInteraction = false; public bool IsTriggerAxeStyle; public bool CanEnvHit = true; public Transform InitiatingForward; public List<Collider> InitiatingColliders; private bool m_isEnvLocked; public float DisLodgeThreshold = 1f; private float connectCoolDown = 0.2f; private Vector3 m_storedPos; private Quaternion m_storedRot; private Vector3 m_lastHandPos = Vector3.zero; public override bool DoesFunctionAsGrabPoint() { return m_isEnvLocked; } public override Vector3 GetLastGrabHandPos() { //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_000d: Unknown result type (might be due to invalid IL or missing references) return m_lastHandPos; } public override void SetLastGrabHandPos(Vector3 v) { //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) m_lastHandPos = v; } public override Vector3 GetPosTarget() { //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_0030: 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) if (CanEnvHit && m_isEnvLocked) { return m_storedPos; } return ((FVRPhysicalObject)this).GetPosTarget(); } public override Quaternion GetRotTarget() { //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_0030: 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) if (CanEnvHit && m_isEnvLocked) { return m_storedRot; } return ((FVRPhysicalObject)this).GetRotTarget(); } public override bool IsDistantGrabbable() { return !m_isEnvLocked && ((FVRPhysicalObject)this).IsDistantGrabbable(); } public void OnCollisionStay(Collision col) { if (IsTriggerAxeStyle) { if ((Object)(object)MarriedHand != (Object)null && EndedMarriedHandInteraction && MarriedHand.Input.TriggerPressed && CanEnvHit && connectCoolDown <= 0f && (Object)(object)col.rigidbody == (Object)null && ((Component)col.transform).gameObject.layer == LayerMask.NameToLayer("Environment") && InitiatingColliders.Contains(((ContactPoint)(ref col.contacts[0])).thisCollider)) { InitiateLock(); } if (((FVRInteractiveObject)this).IsHeld && ((FVRInteractiveObject)this).m_hand.Input.TriggerPressed && CanEnvHit && connectCoolDown <= 0f && (Object)(object)col.rigidbody == (Object)null && ((Component)col.transform).gameObject.layer == LayerMask.NameToLayer("Environment") && InitiatingColliders.Contains(((ContactPoint)(ref col.contacts[0])).thisCollider)) { InitiateLock(); } } } private void OnTriggerStay(Collider other) { if (IsTriggerAxeStyle) { if ((Object)(object)MarriedHand != (Object)null && EndedMarriedHandInteraction && MarriedHand.Input.TriggerPressed && CanEnvHit && connectCoolDown <= 0f && (Object)(object)other.attachedRigidbody == (Object)null && ((Component)other).gameObject.layer == LayerMask.NameToLayer("Environment")) { InitiateLock(); } if (((FVRInteractiveObject)this).IsHeld && ((FVRInteractiveObject)this).m_hand.Input.TriggerPressed && CanEnvHit && connectCoolDown <= 0f && (Object)(object)other.attachedRigidbody == (Object)null && ((Component)other).gameObject.layer == LayerMask.NameToLayer("Environment")) { InitiateLock(); } } } public override void OnCollisionEnter(Collision col) { ((FVRPhysicalObject)this).OnCollisionEnter(col); if (IsTriggerAxeStyle) { if ((Object)(object)MarriedHand != (Object)null && EndedMarriedHandInteraction && MarriedHand.Input.TriggerPressed && CanEnvHit && connectCoolDown <= 0f && (Object)(object)col.rigidbody == (Object)null && ((Component)col.transform).gameObject.layer == LayerMask.NameToLayer("Environment") && InitiatingColliders.Contains(((ContactPoint)(ref col.contacts[0])).thisCollider)) { InitiateLock(); } if (((FVRInteractiveObject)this).IsHeld && ((FVRInteractiveObject)this).m_hand.Input.TriggerPressed && CanEnvHit && connectCoolDown <= 0f && (Object)(object)col.rigidbody == (Object)null && ((Component)col.transform).gameObject.layer == LayerMask.NameToLayer("Environment") && InitiatingColliders.Contains(((ContactPoint)(ref col.contacts[0])).thisCollider)) { InitiateLock(); } } } private void OnTriggerEnter(Collider other) { if (IsTriggerAxeStyle) { if ((Object)(object)MarriedHand != (Object)null && EndedMarriedHandInteraction && MarriedHand.Input.TriggerPressed && CanEnvHit && connectCoolDown <= 0f && (Object)(object)other.attachedRigidbody == (Object)null && ((Component)other).gameObject.layer == LayerMask.NameToLayer("Environment")) { InitiateLock(); } if (((FVRInteractiveObject)this).IsHeld && ((FVRInteractiveObject)this).m_hand.Input.TriggerPressed && CanEnvHit && connectCoolDown <= 0f && (Object)(object)other.attachedRigidbody == (Object)null && ((Component)other).gameObject.layer == LayerMask.NameToLayer("Environment")) { InitiateLock(); } } } private void InitiateLock() { //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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00d7: 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_007e: Unknown result type (might be due to invalid IL or missing references) if (!m_isEnvLocked) { if (((FVRInteractiveObject)this).IsHeld) { m_lastHandPos = ((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Pos; GM.CurrentMovementManager.CleanupFlagsForModeSwitch(); ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; } else if ((Object)(object)MarriedHand != (Object)null && EndedMarriedHandInteraction) { m_lastHandPos = ((HandInput)(ref MarriedHand.Input)).Pos; GM.CurrentMovementManager.CleanupFlagsForModeSwitch(); ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; } else { ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; } ((FVRPhysicalObject)this).ClearQuickbeltState(); m_isEnvLocked = true; m_storedPos = ((FVRInteractiveObject)this).PoseOverride.position; m_storedRot = ((FVRInteractiveObject)this).PoseOverride.rotation; } } private void DisableLock() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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) if (m_isEnvLocked) { if (((FVRInteractiveObject)this).IsHeld) { GM.CurrentMovementManager.CleanupFlagsForModeSwitch(); } else if ((Object)(object)MarriedHand != (Object)null && EndedMarriedHandInteraction) { GM.CurrentMovementManager.CleanupFlagsForModeSwitch(); } m_isEnvLocked = false; ((FVRPhysicalObject)this).RootRigidbody.isKinematic = false; if (((FVRInteractiveObject)this).IsHeld && IsTriggerAxeStyle) { GM.CurrentMovementManager.EndGrabPointMove(((FVRInteractiveObject)this).m_hand, default(Vector3)); } else if ((Object)(object)MarriedHand != (Object)null && EndedMarriedHandInteraction && IsTriggerAxeStyle) { GM.CurrentMovementManager.EndGrabPointMove(MarriedHand, default(Vector3)); } } } public override void BeginInteraction(FVRViveHand hand) { //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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) MarriedHand = hand; EndedMarriedHandInteraction = false; m_lastHandPos = ((HandInput)(ref hand.Input)).Pos; if (m_isEnvLocked) { m_lastHandPos = ((HandInput)(ref hand.Input)).Pos; GM.CurrentMovementManager.CleanupFlagsForModeSwitch(); } ((FVRPhysicalObject)this).BeginInteraction(hand); if (m_isEnvLocked) { ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; } } public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); if (IsTriggerAxeStyle && !hand.Input.TriggerPressed && m_isEnvLocked) { DisableLock(); } } public override void EndInteraction(FVRViveHand hand) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).EndInteraction(hand); EndedMarriedHandInteraction = true; if (IsTriggerAxeStyle) { DisableLock(); } if (m_isEnvLocked) { GM.CurrentMovementManager.EndGrabPointMove(hand, default(Vector3)); ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; } } public override void FVRUpdate() { //IL_004c: 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_007d: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) float num = Time.deltaTime * 2f; ((FVRPhysicalObject)this).FVRUpdate(); connectCoolDown = -1f; if (EndedMarriedHandInteraction && (Object)(object)MarriedHand != (Object)null) { ((Component)this).transform.position = ((Component)MarriedHand).transform.position; ((Component)this).transform.rotation = ((Component)MarriedHand).transform.rotation; ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, ((Component)MarriedHand).transform.position, num); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, ((Component)MarriedHand).transform.rotation, num); } if (m_isEnvLocked && IsTriggerAxeStyle && !MarriedHand.Input.TriggerPressed) { DisableLock(); } } } } namespace NGA.ClimbingHand { [BepInPlugin("NGA.ClimbingHand", "ClimbingHand", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class ClimbingHandPlugin : 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(), "NGA.ClimbingHand"); OtherLoader.RegisterDirectLoad(BasePath, "NGA.ClimbingHand", "", "", "climbinghand", ""); } } }
NGA.TestProj.dll
Decompiled a year agousing System; using System.Diagnostics; 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 Microsoft.CodeAnalysis; using Sodalite; using Sodalite.Api; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyCompany("NGA")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Persistent player progression! Raid, stash loot, and deploy with seemless scene/loadout saving.")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("NGA.TestProj")] [assembly: AssemblyTitle("BepInEx Plugin Title")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string id = null, string name = null, string version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null) { } } } namespace NGA { [BepInPlugin("NGA.PatchHands", "PatchHands", "0.1.0")] [BepInDependency("nrgill28.Sodalite", "1.4.1")] [BepInProcess("h3vr.exe")] public class TestProj : BaseUnityPlugin { public struct MyWristButton { public Action<object> onclick; public string name; public int priority; public MyWristButton(string name_, int priority_, Action<object> clickAction = null) { onclick = clickAction; name = name_; priority = priority_; } } [HarmonyPatch(typeof(FVRWristMenu2))] [HarmonyPatch("Awake")] private class WristMenuAwakeHook { private static void Postfix(FVRWristMenu2 __instance) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown if ((Object)(object)__instance == (Object)null) { Logger.LogMessage((object)"FVRWristMenu2 is null!?"); } bool flag = false; string text = "Toggle Climbing Hands"; foreach (WristMenuButton button in WristMenuAPI.Buttons) { Logger.LogMessage((object)("CC " + button.Text)); if (button.Text == text) { flag = true; break; } } if (!flag) { WristMenuAPI.Buttons.Add(new WristMenuButton(text, int.MaxValue, new ButtonClickEvent(SpawnBadBoys))); } } private static void SpawnBadBoys(object sender, ButtonClickEventArgs args) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_00fd: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) string classNameToFind = "climbing_hands"; Type type2 = AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly assembly) => assembly.GetTypes()).FirstOrDefault((Type type) => type.Name == classNameToFind); Object[] array = Object.FindObjectsOfType(type2); if (array.Length != 0) { Object[] array2 = array; foreach (Object val in array2) { Object.Destroy(val); } } else { GameObject gameObject = ((Component)Object.FindObjectOfType<FVRPlayerBody>()).gameObject; FVRViveHand component = ((Component)gameObject.transform.Find("Controller (left)")).GetComponent<FVRViveHand>(); FVRViveHand component2 = ((Component)gameObject.transform.Find("Controller (right)")).GetComponent<FVRViveHand>(); ItemSpawnerID spawnerID = IM.GetSpawnerID("Dev_ClimbingHand"); ItemSpawnerV2 val2 = new ItemSpawnerV2(); AnvilManager.Run(val2.SpawnItemsToRayPoint(spawnerID, ((Component)component).transform.position - Vector3.up * 0.2f)); AnvilManager.Run(val2.SpawnItemsToRayPoint(spawnerID, ((Component)component2).transform.position - Vector3.up * 0.2f)); Object.Destroy((Object)(object)val2); } } } internal static ManualLogSource Logger { get; private set; } private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("NGA.PatchHands"); SetUpConfigFields(); val.PatchAll(); Logger.LogMessage((object)"Hello, world! Sent from NGA.PatchHands 0.0.1"); } private void SetUpConfigFields() { } } }