using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; 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("HowToFishMagicBullet")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HowToFishMagicBullet")] [assembly: AssemblyTitle("HowToFishMagicBullet")] [assembly: AssemblyVersion("1.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 HowToFishMagicBullet { [BepInPlugin("com.openai.howtofish.magicbullet", "How To Fish - Magic Bullet", "1.1.0")] public sealed class MagicBulletPlugin : BaseUnityPlugin { public const string PluginGuid = "com.openai.howtofish.magicbullet"; public const string PluginName = "How To Fish - Magic Bullet"; public const string PluginVersion = "1.1.0"; internal static MagicBulletPlugin Instance; internal ConfigEntry Enabled; internal ConfigEntry FovDegrees; internal ConfigEntry FovStep; internal ConfigEntry ToggleKey; internal ConfigEntry FovDecreaseKey; internal ConfigEntry FovIncreaseKey; internal ConfigEntry MaxPredictionTime; private Harmony _harmony; private void Awake() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown Instance = this; Enabled = ((BaseUnityPlugin)this).Config.Bind("MagicBullet", "Enabled", true, "Enable magic bullet."); FovDegrees = ((BaseUnityPlugin)this).Config.Bind("Targeting", "FOV", 35f, new ConfigDescription("Maximum angular distance from the crosshair, in degrees. This is the FOV radius.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 180f), Array.Empty())); FovStep = ((BaseUnityPlugin)this).Config.Bind("Targeting", "FOVStep", 5f, new ConfigDescription("Degrees changed per FOV hotkey press.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 30f), Array.Empty())); MaxPredictionTime = ((BaseUnityPlugin)this).Config.Bind("Targeting", "MaxPredictionTime", 2f, new ConfigDescription("Maximum movement/gravity prediction time in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); ToggleKey = ((BaseUnityPlugin)this).Config.Bind("Hotkeys", "Toggle", (KeyCode)289, "Toggle magic bullet."); FovDecreaseKey = ((BaseUnityPlugin)this).Config.Bind("Hotkeys", "FOVDecrease", (KeyCode)91, "Decrease FOV."); FovIncreaseKey = ((BaseUnityPlugin)this).Config.Bind("Hotkeys", "FOVIncrease", (KeyCode)93, "Increase FOV."); _harmony = new Harmony("com.openai.howtofish.magicbullet"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"How To Fish - Magic Bullet 1.1.0 loaded."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Target whitelist: Fish (incl. Bowhead Whale & Mutated Whale) + Bird + Albatross. Forced headshot active."); } private void OnDestroy() { MagicBulletRuntime.ClearTarget(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(ToggleKey.Value)) { Enabled.Value = !Enabled.Value; ((BaseUnityPlugin)this).Config.Save(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Magic Bullet: " + (Enabled.Value ? "ON" : "OFF"))); } if (Input.GetKeyDown(FovDecreaseKey.Value)) { FovDegrees.Value = Mathf.Clamp(FovDegrees.Value - FovStep.Value, 1f, 180f); ((BaseUnityPlugin)this).Config.Save(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Magic Bullet FOV: {FovDegrees.Value:0.#}°"); } if (Input.GetKeyDown(FovIncreaseKey.Value)) { FovDegrees.Value = Mathf.Clamp(FovDegrees.Value + FovStep.Value, 1f, 180f); ((BaseUnityPlugin)this).Config.Save(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Magic Bullet FOV: {FovDegrees.Value:0.#}°"); } MagicBulletRuntime.UpdateLiveTargeting(); } private void OnGUI() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type != 7 || (Object)(object)Instance == (Object)null || !Enabled.Value || !Object.op_Implicit((Object)(object)Player.LocalPlayer)) { return; } Camera aimCamera = MagicBulletRuntime.GetAimCamera(); if (!Object.op_Implicit((Object)(object)aimCamera)) { return; } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); float num = Mathf.Clamp(FovDegrees.Value, 1f, 89f); float num2 = aimCamera.fieldOfView * 0.5f; float radius = Mathf.Tan(num * (MathF.PI / 180f)) / Mathf.Tan(num2 * (MathF.PI / 180f)) * ((float)Screen.height * 0.5f); DrawingUtils.DrawCircle(val, radius, Color.white, 2f); Creature currentTarget = MagicBulletRuntime.CurrentTarget; if (MagicBulletRuntime.IsAllowedTarget(currentTarget)) { Vector3 val2 = MagicBulletRuntime.ResolveAimPoint(currentTarget); Vector3 val3 = aimCamera.WorldToScreenPoint(val2); if (val3.z > 0f) { Vector2 pointB = default(Vector2); ((Vector2)(ref pointB))..ctor(val3.x, (float)Screen.height - val3.y); DrawingUtils.DrawLine(val, pointB, Color.white, 2f); } } } } internal static class DrawingUtils { private static Texture2D _whiteTexture; private static Texture2D WhiteTexture { get { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_whiteTexture == (Object)null) { _whiteTexture = new Texture2D(1, 1, (TextureFormat)4, false); _whiteTexture.SetPixel(0, 0, Color.white); _whiteTexture.Apply(); } return _whiteTexture; } } public static void DrawLine(Vector2 pointA, Vector2 pointB, Color color, float width) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0073: Unknown result type (might be due to invalid IL or missing references) Vector2 val = pointB - pointA; float magnitude = ((Vector2)(ref val)).magnitude; if (!(magnitude < 0.001f)) { float num = Mathf.Atan2(val.y, val.x) * 57.29578f; Color color2 = GUI.color; Matrix4x4 matrix = GUI.matrix; GUI.color = color; GUIUtility.RotateAroundPivot(num, pointA); GUI.DrawTexture(new Rect(pointA.x, pointA.y - width * 0.5f, magnitude, width), (Texture)(object)WhiteTexture); GUI.matrix = matrix; GUI.color = color2; } } public static void DrawCircle(Vector2 center, float radius, Color color, float width, int segments = 128) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //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_0029: 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_004a: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (!(radius <= 0.001f) && segments >= 3) { float num = 360f / (float)segments; Vector2 pointA = center + new Vector2(radius, 0f); for (int i = 1; i <= segments; i++) { float num2 = (float)i * num * (MathF.PI / 180f); Vector2 val = center + new Vector2(Mathf.Cos(num2) * radius, Mathf.Sin(num2) * radius); DrawLine(pointA, val, color, width); pointA = val; } } } } internal static class MagicBulletRuntime { internal static Creature CurrentTarget { get; private set; } private static MagicBulletPlugin Plugin => MagicBulletPlugin.Instance; internal static bool CanUse(Player owner, bool isLocal) { if ((Object)(object)Plugin != (Object)null && Plugin.Enabled.Value && isLocal && Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)Player.LocalPlayer)) { return (Object)(object)owner == (Object)(object)Player.LocalPlayer; } return false; } internal static void ClearTarget() { CurrentTarget = null; } internal static void UpdateLiveTargeting() { if ((Object)(object)Plugin == (Object)null || !Plugin.Enabled.Value || !Object.op_Implicit((Object)(object)Player.LocalPlayer)) { CurrentTarget = null; return; } Camera aimCamera = GetAimCamera(); if (!Object.op_Implicit((Object)(object)aimCamera)) { CurrentTarget = null; return; } if ((Object)(object)CurrentTarget != (Object)null && !IsAllowedTarget(CurrentTarget)) { CurrentTarget = null; } CurrentTarget = FindBestTarget(aimCamera); } internal static void BeginShot() { if ((Object)(object)Plugin == (Object)null || !Plugin.Enabled.Value || !Object.op_Implicit((Object)(object)Player.LocalPlayer)) { CurrentTarget = null; return; } Camera aimCamera = GetAimCamera(); if (!Object.op_Implicit((Object)(object)aimCamera)) { CurrentTarget = null; } else { CurrentTarget = FindBestTarget(aimCamera); } } internal static void EndShot() { } internal static Camera GetAimCamera() { Player localPlayer = Player.LocalPlayer; if (Object.op_Implicit((Object)(object)localPlayer) && Object.op_Implicit((Object)(object)localPlayer.CurCam)) { return localPlayer.CurCam; } return Camera.main; } internal static Vector3 ResolveAimPoint(Creature target) { //IL_000e: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0037: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)target)) { return Vector3.zero; } Vector3 val = Vector3.zero; if (Object.op_Implicit((Object)(object)((Item)target).Rig)) { val = ((Component)target).transform.InverseTransformPoint(((Item)target).Rig.worldCenterOfMass); } Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, val.y, target.HeadPos + 0.15f); return ((Component)target).transform.TransformPoint(val2); } internal static Creature FindBestTarget(Camera cam) { //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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) Creature[] array = Object.FindObjectsOfType(); Creature result = null; float num = float.MaxValue; float num2 = float.MaxValue; Vector3 position = ((Component)cam).transform.position; Vector3 forward = ((Component)cam).transform.forward; float value = Plugin.FovDegrees.Value; Creature[] array2 = array; foreach (Creature val in array2) { if (!IsAllowedTarget(val)) { continue; } Vector3 val2 = ResolveAimPoint(val) - position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (!(sqrMagnitude <= 0.0001f)) { float num3 = Vector3.Angle(forward, val2); if (!(num3 > value) && (num3 < num - 0.01f || (Mathf.Abs(num3 - num) <= 0.01f && sqrMagnitude < num2))) { result = val; num = num3; num2 = sqrMagnitude; } } } return result; } internal static bool IsAllowedTarget(Creature candidate) { if (!Object.op_Implicit((Object)(object)candidate) || !((Behaviour)candidate).isActiveAndEnabled || candidate.IsDead) { return false; } if (!(candidate is Fish) && !(candidate is Bird)) { return candidate is Albatross; } return true; } internal static Vector3 RedirectVelocity(Vector3 projectileOrigin, Vector3 originalVelocity, WeaponInfo weaponInfo) { //IL_000e: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) Creature currentTarget = CurrentTarget; if (!IsAllowedTarget(currentTarget)) { return originalVelocity; } float magnitude = ((Vector3)(ref originalVelocity)).magnitude; if (magnitude <= 0.001f) { return originalVelocity; } Vector3 val = PredictAimPoint(projectileOrigin, currentTarget, magnitude, (weaponInfo != null) ? weaponInfo.ProjectileGravity : 0f) - projectileOrigin; if (((Vector3)(ref val)).sqrMagnitude <= 0.0001f) { return originalVelocity; } return ((Vector3)(ref val)).normalized * magnitude; } private static Vector3 GetTargetVelocity(Creature target, Vector3 aimPoint) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) Rigidbody rig = ((Item)target).Rig; if (!Object.op_Implicit((Object)(object)rig)) { return Vector3.zero; } return rig.GetPointVelocity(aimPoint); } private static Vector3 PredictAimPoint(Vector3 origin, Creature target, float projectileSpeed, float gravityForce) { //IL_0001: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ResolveAimPoint(target); Vector3 targetVelocity = GetTargetVelocity(target, val); Vector3 relativePosition = val - origin; float num = SolveInterceptTime(relativePosition, targetVelocity, projectileSpeed); if (float.IsNaN(num) || float.IsInfinity(num) || num < 0f) { num = ((Vector3)(ref relativePosition)).magnitude / projectileSpeed; } num = Mathf.Clamp(num, 0f, Plugin.MaxPredictionTime.Value); Vector3 val2 = val + targetVelocity * num; if (gravityForce > 0f) { val2 += Vector3.up * (0.5f * gravityForce * num * num); } return val2; } private static float SolveInterceptTime(Vector3 relativePosition, Vector3 targetVelocity, float projectileSpeed) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) float num = Vector3.Dot(targetVelocity, targetVelocity) - projectileSpeed * projectileSpeed; float num2 = 2f * Vector3.Dot(relativePosition, targetVelocity); float num3 = Vector3.Dot(relativePosition, relativePosition); if (Mathf.Abs(num) < 0.0001f) { if (Mathf.Abs(num2) < 0.0001f) { if (!(num3 <= 0.0001f)) { return Mathf.Sqrt(num3) / projectileSpeed; } return 0f; } float num4 = (0f - num3) / num2; if (!(num4 > 0f)) { return Mathf.Sqrt(num3) / projectileSpeed; } return num4; } float num5 = num2 * num2 - 4f * num * num3; if (num5 < 0f) { return Mathf.Sqrt(num3) / projectileSpeed; } float num6 = Mathf.Sqrt(num5); float num7 = (0f - num2 - num6) / (2f * num); float num8 = (0f - num2 + num6) / (2f * num); bool flag = num7 > 0.0001f; bool flag2 = num8 > 0.0001f; if (flag && flag2) { return Mathf.Min(num7, num8); } if (flag) { return num7; } if (flag2) { return num8; } return Mathf.Sqrt(num3) / projectileSpeed; } } [HarmonyPatch(typeof(Weapon), "Shoot")] internal static class WeaponShootPatch { private static void Prefix() { MagicBulletRuntime.BeginShot(); } private static void Postfix() { MagicBulletRuntime.EndShot(); } } [HarmonyPatch(typeof(ProjectileManager), "AddProjectile")] internal static class AddProjectilePatch { private static void Prefix(Player owner, WeaponInfo weaponInfo, bool isLocal, Vector3 pos, ref Vector3 velocity) { //IL_000c: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (MagicBulletRuntime.CanUse(owner, isLocal)) { velocity = MagicBulletRuntime.RedirectVelocity(pos, velocity, weaponInfo); } } } [HarmonyPatch(typeof(ProjectileManager), "AddProjectiles")] internal static class AddProjectilesPatch { private static void Prefix(Player owner, WeaponInfo weaponInfo, bool isLocal, Vector3 pos, Vector3[] velocities) { //IL_001a: 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_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) if (MagicBulletRuntime.CanUse(owner, isLocal) && velocities != null && velocities.Length != 0) { for (int i = 0; i < velocities.Length; i++) { velocities[i] = MagicBulletRuntime.RedirectVelocity(pos, velocities[i], weaponInfo); } } } } [HarmonyPatch(typeof(Creature), "LocalHit")] internal static class CreatureLocalHitPatch { private static void Prefix(Creature __instance, ref Vector3 point, Player player, ref int damage, bool rangedHit) { //IL_0055: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0098: 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) if (Object.op_Implicit((Object)(object)MagicBulletPlugin.Instance) && MagicBulletPlugin.Instance.Enabled.Value && Object.op_Implicit((Object)(object)player) && Object.op_Implicit((Object)(object)Player.LocalPlayer) && !((Object)(object)player != (Object)(object)Player.LocalPlayer) && rangedHit && MagicBulletRuntime.IsAllowedTarget(__instance) && ((Component)__instance).transform.InverseTransformPoint(point).z <= __instance.HeadPos) { Vector3 val = ((Component)__instance).transform.InverseTransformPoint(point); val.z = __instance.HeadPos + 0.15f; point = ((Component)__instance).transform.TransformPoint(val); } } } }