using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PrecisionPicker")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+33557731b93f9438723064c3f950e7d4db118996")] [assembly: AssemblyProduct("PrecisionPicker")] [assembly: AssemblyTitle("PrecisionPicker")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 PrecisionPicker { [BepInPlugin("com.nicholasjohnson.PrecisionPicker", "Precision Picker", "1.0.2")] public class PrecisionPickerPlugin : BaseUnityPlugin { private delegate GameObject orig_FindBestInteractableObject(Interactor self, Ray raycastRay, float maxRaycastDistance, Vector3 overlapPosition, float overlapRadius); public const string PluginGUID = "com.nicholasjohnson.PrecisionPicker"; public const string PluginName = "Precision Picker"; public const string PluginVersion = "1.0.2"; private Hook findBestInteractableHook; private static readonly RaycastHit[] _hitArray = (RaycastHit[])(object)new RaycastHit[16]; public void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Precision Picker is loading..."); MethodInfo method = typeof(Interactor).GetMethod("FindBestInteractableObject", BindingFlags.Instance | BindingFlags.Public); if (method != null) { findBestInteractableHook = new Hook((MethodBase)method, typeof(PrecisionPickerPlugin).GetMethod("FindBestInteractableObjectHook", BindingFlags.Static | BindingFlags.NonPublic)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully hooked Interactor.FindBestInteractableObject!"); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to find Interactor.FindBestInteractableObject method!"); } } public void OnDestroy() { if (findBestInteractableHook != null) { findBestInteractableHook.Dispose(); findBestInteractableHook = null; } } private static GameObject FindBestInteractableObjectHook(orig_FindBestInteractableObject orig, Interactor self, Ray raycastRay, float maxRaycastDistance, Vector3 overlapPosition, float overlapRadius) { //IL_0000: 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_0006: 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_0034: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) LayerMask interactable = CommonMasks.interactable; int num = Physics.RaycastNonAlloc(raycastRay, _hitArray, maxRaycastDistance, LayerMask.op_Implicit(interactable), (QueryTriggerInteraction)2); GameObject val = null; EntityLocator val2 = null; float num2 = float.MaxValue; EntityLocator val4 = default(EntityLocator); for (int i = 0; i < num; i++) { RaycastHit val3 = _hitArray[i]; if (!EntityLocator.HasEntityLocator(((Component)((RaycastHit)(ref val3)).collider).gameObject, ref val4)) { continue; } GameObject entity = val4.entity; if (!((Object)(object)entity != (Object)null) || (!((Object)(object)entity.GetComponent() != (Object)null) && !((Object)(object)entity.GetComponent() != (Object)null))) { continue; } IInteractable component = entity.GetComponent(); if (component != null && ((Behaviour)(MonoBehaviour)component).isActiveAndEnabled && (int)component.GetInteractability(self) != 0) { Vector3 val5 = ((Ray)(ref raycastRay)).origin - ((RaycastHit)(ref val3)).point; float sqrMagnitude = ((Vector3)(ref val5)).sqrMagnitude; if (sqrMagnitude < num2) { num2 = sqrMagnitude; val = entity; val2 = val4; } } } if ((Object)(object)val != (Object)null) { ISupportsMultipleInspectZones val6 = default(ISupportsMultipleInspectZones); if (val.TryGetComponent(ref val6) && (Object)(object)val2 != (Object)null) { val6.SetInspectInfoProvider(val2.EntityZoneIndex); } return val; } return orig(self, raycastRay, maxRaycastDistance, overlapPosition, overlapRadius); } } }