using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] [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 HowToFishCursorAim { [BepInPlugin("welffi.howtofish.cursoraim", "Cursor Aim", "1.0.2")] public class Plugin : BaseUnityPlugin { public const string Guid = "welffi.howtofish.cursoraim"; public const string Name = "Cursor Aim"; public const string Version = "1.0.2"; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) new Harmony("welffi.howtofish.cursoraim").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Cursor Aim 1.0.2 loaded - weapons now fire toward your crosshair instead of the barrel's facing."); } } [HarmonyPatch(typeof(Weapon), "Shoot")] internal static class Weapon_Shoot_CursorAim { private const float MaxAimDistance = 1000f; private static Transform _patchedFirePoint; private static Quaternion _originalRotation; private static void Prefix(Weapon __instance) { //IL_0045: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) _patchedFirePoint = null; Player holder = ((Item)__instance).Holder; Attachments attachments = __instance.Attachments; if (!Object.op_Implicit((Object)(object)holder) || (Object)(object)attachments == (Object)null) { return; } Transform firePoint = attachments.FirePoint; Transform camObject = holder.CamObject; if (Object.op_Implicit((Object)(object)firePoint) && Object.op_Implicit((Object)(object)camObject)) { int num = LayerMask.op_Implicit(GameInfo.LevelLayer) | LayerMask.op_Implicit(GameInfo.PlayerLayer) | LayerMask.op_Implicit(GameInfo.ItemLayer) | LayerMask.op_Implicit(GameInfo.NpcLayer); RaycastHit val2 = default(RaycastHit); Vector3 val = (Physics.Raycast(camObject.position, camObject.forward, ref val2, 1000f, num) ? ((RaycastHit)(ref val2)).point : (camObject.position + camObject.forward * 1000f)) - firePoint.position; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { _patchedFirePoint = firePoint; _originalRotation = firePoint.rotation; firePoint.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized, firePoint.up); } } } private static void Postfix() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_patchedFirePoint)) { _patchedFirePoint.rotation = _originalRotation; _patchedFirePoint = null; } } } }