using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using PerfectRandom.Sulfur.Core; using PerfectRandom.Sulfur.Core.Input; using PerfectRandom.Sulfur.Core.Movement; using PerfectRandom.Sulfur.Core.Stats; using PerfectRandom.Sulfur.Core.Units; using PerfectRandom.Sulfur.Core.Weapons; using Unity.Mathematics; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("apex Assist")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("apex Assist")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e948ced9-9b4f-4fd1-a781-9bcbf7a5538f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace Ryuka.Sulfur.DeadeyeInstinct; internal enum AssistMode { Magnet, Natural, HardLock } internal enum AssistPreset { Low, Medium, High, Custom } internal enum HardLockTargetPriority { Nearest, LowestHealth, WeakspotThenDistance, ThreatWeighted } [BepInPlugin("ryuka.sulfur.deadeyeinstinct", "Deadeye Instinct", "1.2.5")] public sealed class DeadeyeInstinctPlugin : BaseUnityPlugin { private const string PluginGuid = "ryuka.sulfur.deadeyeinstinct"; private const string PluginName = "Deadeye Instinct"; private const string PluginVersion = "1.2.5"; internal static ManualLogSource Log; private Harmony harmony; private GameObject weakspotDebugOverlayObject; internal static ConfigEntry EnableMod; internal static ConfigEntry DebugLogging; internal static ConfigEntry Mode; internal static ConfigEntry MagnetPreset; internal static ConfigEntry NaturalPreset; internal static ConfigEntry EnableMouseConsumesRotationPullDelta; internal static ConfigEntry EnableContinuousRotationalAssist; internal static ConfigEntry RequirePlayerInput; internal static ConfigEntry CountLookInput; internal static ConfigEntry CountMoveInput; internal static ConfigEntry LookInputThreshold; internal static ConfigEntry MoveInputThreshold; internal static ConfigEntry AssistCoefficient; internal static ConfigEntry RotationDeltaPerSecond; internal static ConfigEntry MaxRotationDeltaPerFrame; internal static ConfigEntry MagnetCenterBias; internal static ConfigEntry MagnetMovementOnlyScale; internal static ConfigEntry MagnetSmoothing; internal static ConfigEntry MagnetReleaseSmoothing; internal static ConfigEntry MagnetPreferWeakspot; internal static ConfigEntry MagnetWeakspotBias; internal static ConfigEntry MagnetWeakspotOverrideOfficialPull; internal static ConfigEntry MagnetEdgeSofteningPower; internal static ConfigEntry MagnetOuterEdgeStrength; internal static ConfigEntry MagnetSnapBackAnglePadding; internal static ConfigEntry MagnetAllowLookAwayEscape; internal static ConfigEntry MagnetLookAwayThreshold; internal static ConfigEntry MagnetLookAwayMinScale; internal static ConfigEntry MagnetLookAwayCurvePower; internal static ConfigEntry MagnetLookAwayMovementScale; internal static ConfigEntry TargetSwitchFadeSeconds; internal static ConfigEntry TargetSwitchMinScale; internal static ConfigEntry OuterBubbleAngleDegrees; internal static ConfigEntry InnerBubbleAngleDegrees; internal static ConfigEntry BubbleCurvePower; internal static ConfigEntry DistanceFalloffPower; internal static ConfigEntry NaturalTowardAssist; internal static ConfigEntry NaturalSideAssist; internal static ConfigEntry NaturalAwayDamping; internal static ConfigEntry NaturalMovementOnlyScale; internal static ConfigEntry NaturalMaxInputFraction; internal static ConfigEntry NaturalMinDeltaPerFrame; internal static ConfigEntry NaturalSmoothing; internal static ConfigEntry NaturalReleaseSmoothing; internal static ConfigEntry NaturalDirectionSmoothing; internal static ConfigEntry NaturalMinLookInput; internal static ConfigEntry NaturalKeepOfficialGamepadPull; internal static ConfigEntry NaturalReleaseCurvePower; internal static ConfigEntry NaturalOuterEdgeStrength; internal static ConfigEntry OverrideOfficialScanner; internal static ConfigEntry OfficialMaxAssistDistance; internal static ConfigEntry OfficialScanConeDegrees; internal static ConfigEntry OfficialScoreThreshold; internal static ConfigEntry OfficialDistanceVsDotBlend; internal static ConfigEntry OfficialScanIntervalFrames; internal static ConfigEntry ScannerKeepAliveStrength; internal static ConfigEntry InvertX; internal static ConfigEntry InvertY; internal static ConfigEntry EnableWeakspotDebugOverlay; internal static ConfigEntry WeakspotDebugOnlyTrackedTarget; internal static ConfigEntry WeakspotDebugShowAllPositiveShapes; internal static ConfigEntry WeakspotDebugMinimumMultiplier; internal static ConfigEntry WeakspotDebugLineWidth; internal static ConfigEntry WeakspotDebugDepthOffset; internal static ConfigEntry EnableAimbot; internal static ConfigEntry HoldDisableKey; internal static ConfigEntry HardLockMaxDistance; internal static ConfigEntry HardLockMaxDistanceCap; internal static ConfigEntry HardLockPreferWeakspot; internal static ConfigEntry HardLockWeakspotBias; internal static ConfigEntry HardLockRotationSpeed; internal static ConfigEntry HardLockRotationGain; internal static ConfigEntry HardLockMaxDeltaPerFrame; internal static ConfigEntry HardLockRecoilCompensation; internal static ConfigEntry HardLockRequireLineOfSight; internal static ConfigEntry HardLockRequireVisibleTarget; internal static ConfigEntry HardLockTargetPriorityMode; internal static ConfigEntry HardLockDistanceWeight; internal static ConfigEntry HardLockLowHealthWeight; internal static ConfigEntry HardLockWeakspotWeight; internal static ConfigEntry HardLockStickyTargetBonus; internal static ConfigEntry EnableAutoFire; internal static ConfigEntry AutoFireOnlyInHardLock; internal static ConfigEntry AutoFireRequireAligned; internal static ConfigEntry AutoFireMaxAngleDegrees; internal static ConfigEntry AutoFireRequireWeaponReady; internal static ConfigEntry AutoFireRespectSemiAuto; internal static ConfigEntry AutoFirePulseSeconds; internal static ConfigEntry AutoFireReleaseSeconds; private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_005f: 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_0081: Expected O, but got Unknown //IL_0081: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0107: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; BindConfig(); harmony = new Harmony("ryuka.sulfur.deadeyeinstinct"); MethodInfo methodInfo = AccessTools.Method(typeof(AimAssist), "LateUpdate", (Type[])null, (Type[])null); if (methodInfo != null) { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(AimAssistLateUpdatePatch), "Prefix", (Type[])null), new HarmonyMethod(typeof(AimAssistLateUpdatePatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched AimAssist.LateUpdate()."); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not find AimAssist.LateUpdate()."); } MethodInfo methodInfo2 = AccessTools.Method(typeof(InputReader), "Update", (Type[])null, (Type[])null); if (methodInfo2 != null) { harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(InputReaderUpdatePatch), "Prefix", (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(InputReaderUpdatePatch), "Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched InputReader.Update()."); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not find InputReader.Update()."); } MethodInfo methodInfo3 = AccessTools.Method(typeof(Weapon), "LateUpdate", (Type[])null, (Type[])null); if (methodInfo3 != null) { harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(typeof(WeaponLateUpdatePatch), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Weapon.LateUpdate()."); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find Weapon.LateUpdate(). AutoFire will be unavailable."); } MethodInfo methodInfo4 = AccessTools.Method(typeof(CameraRecoil), "LateUpdate", (Type[])null, (Type[])null); if (methodInfo4 != null) { harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(typeof(CameraRecoilLateUpdatePatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched CameraRecoil.LateUpdate()."); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find CameraRecoil.LateUpdate(). HardLock recoil compensation will be unavailable."); } CreateWeakspotDebugOverlay(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Deadeye Instinct 1.2.5 loaded."); } internal static AssistMode ActiveMode() { return (Mode != null) ? Mode.Value : AssistMode.Magnet; } internal static AssistPreset ActivePreset() { if (ActiveMode() == AssistMode.Natural) { return (NaturalPreset == null) ? AssistPreset.Medium : NaturalPreset.Value; } return (MagnetPreset != null) ? MagnetPreset.Value : AssistPreset.High; } internal static bool UsingCustomPreset() { return ActivePreset() == AssistPreset.Custom; } internal static float EffectiveAssistCoefficient() { if (UsingCustomPreset()) { return SafeFloat(AssistCoefficient, 1.4f); } if (ActiveMode() == AssistMode.Natural) { return ActivePreset() switch { AssistPreset.Low => 0.8f, AssistPreset.High => 2f, _ => 1.4f, }; } return ActivePreset() switch { AssistPreset.Low => 0.65f, AssistPreset.Medium => 0.95f, _ => 1.4f, }; } internal static float EffectiveRotationDeltaPerSecond() { if (UsingCustomPreset()) { return SafeFloat(RotationDeltaPerSecond, 10f); } if (ActiveMode() == AssistMode.Natural) { return ActivePreset() switch { AssistPreset.Low => 6f, AssistPreset.High => 14f, _ => 10f, }; } return ActivePreset() switch { AssistPreset.Low => 4.5f, AssistPreset.Medium => 7f, _ => 10f, }; } internal static float EffectiveMaxRotationDeltaPerFrame() { if (UsingCustomPreset()) { return SafeFloat(MaxRotationDeltaPerFrame, 0.9f); } if (ActiveMode() == AssistMode.Natural) { return ActivePreset() switch { AssistPreset.Low => 0.45f, AssistPreset.High => 1.4f, _ => 0.9f, }; } return ActivePreset() switch { AssistPreset.Low => 0.35f, AssistPreset.Medium => 0.55f, _ => 0.9f, }; } internal static float EffectiveOuterBubbleAngleDegrees() { if (UsingCustomPreset()) { return SafeFloat(OuterBubbleAngleDegrees, 34f); } if (ActiveMode() == AssistMode.Natural) { return ActivePreset() switch { AssistPreset.Low => 26f, AssistPreset.High => 42f, _ => 34f, }; } return ActivePreset() switch { AssistPreset.Low => 24f, AssistPreset.Medium => 28f, _ => 34f, }; } internal static float EffectiveInnerBubbleAngleDegrees() { if (UsingCustomPreset()) { return SafeFloat(InnerBubbleAngleDegrees, 8f); } if (ActiveMode() == AssistMode.Natural) { return ActivePreset() switch { AssistPreset.Low => 6f, AssistPreset.High => 10f, _ => 8f, }; } return ActivePreset() switch { AssistPreset.Low => 5f, AssistPreset.Medium => 6f, _ => 8f, }; } internal static float EffectiveBubbleCurvePower() { if (UsingCustomPreset()) { return SafeFloat(BubbleCurvePower, 0.65f); } if (ActiveMode() == AssistMode.Natural) { return ActivePreset() switch { AssistPreset.Low => 0.9f, AssistPreset.High => 0.5f, _ => 0.65f, }; } return ActivePreset() switch { AssistPreset.Low => 1.1f, AssistPreset.Medium => 0.9f, _ => 0.65f, }; } internal static float EffectiveDistanceFalloffPower() { if (UsingCustomPreset()) { return SafeFloat(DistanceFalloffPower, 0.35f); } if (ActiveMode() == AssistMode.Natural) { return ActivePreset() switch { AssistPreset.Low => 0.55f, AssistPreset.High => 0.2f, _ => 0.35f, }; } return ActivePreset() switch { AssistPreset.Low => 0.7f, AssistPreset.Medium => 0.55f, _ => 0.35f, }; } internal static bool EffectiveMagnetPreferWeakspot() { return !UsingCustomPreset() || SafeBool(MagnetPreferWeakspot, fallback: true); } internal static bool EffectiveMagnetWeakspotOverrideOfficialPull() { return !UsingCustomPreset() || SafeBool(MagnetWeakspotOverrideOfficialPull, fallback: true); } internal static bool EffectiveMagnetAllowLookAwayEscape() { return !UsingCustomPreset() || SafeBool(MagnetAllowLookAwayEscape, fallback: true); } internal static float EffectiveMagnetWeakspotBias() { if (UsingCustomPreset()) { return SafeFloat(MagnetWeakspotBias, 0.85f); } return ActivePreset() switch { AssistPreset.Low => 0.55f, AssistPreset.Medium => 0.7f, _ => 0.85f, }; } internal static float EffectiveMagnetCenterBias() { if (UsingCustomPreset()) { return SafeFloat(MagnetCenterBias, 0.15f); } return ActivePreset() switch { AssistPreset.Low => 0.05f, AssistPreset.Medium => 0.1f, _ => 0.15f, }; } internal static float EffectiveMagnetMovementOnlyScale() { if (UsingCustomPreset()) { return SafeFloat(MagnetMovementOnlyScale, 0.35f); } return ActivePreset() switch { AssistPreset.Low => 0.2f, AssistPreset.Medium => 0.28f, _ => 0.35f, }; } internal static float EffectiveMagnetSmoothing() { if (UsingCustomPreset()) { return SafeFloat(MagnetSmoothing, 22f); } return ActivePreset() switch { AssistPreset.Low => 16f, AssistPreset.Medium => 19f, _ => 22f, }; } internal static float EffectiveMagnetReleaseSmoothing() { if (UsingCustomPreset()) { return SafeFloat(MagnetReleaseSmoothing, 12f); } return ActivePreset() switch { AssistPreset.Low => 8f, AssistPreset.Medium => 10f, _ => 12f, }; } internal static float EffectiveMagnetEdgeSofteningPower() { if (UsingCustomPreset()) { return SafeFloat(MagnetEdgeSofteningPower, 2.2f); } return ActivePreset() switch { AssistPreset.Low => 3f, AssistPreset.Medium => 2.6f, _ => 2.2f, }; } internal static float EffectiveMagnetOuterEdgeStrength() { if (UsingCustomPreset()) { return SafeFloat(MagnetOuterEdgeStrength, 0.08f); } return ActivePreset() switch { AssistPreset.Low => 0.03f, AssistPreset.Medium => 0.05f, _ => 0.08f, }; } internal static float EffectiveMagnetSnapBackAnglePadding() { if (UsingCustomPreset()) { return SafeFloat(MagnetSnapBackAnglePadding, 4f); } return ActivePreset() switch { AssistPreset.Low => 6f, AssistPreset.Medium => 5f, _ => 4f, }; } internal static float EffectiveMagnetLookAwayThreshold() { if (UsingCustomPreset()) { return SafeFloat(MagnetLookAwayThreshold, 0.1f); } return ActivePreset() switch { AssistPreset.Low => 0.05f, AssistPreset.Medium => 0.08f, _ => 0.1f, }; } internal static float EffectiveMagnetLookAwayMinScale() { if (UsingCustomPreset()) { return SafeFloat(MagnetLookAwayMinScale, 0.08f); } return ActivePreset() switch { AssistPreset.Low => 0.02f, AssistPreset.Medium => 0.05f, _ => 0.08f, }; } internal static float EffectiveMagnetLookAwayCurvePower() { if (UsingCustomPreset()) { return SafeFloat(MagnetLookAwayCurvePower, 1.2f); } return ActivePreset() switch { AssistPreset.Low => 1f, AssistPreset.Medium => 1.1f, _ => 1.2f, }; } internal static float EffectiveMagnetLookAwayMovementScale() { if (UsingCustomPreset()) { return SafeFloat(MagnetLookAwayMovementScale, 0.45f); } return ActivePreset() switch { AssistPreset.Low => 0.35f, AssistPreset.Medium => 0.4f, _ => 0.45f, }; } internal static bool EffectiveNaturalKeepOfficialGamepadPull() { return !UsingCustomPreset() || SafeBool(NaturalKeepOfficialGamepadPull, fallback: true); } internal static float EffectiveNaturalTowardAssist() { if (UsingCustomPreset()) { return SafeFloat(NaturalTowardAssist, 0.12f); } return ActivePreset() switch { AssistPreset.Low => 0.05f, AssistPreset.High => 0.2f, _ => 0.12f, }; } internal static float EffectiveNaturalSideAssist() { if (UsingCustomPreset()) { return SafeFloat(NaturalSideAssist, 0.55f); } return ActivePreset() switch { AssistPreset.Low => 0.28f, AssistPreset.High => 0.85f, _ => 0.55f, }; } internal static float EffectiveNaturalAwayDamping() { if (UsingCustomPreset()) { return SafeFloat(NaturalAwayDamping, 1.45f); } return ActivePreset() switch { AssistPreset.Low => 0.75f, AssistPreset.High => 2.2f, _ => 1.45f, }; } internal static float EffectiveNaturalMovementOnlyScale() { return UsingCustomPreset() ? SafeFloat(NaturalMovementOnlyScale, 0f) : 0f; } internal static float EffectiveNaturalMaxInputFraction() { if (UsingCustomPreset()) { return SafeFloat(NaturalMaxInputFraction, 0.85f); } return ActivePreset() switch { AssistPreset.Low => 0.55f, AssistPreset.High => 1.2f, _ => 0.85f, }; } internal static float EffectiveNaturalMinDeltaPerFrame() { return UsingCustomPreset() ? SafeFloat(NaturalMinDeltaPerFrame, 0.003f) : 0.003f; } internal static float EffectiveNaturalSmoothing() { if (UsingCustomPreset()) { return SafeFloat(NaturalSmoothing, 30f); } return ActivePreset() switch { AssistPreset.Low => 24f, AssistPreset.High => 38f, _ => 30f, }; } internal static float EffectiveNaturalReleaseSmoothing() { if (UsingCustomPreset()) { return SafeFloat(NaturalReleaseSmoothing, 10f); } return ActivePreset() switch { AssistPreset.Low => 8f, AssistPreset.High => 14f, _ => 10f, }; } internal static float EffectiveNaturalDirectionSmoothing() { if (UsingCustomPreset()) { return SafeFloat(NaturalDirectionSmoothing, 18f); } return ActivePreset() switch { AssistPreset.Low => 14f, AssistPreset.High => 24f, _ => 18f, }; } internal static float EffectiveNaturalMinLookInput() { return UsingCustomPreset() ? SafeFloat(NaturalMinLookInput, 0.001f) : 0.001f; } internal static float EffectiveNaturalReleaseCurvePower() { if (UsingCustomPreset()) { return SafeFloat(NaturalReleaseCurvePower, 2.4f); } return ActivePreset() switch { AssistPreset.Low => 2.8f, AssistPreset.High => 2f, _ => 2.4f, }; } internal static float EffectiveNaturalOuterEdgeStrength() { if (UsingCustomPreset()) { return SafeFloat(NaturalOuterEdgeStrength, 0.02f); } return ActivePreset() switch { AssistPreset.Low => 0.01f, AssistPreset.High => 0.04f, _ => 0.02f, }; } internal static float SafeFloat(ConfigEntry entry, float fallback) { return entry?.Value ?? fallback; } internal static bool SafeBool(ConfigEntry entry, bool fallback) { return entry?.Value ?? fallback; } internal static bool IsAimbotRuntimeEnabled() { //IL_0054: 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_005a: Unknown result type (might be due to invalid IL or missing references) if (EnableMod == null || !EnableMod.Value) { return false; } if (EnableAimbot != null && !EnableAimbot.Value) { return false; } KeyCode keyCode = (KeyCode)((HoldDisableKey == null) ? 308 : ((int)HoldDisableKey.Value)); if (IsHoldDisableKeyPressed(keyCode)) { return false; } return true; } private static bool IsHoldDisableKeyPressed(KeyCode keyCode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0023: 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) if ((int)keyCode == 0) { return false; } Keyboard current = Keyboard.current; if (current == null) { return false; } if (!TryConvertUnityKeyCode(keyCode, out var key)) { return false; } try { return ((ButtonControl)current[key]).isPressed; } catch { return false; } } private static bool TryConvertUnityKeyCode(KeyCode keyCode, out Key key) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_0008: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected I4, but got Unknown //IL_004b: 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_007c: Expected I4, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Expected I4, but got Unknown if ((int)keyCode <= 27) { if ((int)keyCode <= 9) { if ((int)keyCode == 8) { key = (Key)65; return true; } if ((int)keyCode == 9) { key = (Key)3; return true; } } else { if ((int)keyCode == 13) { key = (Key)2; return true; } if ((int)keyCode == 27) { key = (Key)60; return true; } } } else if ((int)keyCode <= 57) { if ((int)keyCode == 32) { key = (Key)1; return true; } switch (keyCode - 48) { case 0: key = (Key)50; return true; case 1: key = (Key)41; return true; case 2: key = (Key)42; return true; case 3: key = (Key)43; return true; case 4: key = (Key)44; return true; case 5: key = (Key)45; return true; case 6: key = (Key)46; return true; case 7: key = (Key)47; return true; case 8: key = (Key)48; return true; case 9: key = (Key)49; return true; } } else { if ((int)keyCode == 127) { key = (Key)71; return true; } switch (keyCode - 273) { case 35: key = (Key)53; return true; case 34: key = (Key)54; return true; case 33: key = (Key)55; return true; case 32: key = (Key)56; return true; case 31: key = (Key)51; return true; case 30: key = (Key)52; return true; case 4: key = (Key)70; return true; case 5: key = (Key)68; return true; case 6: key = (Key)69; return true; case 7: key = (Key)67; return true; case 8: key = (Key)66; return true; case 0: key = (Key)63; return true; case 1: key = (Key)64; return true; case 3: key = (Key)61; return true; case 2: key = (Key)62; return true; case 9: key = (Key)94; return true; case 10: key = (Key)95; return true; case 11: key = (Key)96; return true; case 12: key = (Key)97; return true; case 13: key = (Key)98; return true; case 14: key = (Key)99; return true; case 15: key = (Key)100; return true; case 16: key = (Key)101; return true; case 17: key = (Key)102; return true; case 18: key = (Key)103; return true; case 19: key = (Key)104; return true; case 20: key = (Key)105; return true; } } int num = (int)keyCode; if (num >= 97 && num <= 122) { key = (Key)(15 + (num - 97)); return true; } key = (Key)0; return false; } internal static bool IsHardLockModeActive() { return IsAimbotRuntimeEnabled() && ActiveMode() == AssistMode.HardLock; } private void CreateWeakspotDebugOverlay() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (!((Object)(object)weakspotDebugOverlayObject != (Object)null)) { weakspotDebugOverlayObject = new GameObject("Ryuka.WeakspotDebugOverlay"); ((Object)weakspotDebugOverlayObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)weakspotDebugOverlayObject); weakspotDebugOverlayObject.AddComponent(); } } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } if ((Object)(object)weakspotDebugOverlayObject != (Object)null) { Object.Destroy((Object)(object)weakspotDebugOverlayObject); weakspotDebugOverlayObject = null; } } private void BindConfig() { //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Expected O, but got Unknown //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Expected O, but got Unknown //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Expected O, but got Unknown //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Expected O, but got Unknown //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Expected O, but got Unknown //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Expected O, but got Unknown //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Expected O, but got Unknown //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Expected O, but got Unknown //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Expected O, but got Unknown //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Expected O, but got Unknown //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Expected O, but got Unknown //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_05a9: Expected O, but got Unknown //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Expected O, but got Unknown //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Expected O, but got Unknown //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Expected O, but got Unknown //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Expected O, but got Unknown //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Expected O, but got Unknown //IL_070d: Unknown result type (might be due to invalid IL or missing references) //IL_0717: Expected O, but got Unknown //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_0754: Expected O, but got Unknown //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_0791: Expected O, but got Unknown //IL_07c4: Unknown result type (might be due to invalid IL or missing references) //IL_07ce: Expected O, but got Unknown //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Expected O, but got Unknown //IL_083e: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Expected O, but got Unknown //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_0885: Expected O, but got Unknown //IL_08b8: Unknown result type (might be due to invalid IL or missing references) //IL_08c2: Expected O, but got Unknown //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_08ff: Expected O, but got Unknown //IL_0932: Unknown result type (might be due to invalid IL or missing references) //IL_093c: Expected O, but got Unknown //IL_096f: Unknown result type (might be due to invalid IL or missing references) //IL_0979: Expected O, but got Unknown //IL_09cc: Unknown result type (might be due to invalid IL or missing references) //IL_09d6: Expected O, but got Unknown //IL_0a09: Unknown result type (might be due to invalid IL or missing references) //IL_0a13: Expected O, but got Unknown //IL_0a66: Unknown result type (might be due to invalid IL or missing references) //IL_0a70: Expected O, but got Unknown //IL_0aa3: Unknown result type (might be due to invalid IL or missing references) //IL_0aad: Expected O, but got Unknown //IL_0ae0: Unknown result type (might be due to invalid IL or missing references) //IL_0aea: Expected O, but got Unknown //IL_0b1d: Unknown result type (might be due to invalid IL or missing references) //IL_0b27: Expected O, but got Unknown //IL_0b4f: Unknown result type (might be due to invalid IL or missing references) //IL_0b59: Expected O, but got Unknown //IL_0b8c: Unknown result type (might be due to invalid IL or missing references) //IL_0b96: Expected O, but got Unknown //IL_0c69: Unknown result type (might be due to invalid IL or missing references) //IL_0c73: Expected O, but got Unknown //IL_0ca6: Unknown result type (might be due to invalid IL or missing references) //IL_0cb0: Expected O, but got Unknown //IL_0ce3: Unknown result type (might be due to invalid IL or missing references) //IL_0ced: Expected O, but got Unknown //IL_0d64: Unknown result type (might be due to invalid IL or missing references) //IL_0d6e: Expected O, but got Unknown //IL_0da1: Unknown result type (might be due to invalid IL or missing references) //IL_0dab: Expected O, but got Unknown //IL_0dfe: Unknown result type (might be due to invalid IL or missing references) //IL_0e08: Expected O, but got Unknown //IL_0e3b: Unknown result type (might be due to invalid IL or missing references) //IL_0e45: Expected O, but got Unknown //IL_0e78: Unknown result type (might be due to invalid IL or missing references) //IL_0e82: Expected O, but got Unknown //IL_0eb5: Unknown result type (might be due to invalid IL or missing references) //IL_0ebf: Expected O, but got Unknown //IL_0f72: Unknown result type (might be due to invalid IL or missing references) //IL_0f7c: Expected O, but got Unknown //IL_0faf: Unknown result type (might be due to invalid IL or missing references) //IL_0fb9: Expected O, but got Unknown //IL_0fec: Unknown result type (might be due to invalid IL or missing references) //IL_0ff6: Expected O, but got Unknown //IL_1029: Unknown result type (might be due to invalid IL or missing references) //IL_1033: Expected O, but got Unknown //IL_10c6: Unknown result type (might be due to invalid IL or missing references) //IL_10d0: Expected O, but got Unknown //IL_1143: Unknown result type (might be due to invalid IL or missing references) //IL_114d: Expected O, but got Unknown //IL_1180: Unknown result type (might be due to invalid IL or missing references) //IL_118a: Expected O, but got Unknown EnableMod = ((BaseUnityPlugin)this).Config.Bind("General", "EnableMod", true, "Enable this mod."); DebugLogging = ((BaseUnityPlugin)this).Config.Bind("General", "DebugLogging", false, "Print aim assist debug logs."); Mode = ((BaseUnityPlugin)this).Config.Bind("Assist Mode", "Mode", AssistMode.Magnet, "Magnet = magnetic pull. Natural = input-shaped sticky assist."); MagnetPreset = ((BaseUnityPlugin)this).Config.Bind("Preset", "MagnetPreset", AssistPreset.High, "Low / Medium / High / Custom for Magnet mode. Current tested Magnet settings are defined as High."); NaturalPreset = ((BaseUnityPlugin)this).Config.Bind("Preset", "NaturalPreset", AssistPreset.Medium, "Low / Medium / High / Custom for Natural mode. Current tested Natural settings are defined as Medium."); EnableMouseConsumesRotationPullDelta = ((BaseUnityPlugin)this).Config.Bind("Official Pipeline", "EnableMouseConsumesRotationPullDelta", true, "Allow mouse input to consume AimAssist.rotationPullDelta inside InputReader.Update()."); EnableContinuousRotationalAssist = ((BaseUnityPlugin)this).Config.Bind("Official Pipeline", "EnableContinuousRotationalAssist", true, "Append continuous rotational assist to official AimAssist.rotationPullDelta."); RequirePlayerInput = ((BaseUnityPlugin)this).Config.Bind("Input", "RequirePlayerInput", true, "Only assist while player has movement or look input."); CountLookInput = ((BaseUnityPlugin)this).Config.Bind("Input", "CountLookInput", true, "Look input counts as active player input."); CountMoveInput = ((BaseUnityPlugin)this).Config.Bind("Input", "CountMoveInput", true, "Movement input counts as active player input."); LookInputThreshold = ((BaseUnityPlugin)this).Config.Bind("Input", "LookInputThreshold", 0.001f, new ConfigDescription("Threshold for effective look input after sensitivity.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); MoveInputThreshold = ((BaseUnityPlugin)this).Config.Bind("Input", "MoveInputThreshold", 0.05f, new ConfigDescription("Threshold for movement input.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); AssistCoefficient = ((BaseUnityPlugin)this).Config.Bind("Custom Common", "AssistCoefficient", 1.4f, new ConfigDescription("Overall assist strength. 0.6 strong, 1.0 very strong, 2.0 extreme.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); RotationDeltaPerSecond = ((BaseUnityPlugin)this).Config.Bind("Custom Common", "RotationDeltaPerSecond", 10f, new ConfigDescription("Base rotationPullDelta per second before AssistCoefficient scaling.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); MaxRotationDeltaPerFrame = ((BaseUnityPlugin)this).Config.Bind("Custom Common", "MaxRotationDeltaPerFrame", 0.9f, new ConfigDescription("Hard cap for added rotationPullDelta per frame.", (AcceptableValueBase)(object)new AcceptableValueRange(0.001f, 10f), Array.Empty())); MagnetCenterBias = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetCenterBias", 0.15f, new ConfigDescription("For Magnet mode only when weakspot targeting is not available. 0 = official target point, 1 = collider center. Keep low to avoid center locking.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); MagnetMovementOnlyScale = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetMovementOnlyScale", 0.35f, new ConfigDescription("For Magnet mode only. Strength scale when player is moving but not moving aim.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); MagnetSmoothing = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetSmoothing", 22f, new ConfigDescription("For Magnet mode only. Active pull smoothing speed. Higher = more responsive.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 80f), Array.Empty())); MagnetReleaseSmoothing = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetReleaseSmoothing", 12f, new ConfigDescription("For Magnet mode only. Release smoothing speed. Lower = softer release.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 80f), Array.Empty())); MagnetPreferWeakspot = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetPreferWeakspot", true, "For Magnet mode only. Prefer the highest base Hitmesh.Data.GetShapeMultiplier() part when available."); MagnetWeakspotBias = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetWeakspotBias", 0.85f, new ConfigDescription("For MagnetPreferWeakspot. 0 = normal Magnet target, 1 = weakspot point.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); MagnetWeakspotOverrideOfficialPull = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetWeakspotOverrideOfficialPull", true, "When Magnet weakspot targeting succeeds, clear the official center pull before adding the weakspot pull."); MagnetEdgeSofteningPower = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetEdgeSofteningPower", 2.2f, new ConfigDescription("For Magnet mode only. Extra falloff near the outer assist bubble edge. Higher = softer near edge.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 8f), Array.Empty())); MagnetOuterEdgeStrength = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetOuterEdgeStrength", 0.08f, new ConfigDescription("For Magnet mode only. Minimum pull strength near the outer edge. Lower reduces snap-back jitter.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.5f), Array.Empty())); MagnetSnapBackAnglePadding = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetSnapBackAnglePadding", 4f, new ConfigDescription("For Magnet mode only. Softly scales down pull during the last N degrees before leaving the bubble.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 30f), Array.Empty())); MagnetAllowLookAwayEscape = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetAllowLookAwayEscape", true, "For Magnet mode only. Reduce pull when player look input is clearly moving away from the target."); MagnetLookAwayThreshold = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetLookAwayThreshold", 0.1f, new ConfigDescription("For Magnet escape. Dot threshold for detecting look-away input. 0.10 means only clear away input reduces pull.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); MagnetLookAwayMinScale = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetLookAwayMinScale", 0.08f, new ConfigDescription("For Magnet escape. Minimum pull scale when player strongly looks away. Lower makes controller escape easier.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); MagnetLookAwayCurvePower = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetLookAwayCurvePower", 1.2f, new ConfigDescription("For Magnet escape. Higher makes pull reduction happen later; lower makes it more sensitive.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 5f), Array.Empty())); MagnetLookAwayMovementScale = ((BaseUnityPlugin)this).Config.Bind("Custom Magnet", "MagnetLookAwayMovementScale", 0.45f, new ConfigDescription("For Magnet escape. Extra scale when movement input is also active. Higher preserves sticky aim while strafing.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); TargetSwitchFadeSeconds = ((BaseUnityPlugin)this).Config.Bind("Custom Target Stability", "TargetSwitchFadeSeconds", 0.12f, new ConfigDescription("Fade-in time after the official tracked target changes.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); TargetSwitchMinScale = ((BaseUnityPlugin)this).Config.Bind("Custom Target Stability", "TargetSwitchMinScale", 0.25f, new ConfigDescription("Minimum assist scale immediately after target switch. 0 = fully fade from zero, 1 = no switch fade.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); OuterBubbleAngleDegrees = ((BaseUnityPlugin)this).Config.Bind("Custom Common", "OuterBubbleAngleDegrees", 30f, new ConfigDescription("Target must be inside this angle from crosshair.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 89f), Array.Empty())); InnerBubbleAngleDegrees = ((BaseUnityPlugin)this).Config.Bind("Custom Common", "InnerBubbleAngleDegrees", 7f, new ConfigDescription("Inside this angle, assist reaches full strength.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 60f), Array.Empty())); BubbleCurvePower = ((BaseUnityPlugin)this).Config.Bind("Custom Common", "BubbleCurvePower", 0.8f, new ConfigDescription("Higher values make assist weaker near the edge.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 5f), Array.Empty())); DistanceFalloffPower = ((BaseUnityPlugin)this).Config.Bind("Custom Common", "DistanceFalloffPower", 0.5f, new ConfigDescription("Higher values make far targets weaker.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); NaturalTowardAssist = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalTowardAssist", 0.12f, new ConfigDescription("Extra assist when player is already moving aim toward the target. Default 0 means no boost toward target.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); NaturalSideAssist = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalSideAssist", 0.55f, new ConfigDescription("Small assist when player aim input is mostly perpendicular to target direction.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); NaturalAwayDamping = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalAwayDamping", 1.45f, new ConfigDescription("Damping force when player aim input moves away from target.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); NaturalMovementOnlyScale = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalMovementOnlyScale", 0f, new ConfigDescription("Assist when only movement input exists and no look input exists. Default 0 disables hands-free pull.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); NaturalMaxInputFraction = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalMaxInputFraction", 0.85f, new ConfigDescription("Natural assist cap as a fraction of current player look input.", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 2f), Array.Empty())); NaturalMinDeltaPerFrame = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalMinDeltaPerFrame", 0.003f, new ConfigDescription("Minimum allowed natural delta cap per frame.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); NaturalSmoothing = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalSmoothing", 30f, new ConfigDescription("Smoothing speed for natural assist output. Higher is more responsive.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 60f), Array.Empty())); NaturalReleaseSmoothing = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalReleaseSmoothing", 10f, new ConfigDescription("Smoothing speed when Natural assist is releasing. Lower = softer release.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 60f), Array.Empty())); NaturalDirectionSmoothing = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalDirectionSmoothing", 18f, new ConfigDescription("Smoothing speed for target direction in Natural mode. Lower reduces jitter from target point changes.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 60f), Array.Empty())); NaturalMinLookInput = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalMinLookInput", 0.001f, new ConfigDescription("Minimum look input magnitude before natural aim shaping uses look direction.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); NaturalKeepOfficialGamepadPull = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalKeepOfficialGamepadPull", true, "In Natural mode, keep the game's original controller ADS pull. Mouse official ADS pull is still removed."); NaturalReleaseCurvePower = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalReleaseCurvePower", 2.4f, new ConfigDescription("Extra falloff used only by Natural mode. Higher values make assist release more smoothly near the edge of the bubble.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 8f), Array.Empty())); NaturalOuterEdgeStrength = ((BaseUnityPlugin)this).Config.Bind("Custom Natural", "NaturalOuterEdgeStrength", 0.02f, new ConfigDescription("Minimum Natural strength near the outer bubble edge. Keep low to avoid a sudden breakaway feeling.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.5f), Array.Empty())); OverrideOfficialScanner = ((BaseUnityPlugin)this).Config.Bind("System - Official Scanner", "OverrideOfficialScanner", true, "Tune official AimAssist scanner fields."); OfficialMaxAssistDistance = ((BaseUnityPlugin)this).Config.Bind("System - Official Scanner", "OfficialMaxAssistDistance", 100f, new ConfigDescription("Official scanner max distance.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 250f), Array.Empty())); OfficialScanConeDegrees = ((BaseUnityPlugin)this).Config.Bind("System - Official Scanner", "OfficialScanConeDegrees", 75f, new ConfigDescription("Official scanner cone. Should be wider than OuterBubbleAngleDegrees.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 89f), Array.Empty())); OfficialScoreThreshold = ((BaseUnityPlugin)this).Config.Bind("System - Official Scanner", "OfficialScoreThreshold", 0f, new ConfigDescription("Official scanner score threshold.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); OfficialDistanceVsDotBlend = ((BaseUnityPlugin)this).Config.Bind("System - Official Scanner", "OfficialDistanceVsDotBlend", 0.03f, new ConfigDescription("Official scanner scoring mix. 0 = aim angle, 1 = distance.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); OfficialScanIntervalFrames = ((BaseUnityPlugin)this).Config.Bind("System - Official Scanner", "OfficialScanIntervalFrames", 1, new ConfigDescription("Frames between official target scans.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 30), Array.Empty())); ScannerKeepAliveStrength = ((BaseUnityPlugin)this).Config.Bind("System - Official Scanner", "ScannerKeepAliveStrength", 0.001f, new ConfigDescription("Tiny internal friction strength to keep official scanner active when all official assist sliders are zero.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.5f), Array.Empty())); InvertX = ((BaseUnityPlugin)this).Config.Bind("Troubleshooting", "InvertX", false, "Invert horizontal assist direction if it moves away from target."); InvertY = ((BaseUnityPlugin)this).Config.Bind("Troubleshooting", "InvertY", false, "Invert vertical assist direction if it moves away from target."); EnableWeakspotDebugOverlay = ((BaseUnityPlugin)this).Config.Bind("Debug - Weakspot Overlay", "EnableWeakspotDebugOverlay", false, "Enable a runtime overlay that draws actual weakspot polygons from Hitmesh / HitboxColliders data."); WeakspotDebugOnlyTrackedTarget = ((BaseUnityPlugin)this).Config.Bind("Debug - Weakspot Overlay", "WeakspotDebugOnlyTrackedTarget", true, "Only draw weakspot polygons for the current AimAssist tracked target."); WeakspotDebugShowAllPositiveShapes = ((BaseUnityPlugin)this).Config.Bind("Debug - Weakspot Overlay", "WeakspotDebugShowAllPositiveShapes", false, "Draw every non-invulnerable positive-multiplier shape. If false, only draw the highest-multiplier shape(s) per target."); WeakspotDebugMinimumMultiplier = ((BaseUnityPlugin)this).Config.Bind("Debug - Weakspot Overlay", "WeakspotDebugMinimumMultiplier", 0.75f, new ConfigDescription("Minimum base GetShapeMultiplier() required for overlay drawing when WeakspotDebugShowAllPositiveShapes is true.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); WeakspotDebugLineWidth = ((BaseUnityPlugin)this).Config.Bind("Debug - Weakspot Overlay", "WeakspotDebugLineWidth", 0.025f, new ConfigDescription("World-space line width for the weakspot overlay.", (AcceptableValueBase)(object)new AcceptableValueRange(0.001f, 0.2f), Array.Empty())); WeakspotDebugDepthOffset = ((BaseUnityPlugin)this).Config.Bind("Debug - Weakspot Overlay", "WeakspotDebugDepthOffset", 0.03f, new ConfigDescription("Move overlay vertices slightly toward the player camera to reduce z-fighting.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.25f), Array.Empty())); EnableAimbot = ((BaseUnityPlugin)this).Config.Bind("Master Switch", "EnableAimbot", true, "Master switch for Deadeye Instinct aim assist and HardLock AutoFire."); HoldDisableKey = ((BaseUnityPlugin)this).Config.Bind("Master Switch", "HoldDisableKey", (KeyCode)308, "Hold this key to temporarily disable aim assist and release AutoFire trigger. Use None to disable this keybind."); HardLockMaxDistance = ((BaseUnityPlugin)this).Config.Bind("HardLock", "HardLockMaxDistance", 90f, new ConfigDescription("Maximum configured distance for HardLock target search.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 1000f), Array.Empty())); HardLockMaxDistanceCap = ((BaseUnityPlugin)this).Config.Bind("HardLock", "HardLockMaxDistanceCap", 90f, new ConfigDescription("Safety cap applied on top of HardLockMaxDistance. This keeps old configs with very large distances from locking enemies too far away. Set to 0 to disable the cap.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1000f), Array.Empty())); HardLockPreferWeakspot = ((BaseUnityPlugin)this).Config.Bind("HardLock", "HardLockPreferWeakspot", true, "HardLock aims at the best weakspot center when available."); HardLockWeakspotBias = ((BaseUnityPlugin)this).Config.Bind("HardLock", "HardLockWeakspotBias", 1f, new ConfigDescription("0 = target body point, 1 = weakspot center.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); HardLockRotationSpeed = ((BaseUnityPlugin)this).Config.Bind("HardLock", "HardLockRotationSpeed", 420f, new ConfigDescription("Maximum HardLock correction speed per second. High values create near-instant lock.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 5000f), Array.Empty())); HardLockRotationGain = ((BaseUnityPlugin)this).Config.Bind("HardLock", "HardLockRotationGain", 0.18f, new ConfigDescription("Scales angular error into camera rotation delta. Higher values are more aggressive.", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 10f), Array.Empty())); HardLockMaxDeltaPerFrame = ((BaseUnityPlugin)this).Config.Bind("HardLock", "HardLockMaxDeltaPerFrame", 12f, new ConfigDescription("Hard cap for HardLock rotation delta per frame.", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 100f), Array.Empty())); HardLockRecoilCompensation = ((BaseUnityPlugin)this).Config.Bind("HardLock", "HardLockRecoilCompensation", true, "Apply an extra HardLock correction after CameraRecoil.LateUpdate()."); HardLockRequireLineOfSight = ((BaseUnityPlugin)this).Config.Bind("HardLock", "HardLockRequireLineOfSight", true, "Legacy line-of-sight switch. Kept for compatibility. HardLockRequireVisibleTarget is the safer release switch."); HardLockRequireVisibleTarget = ((BaseUnityPlugin)this).Config.Bind("HardLock", "HardLockRequireVisibleTarget", true, "Require official geometry-layer visibility before selecting a HardLock target. This prevents locking enemies behind walls or before the player can see them."); HardLockTargetPriorityMode = ((BaseUnityPlugin)this).Config.Bind("HardLock Target Priority", "HardLockTargetPriority", HardLockTargetPriority.ThreatWeighted, "Nearest / LowestHealth / WeakspotThenDistance / ThreatWeighted."); HardLockDistanceWeight = ((BaseUnityPlugin)this).Config.Bind("HardLock Target Priority", "DistanceWeight", 0.75f, new ConfigDescription("ThreatWeighted score weight for nearby enemies. Default is 50% higher than v1.2.4.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); HardLockLowHealthWeight = ((BaseUnityPlugin)this).Config.Bind("HardLock Target Priority", "LowHealthWeight", 0.25f, new ConfigDescription("ThreatWeighted score weight for low health enemies.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); HardLockWeakspotWeight = ((BaseUnityPlugin)this).Config.Bind("HardLock Target Priority", "WeakspotWeight", 0.15f, new ConfigDescription("ThreatWeighted score weight for high-multiplier weakspots.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); HardLockStickyTargetBonus = ((BaseUnityPlugin)this).Config.Bind("HardLock Target Priority", "StickyTargetBonus", 0.2f, new ConfigDescription("Extra score for the current HardLock target to prevent rapid target switching.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); EnableAutoFire = ((BaseUnityPlugin)this).Config.Bind("Auto Fire", "EnableAutoFire", false, "Automatically holds or pulses the weapon trigger when HardLock is aligned."); AutoFireOnlyInHardLock = ((BaseUnityPlugin)this).Config.Bind("Auto Fire", "AutoFireOnlyInHardLock", true, "Only allow AutoFire while Mode = HardLock."); AutoFireRequireAligned = ((BaseUnityPlugin)this).Config.Bind("Auto Fire", "AutoFireRequireAligned", true, "Only fire when HardLock target angle is within AutoFireMaxAngleDegrees."); AutoFireMaxAngleDegrees = ((BaseUnityPlugin)this).Config.Bind("Auto Fire", "AutoFireMaxAngleDegrees", 1f, new ConfigDescription("Maximum angle error for AutoFire alignment.", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 30f), Array.Empty())); AutoFireRequireWeaponReady = ((BaseUnityPlugin)this).Config.Bind("Auto Fire", "AutoFireRequireWeaponReady", true, "Check ammo / reload / cooldown fields before pressing the trigger when available."); AutoFireRespectSemiAuto = ((BaseUnityPlugin)this).Config.Bind("Auto Fire", "AutoFireRespectSemiAuto", true, "Pulse semi-auto weapons instead of holding the trigger down."); AutoFirePulseSeconds = ((BaseUnityPlugin)this).Config.Bind("Auto Fire", "AutoFirePulseSeconds", 0.04f, new ConfigDescription("Trigger-down duration for semi-auto AutoFire pulses.", (AcceptableValueBase)(object)new AcceptableValueRange(0.005f, 0.5f), Array.Empty())); AutoFireReleaseSeconds = ((BaseUnityPlugin)this).Config.Bind("Auto Fire", "AutoFireReleaseSeconds", 0.04f, new ConfigDescription("Trigger-up duration between semi-auto AutoFire pulses.", (AcceptableValueBase)(object)new AcceptableValueRange(0.005f, 0.5f), Array.Empty())); } } internal static class InputReaderUpdatePatch { internal struct InputSnapshot { public bool PlayerInputActive; public bool LookInputActive; public bool MoveInputActive; public Vector2 EffectiveLookInput; public bool GamepadUsed; } private static readonly FieldInfo FieldLookDelta = AccessTools.Field(typeof(InputReader), "lookDelta"); private static readonly FieldInfo FieldLookDeltaGamepad = AccessTools.Field(typeof(InputReader), "lookDeltaGamepad"); private static readonly MethodInfo GamepadUsedGetter = AccessTools.PropertyGetter(typeof(InputReader), "GamepadUsed"); private static readonly FieldInfo AimAssistField = AccessTools.Field(typeof(InputReader), "aimAssist"); private static readonly FieldInfo RotationPullDeltaField = AccessTools.Field(typeof(AimAssist), "rotationPullDelta"); internal static bool LastPlayerInputActive; internal static bool LastLookInputActive; internal static bool LastMoveInputActive; internal static Vector2 LastEffectiveLookInput; internal static bool LastGamepadUsed; private static readonly Dictionary SnapshotsByAimAssist = new Dictionary(); public static void Prefix(InputReader __instance) { //IL_0013: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_0070: 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) //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) LastPlayerInputActive = false; LastLookInputActive = false; LastMoveInputActive = false; LastEffectiveLookInput = Vector2.zero; LastGamepadUsed = false; if (!DeadeyeInstinctPlugin.EnableMod.Value || (Object)(object)__instance == (Object)null) { return; } Vector2 vector = GetVector2(FieldLookDelta, __instance); Vector2 vector2 = GetVector2(FieldLookDeltaGamepad, __instance); LastGamepadUsed = __instance.GamepadUsed; LastEffectiveLookInput = (__instance.GamepadUsed ? (vector2 * Time.unscaledDeltaTime) : vector); bool flag = DeadeyeInstinctPlugin.CountLookInput.Value && ((Vector2)(ref LastEffectiveLookInput)).magnitude >= DeadeyeInstinctPlugin.LookInputThreshold.Value; bool flag2 = false; if (DeadeyeInstinctPlugin.CountMoveInput.Value) { try { Vector2 rawMovementInput = __instance.GetRawMovementInput(); flag2 = ((Vector2)(ref rawMovementInput)).magnitude >= DeadeyeInstinctPlugin.MoveInputThreshold.Value; } catch { flag2 = false; } } LastLookInputActive = flag; LastMoveInputActive = flag2; LastPlayerInputActive = flag || flag2; if ((Object)(object)__instance.aimAssist != (Object)null) { SnapshotsByAimAssist[__instance.aimAssist] = new InputSnapshot { PlayerInputActive = LastPlayerInputActive, LookInputActive = LastLookInputActive, MoveInputActive = LastMoveInputActive, EffectiveLookInput = LastEffectiveLookInput, GamepadUsed = LastGamepadUsed }; } } public static bool TryGetSnapshot(AimAssist aimAssist, out InputSnapshot snapshot) { //IL_0051: 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) if ((Object)(object)aimAssist != (Object)null && SnapshotsByAimAssist.TryGetValue(aimAssist, out snapshot)) { return true; } snapshot = new InputSnapshot { PlayerInputActive = LastPlayerInputActive, LookInputActive = LastLookInputActive, MoveInputActive = LastMoveInputActive, EffectiveLookInput = LastEffectiveLookInput, GamepadUsed = LastGamepadUsed }; return false; } public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown List list = new List(instructions); MethodInfo methodInfo = AccessTools.Method(typeof(InputReaderUpdatePatch), "ShouldConsumeRotationPullDelta", (Type[])null, (Type[])null); int num = 0; for (int i = 0; i < list.Count; i++) { CodeInstruction val = list[i]; if (CodeInstructionExtensions.Calls(val, GamepadUsedGetter) && IsRotationPullDeltaBranch(list, i)) { list[i] = new CodeInstruction(OpCodes.Call, (object)methodInfo); num++; } } ManualLogSource log = DeadeyeInstinctPlugin.Log; if (log != null) { log.LogInfo((object)$"InputReader.Update transpiler patched rotationPullDelta branch count={num}."); } return list; } private static bool IsRotationPullDeltaBranch(List codes, int index) { int num = Mathf.Min(codes.Count, index + 24); for (int i = index + 1; i < num; i++) { if (!(codes[i].opcode == OpCodes.Ldfld) || !(codes[i].operand is FieldInfo fieldInfo)) { continue; } if (fieldInfo == AimAssistField) { for (int j = i + 1; j < num; j++) { if (codes[j].opcode == OpCodes.Ldfld && codes[j].operand is FieldInfo fieldInfo2 && fieldInfo2 == RotationPullDeltaField) { return true; } } } if (fieldInfo == RotationPullDeltaField) { return true; } } return false; } public static bool ShouldConsumeRotationPullDelta(InputReader reader) { if ((Object)(object)reader == (Object)null) { return false; } if (reader.GamepadUsed) { return true; } return DeadeyeInstinctPlugin.EnableMod.Value && DeadeyeInstinctPlugin.EnableMouseConsumesRotationPullDelta.Value; } private static Vector2 GetVector2(FieldInfo field, object target) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0041: 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) if (field == null || target == null) { return Vector2.zero; } try { return (field.GetValue(target) is Vector2 val) ? val : Vector2.zero; } catch { return Vector2.zero; } } } internal static class AimAssistLateUpdatePatch { private static readonly FieldInfo FieldScanIntervalFrames = AccessTools.Field(typeof(AimAssist), "scanIntervalFrames"); private static readonly FieldInfo FieldMaxAssistDistance = AccessTools.Field(typeof(AimAssist), "maxAssistDistance"); private static readonly FieldInfo FieldMinAimDot = AccessTools.Field(typeof(AimAssist), "minAimDot"); private static readonly FieldInfo FieldDistanceVsDotBlend = AccessTools.Field(typeof(AimAssist), "distanceVsDotBlend"); private static readonly FieldInfo FieldScoreThreshold = AccessTools.Field(typeof(AimAssist), "scoreThreshold"); private static readonly FieldInfo FieldAdsDistanceMultiplier = AccessTools.Field(typeof(AimAssist), "adsDistanceMultiplier"); private static readonly FieldInfo FieldFrictionStrength = AccessTools.Field(typeof(AimAssist), "frictionStrength"); private static readonly FieldInfo FieldPlayerCamera = AccessTools.Field(typeof(AimAssist), "playerCamera"); private static readonly FieldInfo FieldTrackedTarget = AccessTools.Field(typeof(AimAssist), "trackedTarget"); private static readonly FieldInfo FieldTrackedTargetPoint = AccessTools.Field(typeof(AimAssist), "trackedTargetPoint"); private static Vector2 smoothedNaturalDelta; private static Vector2 smoothedNaturalDirection; private static Vector2 smoothedMagnetDelta; private static Unit lastAssistTarget; private static float targetSwitchTimer; private static float nextDebugLogTime; internal static Unit CurrentTrackedTargetForDebug; internal static Camera CurrentPlayerCameraForDebug; public static void Prefix(AimAssist __instance) { if (DeadeyeInstinctPlugin.EnableMod.Value && !((Object)(object)__instance == (Object)null)) { if (DeadeyeInstinctPlugin.OverrideOfficialScanner.Value) { Set(FieldScanIntervalFrames, __instance, DeadeyeInstinctPlugin.OfficialScanIntervalFrames.Value); Set(FieldMaxAssistDistance, __instance, DeadeyeInstinctPlugin.OfficialMaxAssistDistance.Value); float num = Mathf.Clamp(DeadeyeInstinctPlugin.OfficialScanConeDegrees.Value, 1f, 89f); Set(FieldMinAimDot, __instance, Mathf.Cos(num * ((float)Math.PI / 180f))); Set(FieldDistanceVsDotBlend, __instance, DeadeyeInstinctPlugin.OfficialDistanceVsDotBlend.Value); Set(FieldScoreThreshold, __instance, DeadeyeInstinctPlugin.OfficialScoreThreshold.Value); Set(FieldAdsDistanceMultiplier, __instance, 1f); } float num2 = Mathf.Clamp(DeadeyeInstinctPlugin.ScannerKeepAliveStrength.Value, 0f, 0.5f); float num4 = ((Get(FieldFrictionStrength, __instance) is float num3) ? num3 : 0f); if (num4 < num2) { Set(FieldFrictionStrength, __instance, num2); } } } public static void Postfix(AimAssist __instance) { //IL_0045: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) if (!DeadeyeInstinctPlugin.EnableMod.Value || (Object)(object)__instance == (Object)null) { return; } bool flag = DeadeyeInstinctPlugin.ActiveMode() == AssistMode.Natural; InputReaderUpdatePatch.InputSnapshot snapshot; bool flag2 = InputReaderUpdatePatch.TryGetSnapshot(__instance, out snapshot); if (!DeadeyeInstinctPlugin.IsAimbotRuntimeEnabled()) { __instance.rotationPullDelta = Vector2.zero; CurrentTrackedTargetForDebug = null; HardLockController.ClearRuntimeTarget(); DecayNaturalDelta(); return; } if (DeadeyeInstinctPlugin.ActiveMode() == AssistMode.HardLock) { object obj = Get(FieldPlayerCamera, __instance); Camera camera = (CurrentPlayerCameraForDebug = (Camera)((obj is Camera) ? obj : null)); __instance.rotationPullDelta = Vector2.zero; if (HardLockController.TryUpdateFromCamera(camera, out var target, out var _)) { CurrentTrackedTargetForDebug = target; UpdateTargetSwitchState(target); } else { CurrentTrackedTargetForDebug = null; ClearTargetState(); } DecayNaturalDelta(); return; } if (flag && (!snapshot.GamepadUsed || !DeadeyeInstinctPlugin.EffectiveNaturalKeepOfficialGamepadPull())) { __instance.rotationPullDelta = Vector2.zero; } if (!DeadeyeInstinctPlugin.EnableContinuousRotationalAssist.Value) { DecayNaturalDelta(); return; } if (DeadeyeInstinctPlugin.RequirePlayerInput.Value && !snapshot.PlayerInputActive) { DecayNaturalDelta(); return; } object obj2 = Get(FieldTrackedTarget, __instance); Unit val = (Unit)((obj2 is Unit) ? obj2 : null); if ((Object)(object)val == (Object)null || (int)val.UnitState == 0 || (Object)(object)val.mainCollider == (Object)null) { CurrentTrackedTargetForDebug = null; ClearTargetState(); DecayNaturalDelta(); return; } UpdateTargetSwitchState(val); if (!(Get(FieldTrackedTargetPoint, __instance) is Vector3 magnetTargetPoint) || 1 == 0) { DecayNaturalDelta(); return; } object obj3 = Get(FieldPlayerCamera, __instance); Camera val2 = (Camera)((obj3 is Camera) ? obj3 : null); if ((Object)(object)val2 == (Object)null) { CurrentPlayerCameraForDebug = null; CurrentTrackedTargetForDebug = val; DecayNaturalDelta(); return; } CurrentPlayerCameraForDebug = val2; CurrentTrackedTargetForDebug = val; bool weakspotTargetUsed = false; if (DeadeyeInstinctPlugin.ActiveMode() == AssistMode.Magnet) { magnetTargetPoint = GetMagnetTargetPoint(val, magnetTargetPoint, out weakspotTargetUsed); if (weakspotTargetUsed && DeadeyeInstinctPlugin.EffectiveMagnetWeakspotOverrideOfficialPull()) { __instance.rotationPullDelta = Vector2.zero; } } Vector3 val3 = val2.WorldToViewportPoint(magnetTargetPoint); if (val3.z <= 0f) { DecayNaturalDelta(); return; } Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(val3.x - 0.5f, 0f - (val3.y - 0.5f)); if (DeadeyeInstinctPlugin.InvertX.Value) { val4.x = 0f - val4.x; } if (DeadeyeInstinctPlugin.InvertY.Value) { val4.y = 0f - val4.y; } if (((Vector2)(ref val4)).sqrMagnitude <= 1E-06f) { DecayNaturalDelta(); return; } Vector3 val5 = magnetTargetPoint - ((Component)val2).transform.position; float magnitude = ((Vector3)(ref val5)).magnitude; if (magnitude <= 0.001f) { DecayNaturalDelta(); return; } Vector3 val6 = val5 / magnitude; float num = Mathf.Clamp(Vector3.Dot(((Component)val2).transform.forward, val6), -1f, 1f); float num2 = Mathf.Acos(num) * 57.29578f; float num3 = Mathf.Clamp(DeadeyeInstinctPlugin.EffectiveOuterBubbleAngleDegrees(), 0.1f, 89f); float num4 = Mathf.Clamp(DeadeyeInstinctPlugin.EffectiveInnerBubbleAngleDegrees(), 0.05f, num3); if (num2 > num3) { DecayNaturalDelta(); return; } float num5 = Mathf.InverseLerp(num3, num4, num2); num5 = Mathf.Clamp01(num5); num5 = Mathf.Pow(num5, Mathf.Max(0.01f, DeadeyeInstinctPlugin.EffectiveBubbleCurvePower())); float num6 = Mathf.Max(1f, DeadeyeInstinctPlugin.OfficialMaxAssistDistance.Value); float num7 = 1f - Mathf.Clamp01(magnitude / num6); num7 = Mathf.Pow(num7, Mathf.Max(0.01f, DeadeyeInstinctPlugin.EffectiveDistanceFalloffPower())); float num8 = Mathf.Max(0f, DeadeyeInstinctPlugin.EffectiveRotationDeltaPerSecond()) * Mathf.Max(0f, DeadeyeInstinctPlugin.EffectiveAssistCoefficient()) * num5 * num7 * Time.deltaTime; num8 *= GetTargetSwitchScale(); if (DeadeyeInstinctPlugin.ActiveMode() == AssistMode.Magnet) { num8 *= GetMagnetEdgeScale(num2, num3, num5); } num8 = Mathf.Min(num8, Mathf.Max(0.001f, DeadeyeInstinctPlugin.EffectiveMaxRotationDeltaPerFrame())); if (num8 <= 1E-06f) { DecayNaturalDelta(); return; } Vector2 val7 = ComputeAssistDelta(val4, num8, num5, snapshot); if (((Vector2)(ref val7)).sqrMagnitude <= 1E-07f) { DecayNaturalDelta(); return; } __instance.rotationPullDelta += val7; if (DeadeyeInstinctPlugin.DebugLogging.Value && Time.unscaledTime >= nextDebugLogTime) { nextDebugLogTime = Time.unscaledTime + 0.5f; DeadeyeInstinctPlugin.Log.LogInfo((object)$"Mode={DeadeyeInstinctPlugin.ActiveMode()}, target={((Object)val).name}, angle={num2:F2}, bubble={num5:F3}, dist={num7:F3}, add={val7}, final={__instance.rotationPullDelta}"); } } private static Vector2 ComputeAssistDelta(Vector2 offset, float amount, float bubble, InputReaderUpdatePatch.InputSnapshot inputSnapshot) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0068: 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_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_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) if (((Vector2)(ref offset)).sqrMagnitude <= 1E-06f || amount <= 1E-06f) { return Vector2.zero; } Vector2 normalized = ((Vector2)(ref offset)).normalized; return (Vector2)(DeadeyeInstinctPlugin.ActiveMode() switch { AssistMode.Magnet => ComputeMagnetDelta(normalized, amount, inputSnapshot), AssistMode.Natural => ComputeNaturalDelta(normalized, amount, bubble, inputSnapshot), _ => normalized * amount, }); } private static Vector3 GetMagnetTargetPoint(Unit target, Vector3 officialTargetPoint, out bool weakspotTargetUsed) { //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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_0023: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) weakspotTargetUsed = false; if ((Object)(object)target == (Object)null) { return officialTargetPoint; } if (DeadeyeInstinctPlugin.EffectiveMagnetPreferWeakspot()) { try { if (TryGetBestWeakspotPoint(target, officialTargetPoint, out var point, out var _)) { weakspotTargetUsed = true; float num = Mathf.Clamp01(DeadeyeInstinctPlugin.EffectiveMagnetWeakspotBias()); return Vector3.Lerp(officialTargetPoint, point, num); } } catch { } } try { Collider mainCollider = target.mainCollider; if ((Object)(object)mainCollider != (Object)null) { Bounds bounds = mainCollider.bounds; float num2 = Mathf.Clamp01(DeadeyeInstinctPlugin.EffectiveMagnetCenterBias()); return Vector3.Lerp(officialTargetPoint, ((Bounds)(ref bounds)).center, num2); } } catch { } return officialTargetPoint; } private static bool TryGetBestWeakspotPoint(Unit target, Vector3 referenceWorldPoint, out Vector3 point, out float multiplier) { //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_005d: 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) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) point = Vector3.zero; multiplier = 0f; if ((Object)(object)target == (Object)null) { return false; } Hitmesh[] array = null; try { array = ((Component)target).GetComponentsInChildren(true); } catch { return false; } if (array == null || array.Length == 0) { return false; } bool flag = false; Vector3 val = Vector3.zero; float num = 0f; float num2 = float.MaxValue; int num3 = -1; foreach (Hitmesh val2 in array) { if ((Object)(object)val2 == (Object)null || val2.hitShapes == null || val2.hitShapes.Length == 0 || ((Object)(object)val2.owner != (Object)null && (Object)(object)val2.owner != (Object)(object)target)) { continue; } for (int j = 0; j < val2.hitShapes.Length; j++) { Data val3 = val2.hitShapes[j]; if (((Data)(ref val3)).isInvulnerable) { continue; } float shapeMultiplier = ((Data)(ref val3)).GetShapeMultiplier(); if (!(shapeMultiplier <= 0f) && TryGetShapeAimPoint(val2, val3.shapeId, referenceWorldPoint, out var point2, out var distanceSqr)) { int partPriority = GetPartPriority(((ShapeId)(ref val3.shapeId)).part); if (!flag || shapeMultiplier > num + 0.0001f || (Mathf.Abs(shapeMultiplier - num) <= 0.0001f && partPriority > num3) || (Mathf.Abs(shapeMultiplier - num) <= 0.0001f && partPriority == num3 && distanceSqr < num2)) { flag = true; num = shapeMultiplier; num3 = partPriority; num2 = distanceSqr; val = point2; multiplier = shapeMultiplier; } } } } if (!flag) { return false; } point = val; return true; } private static int GetPartPriority(Parts part) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 if ((int)part == 2) { return 30; } if ((int)part == 4) { return 20; } if ((int)part == 3) { return 10; } return 0; } private static bool TryGetShapeAimPoint(Hitmesh hitmesh, ShapeId shapeId, Vector3 referenceWorldPoint, out Vector3 point, out float distanceSqr) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_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) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) point = Vector3.zero; distanceSqr = float.MaxValue; if ((Object)(object)hitmesh == (Object)null || (int)((ShapeId)(ref shapeId)).part == 0) { return false; } try { HitboxColliders loadedHitboxColliders = StaticInstance.Instance.loadedHitboxColliders; if ((Object)(object)loadedHitboxColliders == (Object)null || !loadedHitboxColliders.runtimeHitmeshData.IsCreated || !loadedHitboxColliders.runtimeVertexData.IsCreated) { return false; } int hitboxFrameIndex = hitmesh.hitboxFrameIndex; if (hitboxFrameIndex < 0 || hitboxFrameIndex >= loadedHitboxColliders.runtimeHitmeshData.Length) { return false; } RuntimeHitboxData val = loadedHitboxColliders.runtimeHitmeshData[hitboxFrameIndex]; Vector3 val2 = ((Component)hitmesh).transform.InverseTransformPoint(referenceWorldPoint); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(val2.x, val2.y); for (int i = 0; i < val.shapes.Length; i++) { ShapeData val4 = val.shapes[i]; if (val4.shapeId != shapeId) { continue; } int length = val4.length; if (length <= 1) { return false; } Vector2[] array = (Vector2[])(object)new Vector2[length]; for (int j = 0; j < length; j++) { int num = val4.index + j; if (num < 0 || num >= loadedHitboxColliders.runtimeVertexData.Length) { return false; } float2 val5 = loadedHitboxColliders.runtimeVertexData[num]; array[j] = new Vector2(val5.x, val5.y); } Vector2 val6; if (IsPointInsidePolygon(val3, array)) { val6 = val3; distanceSqr = 0f; } else { val6 = GetClosestPointOnPolygon(val3, array, out distanceSqr); } point = ((Component)hitmesh).transform.TransformPoint(new Vector3(val6.x, val6.y, val2.z)); return true; } } catch { return false; } return false; } private static bool IsPointInsidePolygon(Vector2 point, Vector2[] polygon) { //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_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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0072: 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_0086: 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_009b: Unknown result type (might be due to invalid IL or missing references) if (polygon == null || polygon.Length < 3) { return false; } bool flag = false; int num = polygon.Length - 1; for (int i = 0; i < polygon.Length; i++) { Vector2 val = polygon[i]; Vector2 val2 = polygon[num]; if (val.y > point.y != val2.y > point.y && point.x < (val2.x - val.x) * (point.y - val.y) / Mathf.Max(1E-06f, val2.y - val.y) + val.x) { flag = !flag; } num = i; } return flag; } private static Vector2 GetClosestPointOnPolygon(Vector2 point, Vector2[] polygon, out float bestDistanceSqr) { //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_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) //IL_0084: 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_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_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_003e: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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) bestDistanceSqr = float.MaxValue; Vector2 result = point; if (polygon == null || polygon.Length == 0) { return result; } for (int i = 0; i < polygon.Length; i++) { Vector2 a = polygon[i]; Vector2 b = polygon[(i + 1) % polygon.Length]; Vector2 val = ProjectPointOnSegment(point, a, b); Vector2 val2 = val - point; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (sqrMagnitude < bestDistanceSqr) { bestDistanceSqr = sqrMagnitude; result = val; } } return result; } private static Vector2 ProjectPointOnSegment(Vector2 point, Vector2 a, Vector2 b) { //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_0003: 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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004a: 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_004e: Unknown result type (might be due to invalid IL or missing references) Vector2 val = b - a; float num = Vector2.Dot(val, val); if (num <= 1E-06f) { return a; } float num2 = Vector2.Dot(point - a, val) / num; num2 = Mathf.Clamp01(num2); return a + val * num2; } private static Vector2 ComputeMagnetDelta(Vector2 targetDirection, float amount, InputReaderUpdatePatch.InputSnapshot inputSnapshot) { //IL_002c: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0043: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0060: Unknown result type (might be due to invalid IL or missing references) float num = 1f; if (!inputSnapshot.LookInputActive && inputSnapshot.MoveInputActive) { num *= Mathf.Clamp01(DeadeyeInstinctPlugin.EffectiveMagnetMovementOnlyScale()); } num *= GetMagnetLookAwayEscapeScale(targetDirection, inputSnapshot); Vector2 val = targetDirection * amount * num; smoothedMagnetDelta = Vector2.Lerp(smoothedMagnetDelta, val, GetMagnetSmoothingT()); return smoothedMagnetDelta; } private static float GetMagnetLookAwayEscapeScale(Vector2 targetDirection, InputReaderUpdatePatch.InputSnapshot inputSnapshot) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!DeadeyeInstinctPlugin.EffectiveMagnetAllowLookAwayEscape()) { return 1f; } if (!inputSnapshot.LookInputActive) { return 1f; } Vector2 effectiveLookInput = inputSnapshot.EffectiveLookInput; float magnitude = ((Vector2)(ref effectiveLookInput)).magnitude; if (magnitude <= 1E-06f || ((Vector2)(ref targetDirection)).sqrMagnitude <= 1E-06f) { return 1f; } Vector2 val = effectiveLookInput / magnitude; float num = Vector2.Dot(val, targetDirection); float num2 = Mathf.Clamp01(DeadeyeInstinctPlugin.EffectiveMagnetLookAwayThreshold()); if (num >= 0f - num2) { return 1f; } float num3 = Mathf.InverseLerp(num2, 1f, 0f - num); num3 = Mathf.Clamp01(num3); num3 = Mathf.Pow(num3, Mathf.Max(0.01f, DeadeyeInstinctPlugin.EffectiveMagnetLookAwayCurvePower())); float num4 = Mathf.Clamp01(DeadeyeInstinctPlugin.EffectiveMagnetLookAwayMinScale()); float num5 = Mathf.Lerp(1f, num4, num3); if (inputSnapshot.MoveInputActive) { float num6 = Mathf.Clamp01(DeadeyeInstinctPlugin.EffectiveMagnetLookAwayMovementScale()); num5 = Mathf.Lerp(num5, 1f, num6); } return Mathf.Clamp01(num5); } private static Vector2 ComputeNaturalDelta(Vector2 targetDirection, float amount, float bubble, InputReaderUpdatePatch.InputSnapshot inputSnapshot) { //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_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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00fb: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) targetDirection = SmoothNaturalDirection(targetDirection); Vector2 effectiveLookInput = inputSnapshot.EffectiveLookInput; float magnitude = ((Vector2)(ref effectiveLookInput)).magnitude; bool flag = inputSnapshot.LookInputActive && magnitude >= DeadeyeInstinctPlugin.EffectiveNaturalMinLookInput(); float num = Mathf.Clamp01(bubble); num = Mathf.Pow(num, Mathf.Max(0.01f, DeadeyeInstinctPlugin.EffectiveNaturalReleaseCurvePower())); num = Mathf.Lerp(Mathf.Clamp01(DeadeyeInstinctPlugin.EffectiveNaturalOuterEdgeStrength()), 1f, num); amount *= num; if (amount <= 1E-06f) { DecayNaturalDelta(); return smoothedNaturalDelta; } if (!flag) { if (!inputSnapshot.MoveInputActive) { DecayNaturalDelta(); return smoothedNaturalDelta; } Vector2 val = targetDirection * amount * Mathf.Clamp01(DeadeyeInstinctPlugin.EffectiveNaturalMovementOnlyScale()); smoothedNaturalDelta = Vector2.Lerp(smoothedNaturalDelta, val, GetSmoothingT()); return smoothedNaturalDelta; } Vector2 val2 = effectiveLookInput / magnitude; float num2 = Vector2.Dot(val2, targetDirection); float num3 = Mathf.Clamp01(num2); float num4 = Mathf.Clamp01(0f - num2); float num5 = Mathf.Clamp01(1f - Mathf.Abs(num2)); float num6 = DeadeyeInstinctPlugin.EffectiveNaturalTowardAssist() * num3 + DeadeyeInstinctPlugin.EffectiveNaturalSideAssist() * num5 + DeadeyeInstinctPlugin.EffectiveNaturalAwayDamping() * num4; if (num6 <= 1E-06f) { DecayNaturalDelta(); return smoothedNaturalDelta; } Vector2 val3 = targetDirection * amount * num6; float num7 = Mathf.Max(DeadeyeInstinctPlugin.EffectiveNaturalMinDeltaPerFrame(), magnitude * Mathf.Max(0.01f, DeadeyeInstinctPlugin.EffectiveNaturalMaxInputFraction())); val3 = Vector2.ClampMagnitude(val3, num7); smoothedNaturalDelta = Vector2.Lerp(smoothedNaturalDelta, val3, GetSmoothingT()); return smoothedNaturalDelta; } private static Vector2 SmoothNaturalDirection(Vector2 targetDirection) { //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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_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_008e: 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_0071: 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) if (((Vector2)(ref targetDirection)).sqrMagnitude <= 1E-06f) { return targetDirection; } if (((Vector2)(ref smoothedNaturalDirection)).sqrMagnitude <= 1E-06f) { smoothedNaturalDirection = targetDirection; return targetDirection; } float naturalDirectionSmoothingT = GetNaturalDirectionSmoothingT(); smoothedNaturalDirection = Vector2.Lerp(smoothedNaturalDirection, targetDirection, naturalDirectionSmoothingT); if (((Vector2)(ref smoothedNaturalDirection)).sqrMagnitude <= 1E-06f) { smoothedNaturalDirection = targetDirection; } else { ((Vector2)(ref smoothedNaturalDirection)).Normalize(); } return smoothedNaturalDirection; } private static void UpdateTargetSwitchState(Unit target) { //IL_0049: 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) if ((Object)(object)target == (Object)null) { ClearTargetState(); } else if ((Object)(object)lastAssistTarget != (Object)(object)target) { lastAssistTarget = target; targetSwitchTimer = Mathf.Max(0f, SafeValue(DeadeyeInstinctPlugin.TargetSwitchFadeSeconds, 0.12f)); smoothedNaturalDirection = Vector2.zero; } else if (targetSwitchTimer > 0f) { targetSwitchTimer -= Time.unscaledDeltaTime; if (targetSwitchTimer < 0f) { targetSwitchTimer = 0f; } } } private static void ClearTargetState() { //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) lastAssistTarget = null; targetSwitchTimer = 0f; smoothedNaturalDirection = Vector2.zero; } private static float GetMagnetEdgeScale(float angle, float outerAngle, float bubble) { float num = Mathf.Clamp01(bubble); num = Mathf.Pow(num, Mathf.Max(0.01f, DeadeyeInstinctPlugin.EffectiveMagnetEdgeSofteningPower())); num = Mathf.Lerp(Mathf.Clamp01(DeadeyeInstinctPlugin.EffectiveMagnetOuterEdgeStrength()), 1f, num); float num2 = Mathf.Max(0f, DeadeyeInstinctPlugin.EffectiveMagnetSnapBackAnglePadding()); if (num2 > 0f) { float num3 = outerAngle - angle; float num4 = Mathf.Clamp01(num3 / num2); num4 = Mathf.SmoothStep(0f, 1f, num4); num *= Mathf.Lerp(Mathf.Clamp01(DeadeyeInstinctPlugin.EffectiveMagnetOuterEdgeStrength()), 1f, num4); } return Mathf.Clamp01(num); } private static float GetTargetSwitchScale() { float num = Mathf.Max(0f, SafeValue(DeadeyeInstinctPlugin.TargetSwitchFadeSeconds, 0.12f)); if (num <= 0f || targetSwitchTimer <= 0f) { return 1f; } float num2 = 1f - Mathf.Clamp01(targetSwitchTimer / num); float num3 = Mathf.Clamp01(SafeValue(DeadeyeInstinctPlugin.TargetSwitchMinScale, 0.25f)); return Mathf.Lerp(num3, 1f, num2); } private static void DecayNaturalDelta() { //IL_0028: 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_0037: 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_001a: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_005b: 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) if (((Vector2)(ref smoothedNaturalDelta)).sqrMagnitude <= 1E-07f) { smoothedNaturalDelta = Vector2.zero; } else { smoothedNaturalDelta = Vector2.Lerp(smoothedNaturalDelta, Vector2.zero, GetNaturalReleaseSmoothingT()); } if (((Vector2)(ref smoothedMagnetDelta)).sqrMagnitude <= 1E-07f) { smoothedMagnetDelta = Vector2.zero; } else { smoothedMagnetDelta = Vector2.Lerp(smoothedMagnetDelta, Vector2.zero, GetMagnetReleaseSmoothingT()); } } private static float GetNaturalDirectionSmoothingT() { float num = Mathf.Max(0f, DeadeyeInstinctPlugin.EffectiveNaturalDirectionSmoothing()); if (num <= 0f) { return 1f; } return 1f - Mathf.Exp((0f - num) * Time.unscaledDeltaTime); } private static float GetNaturalReleaseSmoothingT() { float num = Mathf.Max(0f, DeadeyeInstinctPlugin.EffectiveNaturalReleaseSmoothing()); if (num <= 0f) { return 1f; } return 1f - Mathf.Exp((0f - num) * Time.unscaledDeltaTime); } private static float GetMagnetSmoothingT() { float num = Mathf.Max(0f, DeadeyeInstinctPlugin.EffectiveMagnetSmoothing()); if (num <= 0f) { return 1f; } return 1f - Mathf.Exp((0f - num) * Time.unscaledDeltaTime); } private static float GetMagnetReleaseSmoothingT() { float num = Mathf.Max(0f, DeadeyeInstinctPlugin.EffectiveMagnetReleaseSmoothing()); if (num <= 0f) { return 1f; } return 1f - Mathf.Exp((0f - num) * Time.unscaledDeltaTime); } private static float GetSmoothingT() { float num = Mathf.Max(0f, DeadeyeInstinctPlugin.EffectiveNaturalSmoothing()); if (num <= 0f) { return 1f; } return 1f - Mathf.Exp((0f - num) * Time.unscaledDeltaTime); } private static float SafeValue(ConfigEntry entry, float fallback) { return entry?.Value ?? fallback; } private static bool SafeValue(ConfigEntry entry, bool fallback) { return entry?.Value ?? fallback; } private static void Set(FieldInfo field, object target, object value) { if (field == null || target == null) { return; } try { field.SetValue(target, value); } catch (Exception ex) { ManualLogSource log = DeadeyeInstinctPlugin.Log; if (log != null) { log.LogWarning((object)("Failed to set " + field.Name + ": " + ex.Message)); } } } private static object Get(FieldInfo field, object target) { if (field == null || target == null) { return null; } try { return field.GetValue(target); } catch { return null; } } } internal static class HardLockController { internal struct HardLockTargetState { public bool HasTarget; public bool IsAligned; public Unit Target; public Vector3 TargetPoint; public float AngleDegrees; public float Distance; public float WeakspotMultiplier; } private static HardLockTargetState currentState; private static readonly MethodInfo MethodIsHostileTo = AccessTools.Method(typeof(Npc), "IsHostileTo", new Type[1] { typeof(FactionIds) }, (Type[])null); private static readonly MethodInfo MethodGetPositionToAimAt = AccessTools.Method(typeof(Unit), "GetPositionToAimAt", (Type[])null, (Type[])null); internal static HardLockTargetState CurrentState => currentState; internal static void ClearRuntimeTarget() { currentState = default(HardLockTargetState); } internal static bool TryUpdateFromCamera(Camera camera, out Unit target, out Vector3 targetPoint) { //IL_0005: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) target = null; targetPoint = Vector3.zero; if ((Object)(object)camera == (Object)null || !DeadeyeInstinctPlugin.IsHardLockModeActive()) { ClearRuntimeTarget(); return false; } if (!TrySelectTarget(camera, out var bestState)) { ClearRuntimeTarget(); return false; } bestState.AngleDegrees = ComputeHardLockAngle(camera, bestState.TargetPoint); object extendedCameraController = CameraRecoilLateUpdatePatch.GetExtendedCameraController(camera); if (extendedCameraController != null) { CameraRecoilLateUpdatePatch.RotateTowardPosition(extendedCameraController, bestState.TargetPoint); bestState.AngleDegrees = ComputeHardLockAngle(camera, bestState.TargetPoint); } bestState.IsAligned = !float.IsNaN(bestState.AngleDegrees) && !float.IsInfinity(bestState.AngleDegrees) && bestState.AngleDegrees <= Mathf.Max(0.01f, DeadeyeInstinctPlugin.AutoFireMaxAngleDegrees.Value); currentState = bestState; target = bestState.Target; targetPoint = bestState.TargetPoint; return true; } internal static void ApplyImmediateRecoilCompensation(CameraRecoil recoil) { //IL_005b: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (!DeadeyeInstinctPlugin.IsHardLockModeActive() || !DeadeyeInstinctPlugin.HardLockRecoilCompensation.Value) { return; } if (!currentState.HasTarget || (Object)(object)currentState.Target == (Object)null || !IsValidHardLockTarget((Npc)/*isinst with value type is only supported in some contexts*/) || !IsFiniteVector(currentState.TargetPoint) || !IsPointNearTargetBounds(currentState.Target, currentState.TargetPoint, 3.5f)) { ClearRuntimeTarget(); return; } Camera currentPlayerCameraForDebug = AimAssistLateUpdatePatch.CurrentPlayerCameraForDebug; if (!((Object)(object)currentPlayerCameraForDebug == (Object)null)) { object extendedCameraController = CameraRecoilLateUpdatePatch.GetExtendedCameraController(recoil); if (extendedCameraController != null) { CameraRecoilLateUpdatePatch.RotateTowardPosition(extendedCameraController, currentState.TargetPoint); currentState.AngleDegrees = ComputeHardLockAngle(currentPlayerCameraForDebug, currentState.TargetPoint); currentState.IsAligned = currentState.AngleDegrees <= Mathf.Max(0.01f, DeadeyeInstinctPlugin.AutoFireMaxAngleDegrees.Value); } } } private static float ComputeHardLockAngle(Camera camera, Vector3 point) { //IL_0015: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) if ((Object)(object)camera == (Object)null) { return 180f; } Vector3 val = point - ((Component)camera).transform.position; if (((Vector3)(ref val)).sqrMagnitude <= 1E-06f) { return 0f; } return Vector3.Angle(((Component)camera).transform.forward, ((Vector3)(ref val)).normalized); } private static bool TrySelectTarget(Camera camera, out HardLockTargetState bestState) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) bestState = default(HardLockTargetState); List aliveNpcs = GetAliveNpcs(); if (aliveNpcs == null) { return false; } float effectiveHardLockMaxDistance = GetEffectiveHardLockMaxDistance(); Unit target = currentState.Target; bool flag = false; float num = float.NegativeInfinity; for (int i = 0; i < aliveNpcs.Count; i++) { Npc val = aliveNpcs[i]; if (!IsValidHardLockTarget(val) || !TryResolveHardLockPoint((Unit)(object)val, camera, out var point, out var weakspotMultiplier)) { continue; } float num2 = Vector3.Distance(((Component)camera).transform.position, point); if (!(num2 > effectiveHardLockMaxDistance) && (((DeadeyeInstinctPlugin.HardLockRequireVisibleTarget == null || !DeadeyeInstinctPlugin.HardLockRequireVisibleTarget.Value) && (DeadeyeInstinctPlugin.HardLockRequireLineOfSight == null || !DeadeyeInstinctPlugin.HardLockRequireLineOfSight.Value)) || HasLineOfSight(camera, (Unit)(object)val, point, num2))) { float num3 = ScoreTarget(val, num2, effectiveHardLockMaxDistance, weakspotMultiplier, target); if (!flag || num3 > num) { flag = true; num = num3; bestState = new HardLockTargetState { HasTarget = true, Target = (Unit)(object)val, TargetPoint = point, Distance = num2, WeakspotMultiplier = weakspotMultiplier, IsAligned = false, AngleDegrees = 180f }; } } } return flag; } private static float GetEffectiveHardLockMaxDistance() { float num = Mathf.Max(1f, DeadeyeInstinctPlugin.HardLockMaxDistance.Value); float num2 = ((DeadeyeInstinctPlugin.HardLockMaxDistanceCap != null) ? DeadeyeInstinctPlugin.HardLockMaxDistanceCap.Value : 90f); if (num2 > 0f) { num = Mathf.Min(num, Mathf.Max(1f, num2)); } return num; } private static List GetAliveNpcs() { try { UnitManager instance = StaticInstance.Instance; if ((Object)(object)instance == (Object)null) { return null; } Npc[] allNpcs = instance.GetAllNpcs(false); if (allNpcs == null || allNpcs.Length == 0) { return null; } return new List(allNpcs); } catch { return null; } } private static bool IsHostileToPlayer(Npc npc) { if ((Object)(object)npc == (Object)null || MethodIsHostileTo == null) { return false; } try { object obj = MethodIsHostileTo.Invoke(npc, new object[1] { (object)(FactionIds)16 }); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } private static bool IsValidHardLockTarget(Npc npc) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)npc == (Object)null || (Object)(object)((Component)npc).transform == (Object)null || !((Component)npc).gameObject.activeInHierarchy) { return false; } if ((int)((Unit)npc).UnitState == 0 || ((Unit)npc).IsProtectedNpc || ((Unit)npc).IsPlayerFaction || (Object)(object)((Unit)npc).mainCollider == (Object)null) { return false; } return IsHostileToPlayer(npc); } private static float ScoreTarget(Npc npc, float distance, float maxDistance, float weakspotMultiplier, Unit previousTarget) { float num = 1f - Mathf.Clamp01(distance / Mathf.Max(1f, maxDistance)); float lowHealthScore = GetLowHealthScore((Unit)(object)npc); float num2 = Mathf.Clamp01(weakspotMultiplier / 1.5f); float num3 = (((Object)(object)previousTarget != (Object)null && (Object)(object)npc == (Object)(object)previousTarget) ? Mathf.Max(0f, DeadeyeInstinctPlugin.HardLockStickyTargetBonus.Value) : 0f); return DeadeyeInstinctPlugin.HardLockTargetPriorityMode.Value switch { HardLockTargetPriority.Nearest => num + num3, HardLockTargetPriority.LowestHealth => lowHealthScore + num * 0.375f + num3, HardLockTargetPriority.WeakspotThenDistance => num2 + num * 0.75f + num3, _ => num * Mathf.Max(0f, DeadeyeInstinctPlugin.HardLockDistanceWeight.Value) + lowHealthScore * Mathf.Max(0f, DeadeyeInstinctPlugin.HardLockLowHealthWeight.Value) + num2 * Mathf.Max(0f, DeadeyeInstinctPlugin.HardLockWeakspotWeight.Value) + num3, }; } private static float GetLowHealthScore(Unit unit) { if ((Object)(object)unit == (Object)null || unit.Stats == null) { return 0f; } try { float num = Mathf.Max(0f, unit.GetCurrentHealth()); float attribute = unit.Stats.GetAttribute((EntityAttributes)60); if (attribute <= 0.001f) { return 0f; } return 1f - Mathf.Clamp01(num / attribute); } catch { return 0f; } } private static bool TryResolveHardLockPoint(Unit target, Camera camera, out Vector3 point, out float weakspotMultiplier) { //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_0028: 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_002e: 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) //IL_0058: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00e4: Unknown result type (might be due to invalid IL or missing references) point = Vector3.zero; weakspotMultiplier = 0.5f; if ((Object)(object)target == (Object)null) { return false; } Vector3 fallbackTargetPoint = GetFallbackTargetPoint(target); if (!IsFiniteVector(fallbackTargetPoint) || !IsPointNearTargetBounds(target, fallbackTargetPoint, 3.5f)) { return false; } point = fallbackTargetPoint; if (!DeadeyeInstinctPlugin.HardLockPreferWeakspot.Value) { return true; } if (TryGetBestWeakspotCenterPoint(target, fallbackTargetPoint, out var point2, out var multiplier) && IsFiniteVector(point2) && IsPointNearTargetBounds(target, point2, 3.5f)) { weakspotMultiplier = multiplier; float num = Mathf.Clamp01(DeadeyeInstinctPlugin.HardLockWeakspotBias.Value); Vector3 val = Vector3.Lerp(fallbackTargetPoint, point2, num); if (IsFiniteVector(val) && IsPointNearTargetBounds(target, val, 3.5f)) { point = val; } } return true; } private static Vector3 GetFallbackTargetPoint(Unit target) { //IL_000d: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00be: 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_0090: 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_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) //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0069: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return Vector3.zero; } try { if (MethodGetPositionToAimAt != null) { object obj = MethodGetPositionToAimAt.Invoke(target, null); if (obj is Vector3) { Vector3 val = (Vector3)obj; if (IsFiniteVector(val) && IsPointNearTargetBounds(target, val, 2.5f)) { return val; } } } } catch { } try { if ((Object)(object)target.mainCollider != (Object)null) { Bounds bounds = target.mainCollider.bounds; return ((Bounds)(ref bounds)).center; } } catch { } return ((Component)target).transform.position + Vector3.up; } private static bool IsFiniteVector(Vector3 value) { //IL_0001: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0042: Unknown result type (might be due to invalid IL or missing references) return !float.IsNaN(value.x) && !float.IsInfinity(value.x) && !float.IsNaN(value.y) && !float.IsInfinity(value.y) && !float.IsNaN(value.z) && !float.IsInfinity(value.z); } private static bool IsPointNearTargetBounds(Unit target, Vector3 point, float padding) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_007b: 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) //IL_003d: 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) if ((Object)(object)target == (Object)null || !IsFiniteVector(point)) { return false; } try { if ((Object)(object)target.mainCollider != (Object)null) { Bounds bounds = target.mainCollider.bounds; ((Bounds)(ref bounds)).Expand(Mathf.Max(0.1f, padding)); return ((Bounds)(ref bounds)).Contains(point); } } catch { } try { return Vector3.Distance(((Component)target).transform.position + Vector3.up, point) <= Mathf.Max(2f, padding); } catch { return false; } } private static bool TryGetBestWeakspotCenterPoint(Unit target, Vector3 referenceWorldPoint, out Vector3 point, out float multiplier) { //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) point = Vector3.zero; multiplier = 0f; Hitmesh[] array = null; try { array = ((Component)target).GetComponentsInChildren(true); } catch { return false; } if (array == null || array.Length == 0) { return false; } bool flag = false; Vector3 val = Vector3.zero; float num = 0f; float num2 = float.MaxValue; int num3 = -1; foreach (Hitmesh val2 in array) { if ((Object)(object)val2 == (Object)null || val2.hitShapes == null || val2.hitShapes.Length == 0 || ((Object)(object)val2.owner != (Object)null && (Object)(object)val2.owner != (Object)(object)target)) { continue; } for (int j = 0; j < val2.hitShapes.Length; j++) { Data val3 = val2.hitShapes[j]; if (((Data)(ref val3)).isInvulnerable) { continue; } float shapeMultiplier = ((Data)(ref val3)).GetShapeMultiplier(); if (!(shapeMultiplier <= 0f) && TryGetShapeCenterPoint(val2, val3.shapeId, referenceWorldPoint, out var point2, out var distanceSqr)) { int partPriority = GetPartPriority(((ShapeId)(ref val3.shapeId)).part); if (!flag || shapeMultiplier > num + 0.0001f || (Mathf.Abs(shapeMultiplier - num) <= 0.0001f && partPriority > num3) || (Mathf.Abs(shapeMultiplier - num) <= 0.0001f && partPriority == num3 && distanceSqr < num2)) { flag = true; num = shapeMultiplier; num3 = partPriority; num2 = distanceSqr; val = point2; multiplier = shapeMultiplier; } } } } if (!flag) { return false; } point = val; return true; } private static bool TryGetShapeCenterPoint(Hitmesh hitmesh, ShapeId shapeId, Vector3 referenceWorldPoint, out Vector3 point, out float distanceSqr) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_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) //IL_00d3: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) point = Vector3.zero; distanceSqr = float.MaxValue; if ((Object)(object)hitmesh == (Object)null || (int)((ShapeId)(ref shapeId)).part == 0) { return false; } try { HitboxColliders loadedHitboxColliders = StaticInstance.Instance.loadedHitboxColliders; if ((Object)(object)loadedHitboxColliders == (Object)null || !loadedHitboxColliders.runtimeHitmeshData.IsCreated || !loadedHitboxColliders.runtimeVertexData.IsCreated) { return false; } int hitboxFrameIndex = hitmesh.hitboxFrameIndex; if (hitboxFrameIndex < 0 || hitboxFrameIndex >= loadedHitboxColliders.runtimeHitmeshData.Length) { return false; } RuntimeHitboxData val = loadedHitboxColliders.runtimeHitmeshData[hitboxFrameIndex]; Vector3 val2 = ((Component)hitmesh).transform.InverseTransformPoint(referenceWorldPoint); Vector3 val7 = default(Vector3); for (int i = 0; i < val.shapes.Length; i++) { ShapeData val3 = val.shapes[i]; if (val3.shapeId != shapeId) { continue; } int length = val3.length; if (length <= 1) { return false; } Vector2 val4 = Vector2.zero; int num = 0; for (int j = 0; j < length; j++) { int num2 = val3.index + j; if (num2 < 0 || num2 >= loadedHitboxColliders.runtimeVertexData.Length) { return false; } float2 val5 = loadedHitboxColliders.runtimeVertexData[num2]; val4 += new Vector2(val5.x, val5.y); num++; } if (num <= 0) { return false; } Vector2 val6 = val4 / (float)num; ((Vector3)(ref val7))..ctor(val6.x, val6.y, val2.z); point = ((Component)hitmesh).transform.TransformPoint(val7); if (!IsFiniteVector(point)) { return false; } Vector3 val8 = point - referenceWorldPoint; distanceSqr = ((Vector3)(ref val8)).sqrMagnitude; return true; } } catch { return false; } return false; } private static int GetPartPriority(Parts part) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 if ((int)part == 2) { return 30; } if ((int)part == 4) { return 20; } if ((int)part == 3) { return 10; } return 0; } private static bool HasLineOfSight(Camera camera, Unit target, Vector3 point, float distance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)camera == (Object)null || (Object)(object)target == (Object)null) { return false; } Vector3 position = ((Component)camera).transform.position; Vector3 val = point - position; if (((Vector3)(ref val)).sqrMagnitude <= 1E-06f) { return false; } try { float num = Mathf.Max(0.01f, distance); return !Physics.Raycast(position, ((Vector3)(ref val)).normalized, num, LayerMask.op_Implicit(StaticInstance.Instance.geometryLayer)); } catch { return false; } } } internal static class WeaponLateUpdatePatch { private sealed class AutoFireState { public bool Controlled; public bool PulseDown; public float PulseEndTime; public float NextPulseTime; } private static readonly Dictionary AutoFireStates = new Dictionary(); private static readonly FieldInfo FieldBOwnerIsNpc = AccessTools.Field(typeof(Holdable), "bOwnerIsNpc"); private static readonly FieldInfo FieldIsReloading = AccessTools.Field(typeof(Weapon), "isReloading"); private static readonly FieldInfo FieldBIsOnCooldown = AccessTools.Field(typeof(Weapon), "bIsOnCooldown"); private static readonly PropertyInfo PropertyIsFullAutoEnabled = AccessTools.Property(typeof(Weapon), "IsFullAutoEnabled"); public static void Prefix(Weapon __instance) { if (!((Object)(object)__instance == (Object)null)) { if (!ShouldAutoFire(__instance)) { ReleaseTrigger(__instance); } else if (IsFullAuto(__instance) || !DeadeyeInstinctPlugin.AutoFireRespectSemiAuto.Value) { MarkControlled(__instance); ((Holdable)__instance).SetTrigger(true); } else { PulseSemiAuto(__instance); } } } private static bool ShouldAutoFire(Weapon weapon) { if (!DeadeyeInstinctPlugin.EnableMod.Value || !DeadeyeInstinctPlugin.EnableAutoFire.Value) { return false; } if (!DeadeyeInstinctPlugin.IsAimbotRuntimeEnabled()) { return false; } if (DeadeyeInstinctPlugin.AutoFireOnlyInHardLock.Value && DeadeyeInstinctPlugin.ActiveMode() != AssistMode.HardLock) { return false; } if (IsNpcWeapon(weapon)) { return false; } HardLockController.HardLockTargetState currentState = HardLockController.CurrentState; if (!currentState.HasTarget || (Object)(object)currentState.Target == (Object)null) { return false; } if (DeadeyeInstinctPlugin.AutoFireRequireAligned.Value && !currentState.IsAligned) { return false; } if (DeadeyeInstinctPlugin.AutoFireRequireWeaponReady.Value && !IsWeaponReady(weapon)) { return false; } return true; } private static bool IsNpcWeapon(Weapon weapon) { try { object obj = FieldBOwnerIsNpc?.GetValue(weapon); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return true; } } private static bool IsWeaponReady(Weapon weapon) { try { bool flag = default(bool); int num; if (FieldIsReloading != null) { object value = FieldIsReloading.GetValue(weapon); if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return false; } bool flag2 = default(bool); int num2; if (FieldBIsOnCooldown != null) { object value = FieldBIsOnCooldown.GetValue(weapon); if (value is bool) { flag2 = (bool)value; num2 = 1; } else { num2 = 0; } } else { num2 = 0; } if (((uint)num2 & (flag2 ? 1u : 0u)) != 0) { return false; } } catch { return true; } return true; } private static bool IsFullAuto(Weapon weapon) { try { if (PropertyIsFullAutoEnabled != null) { object value = PropertyIsFullAutoEnabled.GetValue(weapon, null); if (value is bool) { bool result = (bool)value; if (true) { return result; } } } } catch { } return false; } private static void PulseSemiAuto(Weapon weapon) { if (!AutoFireStates.TryGetValue(weapon, out var value)) { value = new AutoFireState(); AutoFireStates[weapon] = value; } value.Controlled = true; float unscaledTime = Time.unscaledTime; if (value.PulseDown) { if (unscaledTime >= value.PulseEndTime) { ((Holdable)weapon).SetTrigger(false); value.PulseDown = false; value.NextPulseTime = unscaledTime + Mathf.Max(0.005f, DeadeyeInstinctPlugin.AutoFireReleaseSeconds.Value); } else { ((Holdable)weapon).SetTrigger(true); } } else if (unscaledTime < value.NextPulseTime) { ((Holdable)weapon).SetTrigger(false); } else { ((Holdable)weapon).SetTrigger(true); value.PulseDown = true; value.PulseEndTime = unscaledTime + Mathf.Max(0.005f, DeadeyeInstinctPlugin.AutoFirePulseSeconds.Value); } } private static void MarkControlled(Weapon weapon) { if (!AutoFireStates.TryGetValue(weapon, out var value)) { value = new AutoFireState(); AutoFireStates[weapon] = value; } value.Controlled = true; } private static void ReleaseTrigger(Weapon weapon) { if (AutoFireStates.TryGetValue(weapon, out var value) && value.Controlled) { try { ((Holdable)weapon).SetTrigger(false); } catch { } value.Controlled = false; value.PulseDown = false; value.PulseEndTime = 0f; value.NextPulseTime = Time.unscaledTime; } } } internal static class CameraRecoilLateUpdatePatch { private static readonly FieldInfo FieldExtendedCameraController = AccessTools.Field(typeof(CameraRecoil), "extendedCameraController"); private static readonly Dictionary InsertRotationMethods = new Dictionary(); private static readonly Dictionary RotateTowardPositionMethods = new Dictionary(); private static readonly Dictionary RotateTowardDirectionMethods = new Dictionary(); public static void Postfix(CameraRecoil __instance) { HardLockController.ApplyImmediateRecoilCompensation(__instance); } internal static object GetExtendedCameraController(Camera camera) { if ((Object)(object)camera == (Object)null) { return null; } try { ExtendedCameraController componentInParent = ((Component)camera).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { return componentInParent; } } catch { } return null; } internal static object GetExtendedCameraController(CameraRecoil recoil) { if ((Object)(object)recoil == (Object)null || FieldExtendedCameraController == null) { return null; } try { return FieldExtendedCameraController.GetValue(recoil); } catch { return null; } } internal static void RotateTowardPosition(object cameraController, Vector3 targetPoint) { //IL_0011: 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_001d: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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) if (cameraController == null) { return; } Vector3 val = targetPoint - ((Component)cameraController).transform.position; if (((Vector3)(ref val)).sqrMagnitude <= 1E-06f) { return; } Type type = cameraController.GetType(); if (!RotateTowardPositionMethods.TryGetValue(type, out var value)) { value = AccessTools.Method(type, "RotateTowardPosition", new Type[2] { typeof(Vector3), typeof(float) }, (Type[])null); RotateTowardPositionMethods[type] = value; } try { if (value != null) { value.Invoke(cameraController, new object[2] { targetPoint, 0f }); return; } } catch { } if (!RotateTowardDirectionMethods.TryGetValue(type, out var value2)) { value2 = AccessTools.Method(type, "RotateTowardDirection", new Type[2] { typeof(Vector3), typeof(float) }, (Type[])null); RotateTowardDirectionMethods[type] = value2; } try { if (value2 != null) { value2.Invoke(cameraController, new object[2] { ((Vector3)(ref val)).normalized, 0f }); } } catch { } } internal static void InsertRotationValue(object cameraController, Vector2 delta) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (cameraController == null || ((Vector2)(ref delta)).sqrMagnitude <= 1E-06f) { return; } Type type = cameraController.GetType(); if (!InsertRotationMethods.TryGetValue(type, out var value)) { value = AccessTools.Method(type, "InsertRotationValue", new Type[1] { typeof(Vector2) }, (Type[])null); InsertRotationMethods[type] = value; } if (value == null) { return; } try { value.Invoke(cameraController, new object[1] { delta }); } catch { } } } internal sealed class WeakspotDebugOverlayController : MonoBehaviour { private sealed class OverlayLine { public LineRenderer Renderer; public int LastSeenFrame; } private struct WeakspotShapePolygon { public string Key; public float Multiplier; public Vector3[] Vertices; } private readonly Dictionary overlays = new Dictionary(); private readonly List workingShapes = new List(); private Material lineMaterial; private void LateUpdate() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Invalid comparison between Unknown and I4 if (!IsEnabled()) { ClearAll(); return; } EnsureMaterial(); workingShapes.Clear(); if (SafeBool(DeadeyeInstinctPlugin.WeakspotDebugOnlyTrackedTarget, fallback: true)) { Unit currentTrackedTargetForDebug = AimAssistLateUpdatePatch.CurrentTrackedTargetForDebug; if ((Object)(object)currentTrackedTargetForDebug != (Object)null) { CollectTargetShapes(currentTrackedTargetForDebug, workingShapes); } } else { Unit[] array = Object.FindObjectsOfType(); foreach (Unit val in array) { if (!((Object)(object)val == (Object)null) && (int)val.UnitState != 0) { CollectTargetShapes(val, workingShapes); } } } int frameCount = Time.frameCount; for (int j = 0; j < workingShapes.Count; j++) { WeakspotShapePolygon shape = workingShapes[j]; OverlayLine orCreateOverlay = GetOrCreateOverlay(shape.Key); orCreateOverlay.LastSeenFrame = frameCount; ApplyShapeToRenderer(orCreateOverlay.Renderer, shape); } CleanupStale(frameCount); } private bool IsEnabled() { return SafeBool(DeadeyeInstinctPlugin.EnableWeakspotDebugOverlay, fallback: false); } private void EnsureMaterial() { //IL_002f: 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_0042: Expected O, but got Unknown if (!((Object)(object)lineMaterial != (Object)null)) { Shader val = Shader.Find("Sprites/Default"); if (!((Object)(object)val == (Object)null)) { lineMaterial = new Material(val) { hideFlags = (HideFlags)61 }; } } } private OverlayLine GetOrCreateOverlay(string key) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown if (overlays.TryGetValue(key, out var value) && (Object)(object)value.Renderer != (Object)null) { return value; } GameObject val = new GameObject("WeakspotOverlay_" + key); ((Object)val).hideFlags = (HideFlags)61; val.transform.SetParent(((Component)this).transform, false); LineRenderer val2 = val.AddComponent(); val2.useWorldSpace = true; val2.loop = false; val2.alignment = (LineAlignment)0; val2.numCapVertices = 0; val2.numCornerVertices = 0; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; val2.textureMode = (LineTextureMode)0; ((Renderer)val2).material = lineMaterial; ((Renderer)val2).sortingOrder = 32767; value = new OverlayLine { Renderer = val2 }; overlays[key] = value; return value; } private void ApplyShapeToRenderer(LineRenderer line, WeakspotShapePolygon shape) { //IL_0054: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)line == (Object)null || shape.Vertices == null || shape.Vertices.Length < 2) { return; } float endWidth = (line.startWidth = SafeFloat(DeadeyeInstinctPlugin.WeakspotDebugLineWidth, 0.025f)); line.endWidth = endWidth; line.startColor = GetColorForMultiplier(shape.Multiplier); line.endColor = line.startColor; int num2 = shape.Vertices.Length; line.positionCount = num2 + 1; Camera val = (((Object)(object)AimAssistLateUpdatePatch.CurrentPlayerCameraForDebug != (Object)null) ? AimAssistLateUpdatePatch.CurrentPlayerCameraForDebug : Camera.main); float num3 = SafeFloat(DeadeyeInstinctPlugin.WeakspotDebugDepthOffset, 0.03f); Vector3 val3; for (int i = 0; i < num2; i++) { Vector3 val2 = shape.Vertices[i]; if ((Object)(object)val != (Object)null && num3 > 0f) { val3 = ((Component)val).transform.position - val2; Vector3 normalized = ((Vector3)(ref val3)).normalized; val2 += normalized * num3; } line.SetPosition(i, val2); } Vector3 val4 = shape.Vertices[0]; if ((Object)(object)val != (Object)null && num3 > 0f) { val3 = ((Component)val).transform.position - val4; Vector3 normalized2 = ((Vector3)(ref val3)).normalized; val4 += normalized2 * num3; } line.SetPosition(num2, val4); ((Renderer)line).enabled = true; } private void CollectTargetShapes(Unit target, List results) { //IL_00e1: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return; } Hitmesh[] componentsInChildren; try { componentsInChildren = ((Component)target).GetComponentsInChildren(true); } catch { return; } if (componentsInChildren == null || componentsInChildren.Length == 0) { return; } bool flag = SafeBool(DeadeyeInstinctPlugin.WeakspotDebugShowAllPositiveShapes, fallback: false); float num = SafeFloat(DeadeyeInstinctPlugin.WeakspotDebugMinimumMultiplier, 0.75f); List list = new List(); float num2 = 0f; foreach (Hitmesh val in componentsInChildren) { if ((Object)(object)val == (Object)null || val.hitShapes == null || val.hitShapes.Length == 0 || ((Object)(object)val.owner != (Object)null && (Object)(object)val.owner != (Object)(object)target)) { continue; } for (int j = 0; j < val.hitShapes.Length; j++) { Data val2 = val.hitShapes[j]; if (((Data)(ref val2)).isInvulnerable) { continue; } float shapeMultiplier = ((Data)(ref val2)).GetShapeMultiplier(); if (!(shapeMultiplier <= 0f) && (!flag || !(shapeMultiplier < num)) && TryGetShapeWorldPolygon(val, val2.shapeId, out var worldVertices) && worldVertices != null && worldVertices.Length >= 2) { list.Add(new WeakspotShapePolygon { Key = ((Object)target).GetInstanceID() + "_" + ((Object)val).GetInstanceID() + "_" + j, Multiplier = shapeMultiplier, Vertices = worldVertices }); if (shapeMultiplier > num2) { num2 = shapeMultiplier; } } } } if (flag) { results.AddRange(list); return; } for (int k = 0; k < list.Count; k++) { if (Mathf.Abs(list[k].Multiplier - num2) <= 0.0001f) { results.Add(list[k]); } } } private bool TryGetShapeWorldPolygon(Hitmesh hitmesh, ShapeId shapeId, out Vector3[] worldVertices) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) worldVertices = null; if ((Object)(object)hitmesh == (Object)null || (int)((ShapeId)(ref shapeId)).part == 0) { return false; } try { AsyncAssetLoading instance = StaticInstance.Instance; if ((Object)(object)instance == (Object)null) { return false; } HitboxColliders loadedHitboxColliders = instance.loadedHitboxColliders; if ((Object)(object)loadedHitboxColliders == (Object)null || !loadedHitboxColliders.runtimeHitmeshData.IsCreated || !loadedHitboxColliders.runtimeVertexData.IsCreated) { return false; } int hitboxFrameIndex = hitmesh.hitboxFrameIndex; if (hitboxFrameIndex < 0 || hitboxFrameIndex >= loadedHitboxColliders.runtimeHitmeshData.Length) { return false; } RuntimeHitboxData val = loadedHitboxColliders.runtimeHitmeshData[hitboxFrameIndex]; for (int i = 0; i < val.shapes.Length; i++) { ShapeData val2 = val.shapes[i]; if (val2.shapeId != shapeId) { continue; } int length = val2.length; if (length <= 1) { return false; } worldVertices = (Vector3[])(object)new Vector3[length]; for (int j = 0; j < length; j++) { int num = val2.index + j; if (num < 0 || num >= loadedHitboxColliders.runtimeVertexData.Length) { return false; } float2 val3 = loadedHitboxColliders.runtimeVertexData[num]; worldVertices[j] = ((Component)hitmesh).transform.TransformPoint(new Vector3(val3.x, val3.y, 0f)); } return true; } } catch { return false; } return false; } private Color GetColorForMultiplier(float multiplier) { //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_003d: 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_0065: 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_0062: Unknown result type (might be due to invalid IL or missing references) //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) if (multiplier >= 1.5f) { return Color.red; } if (multiplier >= 1f) { return new Color(1f, 0.5f, 0f, 1f); } if (multiplier >= 0.75f) { return Color.yellow; } return Color.white; } private void CleanupStale(int frame) { List list = null; foreach (KeyValuePair overlay in overlays) { OverlayLine value = overlay.Value; if (value == null || (Object)(object)value.Renderer == (Object)null) { if (list == null) { list = new List(); } list.Add(overlay.Key); } else if (value.LastSeenFrame != frame) { if ((Object)(object)value.Renderer != (Object)null) { Object.Destroy((Object)(object)((Component)value.Renderer).gameObject); } if (list == null) { list = new List(); } list.Add(overlay.Key); } } if (list != null) { for (int i = 0; i < list.Count; i++) { overlays.Remove(list[i]); } } } private void ClearAll() { foreach (KeyValuePair overlay in overlays) { if (overlay.Value != null && (Object)(object)overlay.Value.Renderer != (Object)null) { Object.Destroy((Object)(object)((Component)overlay.Value.Renderer).gameObject); } } overlays.Clear(); } private static bool SafeBool(ConfigEntry entry, bool fallback) { return entry?.Value ?? fallback; } private static float SafeFloat(ConfigEntry entry, float fallback) { return entry?.Value ?? fallback; } }