using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.UI; using Zorro.Core; using Zorro.Core.Serizalization; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("youxia173")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.7.0")] [assembly: AssemblyInformationalVersion("1.3.7")] [assembly: AssemblyProduct("RescueClawAimLock")] [assembly: AssemblyTitle("youxia173.RescueClawAimLock")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.7.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RescueClawAimLock { internal static class AimLock { private static Character? _locked; private static int _characterLayer = -1; internal static Character? Locked => _locked; internal static void Clear() { _locked = null; } internal static bool TryGetLockedTarget(RescueHook hook, out Character target) { target = null; if ((Object)(object)hook == (Object)null) { return false; } Character playerHoldingItem = hook.playerHoldingItem; if ((Object)(object)playerHoldingItem == (Object)null || !playerHoldingItem.IsLocal) { Clear(); return false; } if (!Plugin.IsAimLockHeld()) { Clear(); return false; } Camera val = (((Object)(object)MainCamera.instance != (Object)null) ? MainCamera.instance.cam : null); if ((Object)(object)val == (Object)null) { Clear(); return false; } float teammateRange = GetTeammateRange(hook, val); if ((Object)(object)_locked != (Object)null && !IsStillLocked(_locked, playerHoldingItem, teammateRange)) { Clear(); } if ((Object)(object)_locked == (Object)null) { _locked = FindBestTarget(playerHoldingItem, val, teammateRange); } if ((Object)(object)_locked == (Object)null) { return false; } target = _locked; return true; } internal static bool TryMakeHit(Character target, RescueHook hook, out RaycastHit hit, out Vector3 endFire) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_004f: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_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_005e: 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_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00c9: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_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_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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) hit = default(RaycastHit); endFire = target.Center; Camera val = (((Object)(object)MainCamera.instance != (Object)null) ? MainCamera.instance.cam : null); Vector3 val2 = (((Object)(object)val != (Object)null) ? ((Component)val).transform.position : ((Component)hook).transform.position); Vector3 liveAimPoint = GetLiveAimPoint(target); Vector3 val3 = liveAimPoint - val2; float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude < 0.05f) { return false; } Vector3 val4 = val3 / magnitude; float rayLen = magnitude + 3f; if (TryHitTarget(val2, val4, rayLen, target, 1.25f, out hit)) { endFire = ((RaycastHit)(ref hit)).point; return true; } if (TryHitTarget(val2, val4, rayLen, target, 0.45f, out hit)) { endFire = ((RaycastHit)(ref hit)).point; return true; } if (TryOverlapTarget(liveAimPoint, target, val2, out hit)) { endFire = ((RaycastHit)(ref hit)).point; return true; } try { if (TryHitTarget(target.GetBodypart((BodypartType)2).Rig.worldCenterOfMass - val4 * 0.4f, val4, 1.2f, target, 0.2f, out hit)) { endFire = ((RaycastHit)(ref hit)).point; return true; } } catch { } return false; } private static bool TryHitTarget(Vector3 origin, Vector3 dir, float rayLen, Character target, float radius, out RaycastHit hit) { //IL_0002: 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_0016: 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_0051: 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_005c: 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_00d6: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) hit = default(RaycastHit); EnsureCharacterLayer(); int num = ((_characterLayer >= 0) ? ((1 << _characterLayer) | LayerMask.op_Implicit(HelperFunctions.GetMask((LayerType)7))) : LayerMask.op_Implicit(HelperFunctions.GetMask((LayerType)7))); RaycastHit[] obj = ((radius > 0.01f) ? Physics.SphereCastAll(origin, radius, dir, rayLen, num, (QueryTriggerInteraction)1) : Physics.RaycastAll(origin, dir, rayLen, num, (QueryTriggerInteraction)1)); RaycastHit val = default(RaycastHit); float num2 = float.MaxValue; RaycastHit[] array = obj; Character val3 = default(Character); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; if (!((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null) && CharacterRagdoll.TryGetCharacterFromCollider(((RaycastHit)(ref val2)).collider, ref val3) && !((Object)(object)val3 != (Object)(object)target) && ((RaycastHit)(ref val2)).distance < num2) { num2 = ((RaycastHit)(ref val2)).distance; val = val2; } } if ((Object)(object)((RaycastHit)(ref val)).collider == (Object)null) { return false; } hit = val; return true; } private static Character? FindBestTarget(Character holder, Camera cam, float maxRange) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0050: 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_0057: 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) float num = Plugin.AimLockFov.Value; Character result = null; Vector3 position = ((Component)cam).transform.position; Vector3 forward = ((Component)cam).transform.forward; foreach (Character allCharacter in Character.AllCharacters) { if (IsValidTarget(allCharacter, holder, cam, maxRange)) { Vector3 val = allCharacter.Center - position; float num2 = Vector3.Angle(forward, val); if (!(num2 > num)) { num = num2; result = allCharacter; } } } return result; } internal static Vector3 GetLiveAimPoint(Character target) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_001f: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target.Center; try { Rigidbody rig = target.GetBodypart((BodypartType)2).Rig; if ((Object)(object)rig != (Object)null) { val += rig.linearVelocity * 0.08f; } } catch { } return val; } private static bool IsStillLocked(Character ch, Character holder, float maxRange) { //IL_0030: 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) if ((Object)(object)ch == (Object)null || (Object)(object)ch == (Object)(object)holder || (Object)(object)ch.data == (Object)null || ch.data.dead) { return false; } float num = Vector3.Distance(holder.Center, ch.Center); if (num >= 0.15f) { return num <= maxRange; } return false; } private static bool IsValidTarget(Character ch, Character holder, Camera cam, float maxRange) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) if ((Object)(object)ch == (Object)null || (Object)(object)ch == (Object)(object)holder || (Object)(object)ch.data == (Object)null || ch.data.dead) { return false; } Vector3 val = ch.Center - ((Component)cam).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > maxRange || magnitude < 0.2f) { return false; } if (cam.WorldToScreenPoint(ch.Center).z <= 0f) { return false; } return Vector3.Angle(((Component)cam).transform.forward, val) <= Plugin.AimLockFov.Value; } private static bool TryOverlapTarget(Vector3 dest, Character target, Vector3 origin, out RaycastHit hit) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0074: 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_008b: 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_0093: Unknown result type (might be due to invalid IL or missing references) hit = default(RaycastHit); EnsureCharacterLayer(); int num = ((_characterLayer >= 0) ? (1 << _characterLayer) : LayerMask.op_Implicit(HelperFunctions.GetMask((LayerType)6))); Collider[] array = (Collider[])(object)new Collider[24]; int num2 = Physics.OverlapSphereNonAlloc(dest, 1.6f, array, num, (QueryTriggerInteraction)1); Character val2 = default(Character); for (int i = 0; i < num2; i++) { Collider val = array[i]; if (!((Object)(object)val == (Object)null) && CharacterRagdoll.TryGetCharacterFromCollider(val, ref val2) && !((Object)(object)val2 != (Object)(object)target)) { Vector3 val3 = val.ClosestPoint(origin) - origin; if (!(((Vector3)(ref val3)).sqrMagnitude < 0.0001f) && val.Raycast(new Ray(origin, ((Vector3)(ref val3)).normalized), ref hit, ((Vector3)(ref val3)).magnitude + 2f)) { return true; } } } return false; } private static float GetTeammateRange(RescueHook hook, Camera cam) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (!(Vector3.Dot(((Component)cam).transform.forward, Vector3.up) < 0f)) { return hook.range; } return hook.rangeDownward; } private static void EnsureCharacterLayer() { if (_characterLayer < 0) { _characterLayer = LayerMask.NameToLayer("Character"); } } } internal static class AimLockHud { private static Material? _mat; private static Texture2D? _pixel; private static GUIStyle? _hintStyle; internal static void Draw() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0068: 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_008e: 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_00e3: Unknown result type (might be due to invalid IL or missing references) if (Event.current == null || (int)Event.current.type != 7) { return; } Camera cam = null; if (Plugin.ShowFovRing.Value && ShouldDrawRing(out cam) && (Object)(object)cam != (Object)null) { float num = ScreenRadiusPixels(cam); if (num >= 8f) { Vector2 center = new Vector2((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); Color color = (((Object)(object)AimLock.Locked != (Object)null) ? new Color(Mathf.Clamp01((float)Plugin.LockColorR.Value / 255f), Mathf.Clamp01((float)Plugin.LockColorG.Value / 255f), Mathf.Clamp01((float)Plugin.LockColorB.Value / 255f), 0.95f) : new Color(1f, 1f, 1f, 0.72f)); DrawRing(center, num, color, 2.4f); } } DrawLockedName(); } private static void DrawLockedName() { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_017c: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.IsAimLockHeld()) { return; } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead) { return; } Item currentItem = localCharacter.data.currentItem; if ((Object)(object)currentItem == (Object)null || (Object)(object)((Component)currentItem).GetComponent() == (Object)null) { return; } Character locked = AimLock.Locked; if ((Object)(object)locked == (Object)null) { return; } EnsureHintStyle(); string text = L10n.LockedName(locked.characterName); float num = Mathf.Min((float)Screen.width * 0.72f, 720f); float num2 = ((float)Screen.width - num) * 0.5f; float num3 = 96f; if (ShouldDrawRing(out Camera cam) && Plugin.ShowFovRing.Value) { float num4 = ScreenRadiusPixels(cam); if (num4 > 8f) { num3 = Mathf.Max(num3, num4 + 22f); } } float num5 = (float)Screen.height * 0.5f - num3; Rect val = default(Rect); ((Rect)(ref val))..ctor(num2, num5, num, 40f); Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.7f); GUI.Label(new Rect(((Rect)(ref val)).x + 1f, ((Rect)(ref val)).y + 1f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, _hintStyle); GUI.color = new Color(0.92f, 1f, 0.92f, 0.98f); GUI.Label(val, text, _hintStyle); GUI.color = color; } private static void EnsureHintStyle() { //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_0039: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (_hintStyle != null) { _hintStyle.fontSize = Mathf.Clamp(Screen.height / 42, 15, 24); return; } _hintStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)1, wordWrap = true, fontSize = Mathf.Clamp(Screen.height / 42, 15, 24), fontStyle = (FontStyle)1 }; _hintStyle.normal.textColor = Color.white; } private static bool ShouldDrawRing(out Camera cam) { cam = null; if (!Application.isFocused || !Plugin.IsAimLockHeld()) { return false; } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead) { return false; } Item currentItem = localCharacter.data.currentItem; if ((Object)(object)currentItem == (Object)null || (Object)(object)((Component)currentItem).GetComponent() == (Object)null) { return false; } if ((Object)(object)MainCamera.instance == (Object)null || (Object)(object)MainCamera.instance.cam == (Object)null) { return false; } cam = MainCamera.instance.cam; return true; } private static float ScreenRadiusPixels(Camera cam) { //IL_0020: 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_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_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_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_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_004c: 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_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006b: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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) float num = Mathf.Clamp(Plugin.AimLockFov.Value, 0.5f, 45f); Vector3 position = ((Component)cam).transform.position; Vector3 forward = ((Component)cam).transform.forward; Vector3 val = Quaternion.AngleAxis(num, ((Component)cam).transform.up) * forward; Vector3 val2 = cam.WorldToScreenPoint(position + forward * 25f); Vector3 val3 = cam.WorldToScreenPoint(position + val * 25f); if (val2.z <= 0f || val3.z <= 0f) { return Mathf.Tan(num * (MathF.PI / 180f)) / Mathf.Tan(cam.fieldOfView * 0.5f * (MathF.PI / 180f)) * ((float)Screen.height * 0.5f); } return Vector2.Distance(new Vector2(val2.x, val2.y), new Vector2(val3.x, val3.y)); } private static void DrawRing(Vector2 center, float radius, Color color, float thickness) { //IL_004e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_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_00be: 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_00c4: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) EnsureMat(); if ((Object)(object)_mat == (Object)null) { DrawRingGui(center, radius, color, thickness); return; } _mat.SetPass(0); GL.PushMatrix(); GL.LoadPixelMatrix(0f, (float)Screen.width, 0f, (float)Screen.height); GL.Begin(7); GL.Color(color); Vector2 val = default(Vector2); Vector2 val2 = default(Vector2); for (int i = 0; i < 72; i++) { float num = (float)i / 72f * MathF.PI * 2f; float num2 = (float)(i + 1) / 72f * MathF.PI * 2f; ((Vector2)(ref val))..ctor(Mathf.Cos(num), Mathf.Sin(num)); ((Vector2)(ref val2))..ctor(Mathf.Cos(num2), Mathf.Sin(num2)); Vector2 val3 = center + val * (radius - thickness); Vector2 val4 = center + val2 * (radius - thickness); Vector2 val5 = center + val * (radius + thickness); Vector2 val6 = center + val2 * (radius + thickness); GL.Vertex3(val3.x, val3.y, 0f); GL.Vertex3(val5.x, val5.y, 0f); GL.Vertex3(val6.x, val6.y, 0f); GL.Vertex3(val4.x, val4.y, 0f); } GL.End(); GL.PopMatrix(); } private static void DrawRingGui(Vector2 center, float radius, Color color, float thickness) { //IL_0042: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00bc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_pixel == (Object)null) { _pixel = new Texture2D(1, 1, (TextureFormat)4, false); _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); ((Object)_pixel).hideFlags = (HideFlags)61; } Color color2 = GUI.color; GUI.color = color; float num = (float)Screen.height - center.y; for (int i = 0; i < 64; i++) { float num2 = (float)i / 64f * MathF.PI * 2f; float num3 = center.x + Mathf.Cos(num2) * radius; float num4 = num - Mathf.Sin(num2) * radius; GUI.DrawTexture(new Rect(num3 - thickness, num4 - thickness, thickness * 2f, thickness * 2f), (Texture)(object)_pixel); } GUI.color = color2; } private static void EnsureMat() { //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_004a: Expected O, but got Unknown if (!((Object)(object)_mat != (Object)null)) { Shader val = Shader.Find("Hidden/Internal-Colored"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Sprites/Default"); } if (!((Object)(object)val == (Object)null)) { _mat = new Material(val) { hideFlags = (HideFlags)61 }; _mat.SetInt("_SrcBlend", 5); _mat.SetInt("_DstBlend", 10); _mat.SetInt("_Cull", 0); _mat.SetInt("_ZWrite", 0); _mat.SetInt("_ZTest", 8); } } } } internal static class AimLockPrompt { private static GameObject? _root; private static TextMeshProUGUI? _label; private static TextMeshProUGUI? _iconTmp; private static GameObject? _iconGo; private static Transform? _parent; private static KeyCode _shownKey = (KeyCode)(-1); private static string _shownLabel = ""; internal static void Refresh() { //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_0088: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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) if (!Plugin.ShowAimLockPrompt.Value || !ShouldShow()) { Hide(); } else if (EnsurePrompt()) { string text = ActionLabel(); KeyCode value = Plugin.AimLockKey.Value; if ((Object)(object)_label != (Object)null && (_shownLabel != text || ((TMP_Text)_label).text != text)) { _shownLabel = text; ((TMP_Text)_label).text = text; ((TMP_Text)_label).ForceMeshUpdate(true, false); } if ((Object)(object)_iconTmp != (Object)null && (_shownKey != value || string.IsNullOrEmpty(((TMP_Text)_iconTmp).text))) { _shownKey = value; ApplyIconSpriteAsset(_iconTmp); ((TMP_Text)_iconTmp).text = GlyphForKey(value); ((TMP_Text)_iconTmp).ForceMeshUpdate(true, false); } if ((Object)(object)_root != (Object)null && !_root.activeSelf) { _root.SetActive(true); } if ((Object)(object)_iconGo != (Object)null && (Object)(object)_iconGo != (Object)(object)_root && !_iconGo.activeSelf) { _iconGo.SetActive(true); } } } private static bool ShouldShow() { if (!Application.isFocused) { return false; } try { if (GUIManager.InPauseMenu) { return false; } } catch { } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead) { return false; } if ((Object)(object)Character.observedCharacter != (Object)null && (Object)(object)Character.observedCharacter != (Object)(object)localCharacter) { return false; } Item currentItem = localCharacter.data.currentItem; if ((Object)(object)currentItem != (Object)null) { return (Object)(object)((Component)currentItem).GetComponent() != (Object)null; } return false; } private static bool EnsurePrompt() { //IL_0253: Unknown result type (might be due to invalid IL or missing references) GUIManager instance = GUIManager.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.itemPromptMain == (Object)null) { Clear(); return false; } Transform parent = ((TMP_Text)instance.itemPromptMain).transform.parent; if ((Object)(object)_root != (Object)null && (Object)(object)_label != (Object)null && (Object)(object)_parent == (Object)(object)parent && Object.op_Implicit((Object)(object)_root)) { return true; } Clear(); _parent = parent; _root = Object.Instantiate(((Component)instance.itemPromptMain).gameObject, parent, false); ((Object)_root).name = "RescueClawAimLock_Prompt"; _label = _root.GetComponent(); if ((Object)(object)_label == (Object)null) { _label = _root.GetComponentInChildren(true); } if ((Object)(object)_label == (Object)null) { Clear(); return false; } DisableLocalizedAuto(_root); InputIcon val = _root.GetComponentInChildren(true); if ((Object)(object)val == (Object)null) { InputIcon val2 = FindVanillaUsePrimaryIcon(instance); if ((Object)(object)val2 != (Object)null) { _iconGo = Object.Instantiate(((Component)val2).gameObject, parent, false); ((Object)_iconGo).name = "RescueClawAimLock_PromptIcon"; val = _iconGo.GetComponent(); } } else { _iconGo = ((Component)val).gameObject; } if ((Object)(object)val != (Object)null) { _iconTmp = ((Component)val).GetComponent(); if ((Object)(object)_iconTmp == (Object)null) { _iconTmp = ((Component)val).GetComponentInChildren(true); } ((Behaviour)val).enabled = false; DisableLocalizedAuto(((Component)val).gameObject); } TextMeshProUGUI[] componentsInChildren = _root.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (!((Object)(object)componentsInChildren[i] == (Object)(object)_label) && (!((Object)(object)_iconTmp != (Object)null) || !((Object)(object)componentsInChildren[i] == (Object)(object)_iconTmp)) && !((Object)(object)((Component)componentsInChildren[i]).GetComponentInParent() != (Object)null)) { ((Component)componentsInChildren[i]).gameObject.SetActive(false); } } CopyPromptStyle(instance.itemPromptMain, _label); ((TMP_Text)_label).richText = true; ((Graphic)_label).raycastTarget = false; ((TMP_Text)_label).text = ""; if ((Object)(object)_iconTmp != (Object)null) { ApplyIconSpriteAsset(_iconTmp); ((TMP_Text)_iconTmp).richText = true; ((Graphic)_iconTmp).raycastTarget = false; } _shownKey = (KeyCode)(-1); _shownLabel = ""; int num = ((TMP_Text)instance.itemPromptMain).transform.GetSiblingIndex() + 1; InputIcon val3 = FindVanillaUsePrimaryIcon(instance); if ((Object)(object)val3 != (Object)null && (Object)(object)((Component)val3).transform.parent == (Object)(object)parent) { num = Mathf.Max(num, ((Component)val3).transform.GetSiblingIndex() + 1); } if ((Object)(object)instance.itemPromptSecondary != (Object)null && (Object)(object)((TMP_Text)instance.itemPromptSecondary).transform.parent == (Object)(object)parent) { num = Mathf.Max(num, ((TMP_Text)instance.itemPromptSecondary).transform.GetSiblingIndex() + 1); } _root.transform.SetSiblingIndex(num); if ((Object)(object)_iconGo != (Object)null && (Object)(object)_iconGo != (Object)(object)_root && (Object)(object)_iconGo.transform.parent == (Object)(object)parent) { _iconGo.transform.SetSiblingIndex(_root.transform.GetSiblingIndex() + 1); } _root.SetActive(true); if ((Object)(object)_iconGo != (Object)null) { _iconGo.SetActive(true); } return true; } private static InputIcon? FindVanillaUsePrimaryIcon(GUIManager gui) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //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_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) Transform parent = ((TMP_Text)gui.itemPromptMain).transform.parent; InputIcon componentInChildren = ((Component)gui.itemPromptMain).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { return componentInChildren; } InputIcon[] componentsInChildren = ((Component)parent).GetComponentsInChildren(true); InputIcon val = null; InputIcon val2 = null; float num = float.MaxValue; Vector3 position = ((TMP_Text)gui.itemPromptMain).transform.position; foreach (InputIcon val3 in componentsInChildren) { if (!((Object)(object)val3 == (Object)null)) { if ((int)val3.action == 2) { val = val3; } Vector3 val4 = ((Component)val3).transform.position - position; float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val2 = val3; } } } return val ?? val2; } private static void DisableLocalizedAuto(GameObject go) { LocalizedText[] componentsInChildren = go.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].autoSet = false; ((Behaviour)componentsInChildren[i]).enabled = false; } InLineInputPrompts[] componentsInChildren2 = go.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { ((Behaviour)componentsInChildren2[j]).enabled = false; } } private static void CopyPromptStyle(TextMeshProUGUI source, TextMeshProUGUI dest) { //IL_0050: 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_0074: 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) if ((Object)(object)((TMP_Text)source).font != (Object)null) { ((TMP_Text)dest).font = ((TMP_Text)source).font; } if ((Object)(object)((TMP_Text)source).fontSharedMaterial != (Object)null) { ((TMP_Text)dest).fontSharedMaterial = ((TMP_Text)source).fontSharedMaterial; } if ((Object)(object)((TMP_Text)source).spriteAsset != (Object)null) { ((TMP_Text)dest).spriteAsset = ((TMP_Text)source).spriteAsset; } ((TMP_Text)dest).alignment = ((TMP_Text)source).alignment; ((TMP_Text)dest).fontSize = ((TMP_Text)source).fontSize; ((Graphic)dest).color = ((Graphic)source).color; ((TMP_Text)dest).overflowMode = ((TMP_Text)source).overflowMode; ((TMP_Text)dest).margin = ((TMP_Text)source).margin; ((TMP_Text)dest).characterSpacing = ((TMP_Text)source).characterSpacing; ((TMP_Text)dest).wordSpacing = ((TMP_Text)source).wordSpacing; ((TMP_Text)dest).lineSpacing = ((TMP_Text)source).lineSpacing; } private static void ApplyIconSpriteAsset(TextMeshProUGUI tmp) { if ((Object)(object)((TMP_Text)tmp).spriteAsset != (Object)null) { return; } try { GUIManager instance = GUIManager.instance; InputIcon val = (((Object)(object)instance != (Object)null) ? FindVanillaUsePrimaryIcon(instance) : null); TextMeshProUGUI val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); if ((Object)(object)val2 == (Object)null && (Object)(object)val != (Object)null) { val2 = ((Component)val).GetComponentInChildren(true); } if ((Object)(object)((val2 != null) ? ((TMP_Text)val2).spriteAsset : null) != (Object)null) { ((TMP_Text)tmp).spriteAsset = ((TMP_Text)val2).spriteAsset; return; } object obj; if (instance == null) { obj = null; } else { TextMeshProUGUI itemPromptMain = instance.itemPromptMain; obj = ((itemPromptMain != null) ? ((TMP_Text)itemPromptMain).spriteAsset : null); } if ((Object)obj != (Object)null) { ((TMP_Text)tmp).spriteAsset = ((TMP_Text)instance.itemPromptMain).spriteAsset; } } catch { } } private static string GlyphForKey(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_00af: Expected I4, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected I4, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 //IL_0031: 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_0062: Expected I4, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Invalid comparison between Unknown and I4 //IL_01d6: 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_01bb: Invalid comparison between Unknown and I4 //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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: Expected I4, but got Unknown if ((int)key <= 57) { if ((int)key <= 13) { if ((int)key == 9) { return ""; } if ((int)key == 13) { return ""; } } else { if ((int)key == 27) { return ""; } if ((int)key == 32) { return ""; } switch (key - 48) { case 0: return ""; case 1: return ""; case 2: return ""; case 3: return ""; case 4: return ""; case 5: return ""; case 6: return ""; case 7: return ""; case 8: return ""; case 9: return ""; } } } else if ((int)key <= 113) { if ((int)key == 101) { return ""; } if ((int)key == 102) { return ""; } if ((int)key == 113) { return ""; } } else { if ((int)key == 114) { return ""; } switch (key - 303) { case 0: case 1: return ""; case 2: case 3: return ""; case 4: case 5: return ""; } switch (key - 323) { case 0: return ""; case 1: return ""; case 2: return ""; } } if ((int)key >= 97 && (int)key <= 122) { return $""; } return PrettyKey(key); } private static void Hide() { if ((Object)(object)_root != (Object)null && Object.op_Implicit((Object)(object)_root)) { _root.SetActive(false); } if ((Object)(object)_iconGo != (Object)null && (Object)(object)_iconGo != (Object)(object)_root) { _iconGo.SetActive(false); } } internal static void Clear() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_iconGo != (Object)null && (Object)(object)_iconGo != (Object)(object)_root) { Object.Destroy((Object)(object)_iconGo); } if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _root = null; _label = null; _iconTmp = null; _iconGo = null; _parent = null; _shownKey = (KeyCode)(-1); _shownLabel = ""; } private static string ActionLabel() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected I4, but got Unknown try { Language cURRENT_LANGUAGE = LocalizedText.CURRENT_LANGUAGE; return (cURRENT_LANGUAGE - 1) switch { 8 => "自瞄", 9 => "自瞄", 10 => "エイムロック", 11 => "조준 고정", 0 => "Visée", 2 => "Zielhilfe", 1 => "Mira", 3 => "Mira", 4 => "Mira", 5 => "Mira", 6 => "Прицел", 7 => "Приціл", 12 => "Celownik", 13 => "Nişan", _ => "Aim Lock", }; } catch { return "Aim Lock"; } } private unsafe static string PrettyKey(KeyCode key) { string text = ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString(); if (text.StartsWith("Alpha")) { return text.Substring(5); } if (text.StartsWith("Keypad")) { return "Num " + text.Substring(6); } switch (text) { case "Mouse0": return "LMB"; case "Mouse1": return "RMB"; case "Mouse2": return "MMB"; case "LeftControl": case "RightControl": return "Ctrl"; case "LeftShift": case "RightShift": return "Shift"; case "LeftAlt": case "RightAlt": return "Alt"; case "Return": return "Enter"; case "Escape": return "Esc"; default: return text; } } } [HarmonyPatch(typeof(GUIManager), "UpdateItemPrompts")] internal static class AimLockPromptPatch { private static void Postfix() { AimLockPrompt.Refresh(); } } internal static class AutoCarry { private static Character? _hookedTarget; private static Character? _carrier; private static Character? _activeCarried; private static float _expireAt; private static bool _didCarry; private static BackpackSlot? _swappedBackpack; private static readonly FieldInfo? HasBackpackField = AccessTools.Field(typeof(InventoryItemUI), "_hasBackpack"); private static readonly FieldInfo? DefaultElementColorField = AccessTools.Field(typeof(InventoryItemUI), "defaultElementColor"); private static bool _paintedCarryFrame; internal static void RememberHooked(Character carrier, Character target) { if (Plugin.AutoCarryAfterHook.Value && !((Object)(object)carrier == (Object)null) && !((Object)(object)target == (Object)null) && carrier.IsLocal) { _carrier = carrier; _hookedTarget = target; _didCarry = false; _activeCarried = null; _expireAt = Time.time + 30f; Plugin.Log.LogDebug((object)("AutoCarry: remembered hooked target " + target.characterName)); TryCarryNow(); } } internal static void ClearWait() { _hookedTarget = null; _carrier = null; _didCarry = false; _expireAt = 0f; } internal static bool IsOurConsciousCarry(Character carrier, Character carried) { if (Plugin.AutoCarryAfterHook.Value && (Object)(object)_activeCarried != (Object)null && (Object)(object)carrier != (Object)null && (Object)(object)carried != (Object)null && carrier == _carrier) { return carried == _activeCarried; } return false; } internal static void Tick() { if (!Plugin.AutoCarryAfterHook.Value) { ClearWait(); _activeCarried = null; return; } if ((Object)(object)_activeCarried != (Object)null) { Character carrier = _carrier; if ((Object)(object)carrier == (Object)null || (Object)(object)carrier.data == (Object)null || (Object)(object)carrier.data.carriedPlayer != (Object)(object)_activeCarried) { if (_swappedBackpack != null && (Object)(object)carrier != (Object)null) { TrySwapBackpackBack(carrier, _activeCarried); } _activeCarried = null; _carrier = null; _didCarry = false; } } if (!_didCarry && !((Object)(object)_hookedTarget == (Object)null) && !((Object)(object)_carrier == (Object)null)) { if (Time.time > _expireAt && !StillPullingTarget(_carrier, _hookedTarget)) { ClearWait(); } else { TryCarryNow(); } } } private static void TryCarryNow() { //IL_0089: 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) if (_didCarry || (Object)(object)_hookedTarget == (Object)null || (Object)(object)_carrier == (Object)null) { return; } Character carrier = _carrier; Character hookedTarget = _hookedTarget; if ((Object)(object)carrier.data == (Object)null || (Object)(object)hookedTarget.data == (Object)null) { return; } if ((Object)(object)carrier.data.carriedPlayer != (Object)null) { ClearWait(); } else { if (!IsEligiblePair(carrier, hookedTarget) || IsHoldingItem(hookedTarget)) { return; } float num = Plugin.AutoCarryRangeMeters.Value / CharacterStats.unitsToMeters; float num2 = Vector3.Distance(carrier.Center, hookedTarget.Center); if (num2 > num) { return; } try { if (BothHaveBackpacks(carrier, hookedTarget)) { TryDropOwnBackpackAtFeet(carrier); } else { TrySwapBackpackToTarget(carrier, hookedTarget); } carrier.refs.carriying.StartCarry(hookedTarget); _activeCarried = hookedTarget; _didCarry = true; _hookedTarget = null; _expireAt = 0f; Plugin.Log.LogInfo((object)$"AutoCarry: piggybacked hooked scout '{hookedTarget.characterName}' at {num2 * CharacterStats.unitsToMeters:0.0}m"); RefreshBackpackHotbar(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("AutoCarry StartCarry failed: " + ex.Message)); ClearWait(); _swappedBackpack = null; } } } private static bool IsHoldingItem(Character ch) { try { return (Object)(object)ch.data != (Object)null && (Object)(object)ch.data.currentItem != (Object)null; } catch { return false; } } private static bool StillPullingTarget(Character carrier, Character target) { try { CharacterData data = carrier.data; Item val = ((data != null) ? data.currentItem : null); RescueHook val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent() : null); return (Object)(object)val2 != (Object)null && val2.isPulling && (Object)(object)val2.targetPlayer == (Object)(object)target; } catch { return false; } } internal static bool BothHaveBackpacks(Character a, Character b) { if (HasBackpack(a)) { return HasBackpack(b); } return false; } private static bool IsEligiblePair(Character carrier, Character target) { if ((Object)(object)carrier == (Object)null || (Object)(object)target == (Object)null) { return false; } if (!carrier.IsLocal) { return false; } if ((Object)(object)carrier.data == (Object)null || (Object)(object)target.data == (Object)null) { return false; } if (carrier.data.dead || carrier.data.fullyPassedOut) { return false; } if (target.data.dead) { return false; } if ((Object)(object)target.data.carrier != (Object)null) { return false; } if ((Object)(object)carrier.data.carriedPlayer != (Object)null) { return false; } if (target.isBot) { return false; } return true; } internal static bool HasBackpack(Character ch) { try { return (Object)(object)ch.player != (Object)null && ch.player.backpackSlot != null && !((ItemSlot)ch.player.backpackSlot).IsEmpty(); } catch { return false; } } private static void TryDropOwnBackpackAtFeet(Character carrier) { //IL_0050: 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_0078: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((carrier != null) ? carrier.player : null) == (Object)null) && carrier.player.backpackSlot != null && !((ItemSlot)carrier.player.backpackSlot).IsEmpty() && !((Object)(object)carrier.refs?.view == (Object)null)) { Vector3 feetDropPosition = GetFeetDropPosition(carrier); carrier.refs.view.RPC("DropItemFromSlotRPC", (RpcTarget)0, new object[2] { (byte)3, feetDropPosition }); Plugin.Log.LogDebug((object)"AutoCarry: dropped own backpack at feet (both had packs)"); } } private static Vector3 GetFeetDropPosition(Character carrier) { //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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_002a: 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_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_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) try { Bodypart bodypart = carrier.GetBodypart((BodypartType)13); Bodypart bodypart2 = carrier.GetBodypart((BodypartType)16); if ((Object)(object)bodypart != (Object)null && (Object)(object)bodypart2 != (Object)null) { return (bodypart.transform.position + bodypart2.transform.position) * 0.5f + Vector3.up * 0.2f; } } catch { } try { return carrier.GetBodypart((BodypartType)0).transform.position + Vector3.down * 0.45f; } catch { return carrier.Center + Vector3.down * 0.9f; } } private static void TrySwapBackpackToTarget(Character carrier, Character target) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown _swappedBackpack = null; if (!((Object)(object)((carrier != null) ? carrier.player : null) == (Object)null) && !((Object)(object)((target != null) ? target.player : null) == (Object)null)) { BackpackSlot backpackSlot = carrier.player.backpackSlot; if (!((ItemSlot)backpackSlot).IsEmpty() && ((ItemSlot)target.player.backpackSlot).IsEmpty()) { target.player.backpackSlot = backpackSlot; carrier.player.backpackSlot = new BackpackSlot((byte)3); SyncInventory(carrier); SyncInventory(target); _swappedBackpack = backpackSlot; Plugin.Log.LogDebug((object)"AutoCarry: swapped backpack onto carried scout (Piggyback-style)"); } } } internal static void TrySwapBackpackBack(Character carrier, Character? target) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown if (_swappedBackpack == null || (Object)(object)carrier == (Object)null || !carrier.IsLocal) { return; } try { if ((Object)(object)carrier.player == (Object)null) { _swappedBackpack = null; } else if (!((ItemSlot)carrier.player.backpackSlot).IsEmpty()) { _swappedBackpack = null; } else if ((Object)(object)((target != null) ? target.player : null) == (Object)null) { _swappedBackpack = null; } else if (((ItemSlot)target.player.backpackSlot).IsEmpty()) { if (!PlayerHandler.GetAllPlayers().Any((Player p) => IsSameBackpack(p.backpackSlot, _swappedBackpack))) { try { ((ItemSlot)_swappedBackpack).prefab.Interact(carrier); } catch { } } _swappedBackpack = null; } else { BackpackSlot backpackSlot = target.player.backpackSlot; carrier.player.backpackSlot = backpackSlot; target.player.backpackSlot = new BackpackSlot((byte)3); SyncInventory(target); SyncInventory(carrier); Plugin.Log.LogDebug((object)"AutoCarry: restored backpack after drop"); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("AutoCarry backpack restore failed: " + ex.Message)); } finally { _swappedBackpack = null; RefreshBackpackHotbar(); } } private static bool IsSameBackpack(BackpackSlot a, BackpackSlot? b) { if (b == null) { return false; } if (a != b) { if (((ItemSlot)a).data != null && ((ItemSlot)b).data != null) { return ((ItemSlot)a).data.guid == ((ItemSlot)b).data.guid; } return false; } return true; } private static void SyncInventory(Character ch) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) object obj; if (ch == null) { obj = null; } else { Player player = ch.player; obj = ((player != null) ? ((MonoBehaviourPun)player).photonView : null); } if (!((Object)obj == (Object)null)) { byte[] array = IBinarySerializable.ToManagedArray(new InventorySyncData(ch.player.itemSlots, ch.player.backpackSlot, ch.player.tempFullSlot)); ((MonoBehaviourPun)ch.player).photonView.RPC("SyncInventoryRPC", (RpcTarget)0, new object[2] { array, true }); } } internal static void RefreshBackpackHotbar() { try { GUIManager instance = GUIManager.instance; if (instance != null) { instance.UpdateItems(); } } catch { } } internal static void ApplyCarryingHotbarIcon(InventoryItemUI ui) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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) if ((Object)(object)ui == (Object)null || !ui.isBackpack) { return; } Character observedCharacter = Character.observedCharacter; if ((Object)(object)observedCharacter?.data?.carriedPlayer == (Object)null) { if (_paintedCarryFrame) { RestoreBackpackFrame(ui); _paintedCarryFrame = false; } return; } Character carriedPlayer = observedCharacter.data.carriedPlayer; try { if ((Object)(object)ui.carryingIcon != (Object)null) { ui.icon.texture = ui.carryingIcon; } Color src = Color.white; if ((Object)(object)carriedPlayer.refs?.customization != (Object)null) { src = carriedPlayer.refs.customization.PlayerColor; } ((Graphic)ui.icon).color = BoostScoutIconColor(src); ((Behaviour)ui.icon).enabled = true; ((Component)ui.icon).transform.localScale = Vector3.one; ((Graphic)ui.icon).canvasRenderer.SetAlpha(1f); if ((Object)(object)ui.backpackFilledSlotsObject != (Object)null) { ui.backpackFilledSlotsObject.SetActive(false); } if ((Object)(object)ui.fill != (Object)null) { ((Behaviour)ui.fill).enabled = true; } if ((Object)(object)ui.outline != (Object)null) { ((Behaviour)ui.outline).enabled = true; Color color = ((Graphic)ui.icon).color; color.a = 1f; ((Graphic)ui.outline).color = color; } ui.TrySetFuel((ItemInstanceData)null); HasBackpackField?.SetValue(ui, true); _paintedCarryFrame = true; } catch { } } private static void RestoreBackpackFrame(InventoryItemUI ui) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_003e: 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) try { Color color = Color.white; if (DefaultElementColorField?.GetValue(ui) is Color val) { color = val; } if ((Object)(object)ui.outline != (Object)null) { ((Graphic)ui.outline).color = color; } if ((Object)(object)ui.fill != (Object)null) { ((Graphic)ui.fill).color = color; } ui.SetSelected(); } catch { } } private static Color BoostScoutIconColor(Color src) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_005f: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(src, ref num, ref num2, ref num3); num2 = Mathf.Clamp(num2 * 1.45f + 0.28f, 0.62f, 1f); num3 = Mathf.Clamp(Mathf.Max(num3, 0.5f) * 1.35f, 0.82f, 1f); Color result = Color.HSVToRGB(num, num2, num3); result.a = 1f; return result; } } [HarmonyPatch(typeof(CharacterCarrying), "Update")] internal static class AutoCarryKeepPatch { private static bool Prefix(Character ___character) { if ((Object)(object)___character == (Object)null || ___character.refs == null || !___character.refs.view.IsMine) { return true; } if ((Object)(object)___character.data == (Object)null || (Object)(object)___character.data.carriedPlayer == (Object)null) { return true; } if (!AutoCarry.IsOurConsciousCarry(___character, ___character.data.carriedPlayer)) { return true; } Character carriedPlayer = ___character.data.carriedPlayer; if ((Object)(object)carriedPlayer.data == (Object)null || carriedPlayer.data.dead || ___character.data.dead || ___character.data.fullyPassedOut) { return true; } return false; } } [HarmonyPatch(typeof(CharacterCarrying), "RPCA_Drop")] internal static class AutoCarryDropSwapPatch { private static void Prefix(Character ___character, PhotonView targetView) { if (!((Object)(object)___character == (Object)null) && ___character.IsLocal) { Character target = (((Object)(object)targetView != (Object)null) ? ((Component)targetView).GetComponent() : null); AutoCarry.TrySwapBackpackBack(___character, target); } } } [HarmonyPatch(typeof(InventoryItemUI), "SetItem")] internal static class CarryBackpackIconPatch { private static void Postfix(InventoryItemUI __instance) { AutoCarry.ApplyCarryingHotbarIcon(__instance); } } internal static class L10n { internal static string BothNeedDropBackpack() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected I4, but got Unknown try { Language cURRENT_LANGUAGE = LocalizedText.CURRENT_LANGUAGE; return (cURRENT_LANGUAGE - 1) switch { 8 => "需要双方有一人放下背包才可以背目标", 9 => "需要雙方有一人放下背包才可以背目標", 10 => "どちらかがリュックを下ろさないと背負えません", 11 => "둘 중 한 명이 배낭을 내려놔야 업을 수 있습니다", 0 => "L’un des deux doit poser son sac pour porter la cible", 2 => "Einer von beiden muss den Rucksack ablegen, um zu tragen", 1 => "Uno dei due deve posare lo zaino per poter portare il bersaglio", 3 => "Uno de los dos debe soltar la mochila para poder cargar al objetivo", 4 => "Uno de los dos debe soltar la mochila para poder cargar al objetivo", 5 => "Um dos dois precisa soltar a mochila para carregar o alvo", 6 => "Кто-то один должен снять рюкзак, чтобы нести цель", 7 => "Хтось один має зняти рюкзак, щоб нести ціль", 12 => "Ktoś musi zdjąć plecak, żeby nieść cel", 13 => "Hedefi sırtlamak için birinizin çantayı bırakması gerekir", _ => "One of you must drop a backpack before you can carry the target", }; } catch { return "One of you must drop a backpack before you can carry the target"; } } internal static string LockedName(string characterName) { string text = (string.IsNullOrEmpty(characterName) ? "?" : characterName); return LockedPrefix() + " " + text; } internal static string LockedPrefix() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected I4, but got Unknown try { Language cURRENT_LANGUAGE = LocalizedText.CURRENT_LANGUAGE; return (cURRENT_LANGUAGE - 1) switch { 8 => "已锁定", 9 => "已鎖定", 10 => "ロック中", 11 => "잠금됨", 0 => "Verrouillé", 2 => "Gesperrt", 1 => "Bloccato", 3 => "Bloqueado", 4 => "Bloqueado", 5 => "Travado", 6 => "Захват", 7 => "Захоплено", 12 => "Zablokowano", 13 => "Kilitlendi", _ => "Locked", }; } catch { return "Locked"; } } } [HarmonyPatch(typeof(RescueHook), "GetHit")] internal static class GetHitPatch { private static void Postfix(RescueHook __instance, ref Vector3 endFire, ref RaycastHit __result) { //IL_0029: 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_0019: 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_0020: 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) if (AimLock.TryGetLockedTarget(__instance, out Character target)) { if (AimLock.TryMakeHit(target, __instance, out var hit, out var endFire2)) { __result = hit; endFire = endFire2; } else { endFire = AimLock.GetLiveAimPoint(target); } } } } [HarmonyPatch(typeof(RescueHook), "Update")] internal static class UpdateUsabilityPatch { private static void Postfix(RescueHook __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((ItemComponent)(__instance?)).item == (Object)null) && AimLock.TryGetLockedTarget(__instance, out Character _)) { ((ItemComponent)__instance).item.overrideUsability = Optionable.Some(true); } } } [HarmonyPatch(typeof(Item), "StartUsePrimary")] internal static class InstantCastStartPatch { private static void Postfix(Item __instance) { if (ShouldInstantCast(__instance) && !__instance.finishedCast) { __instance.FinishCastPrimary(); } } internal static bool ShouldInstantCast(Item item) { if ((Object)(object)item == (Object)null) { return false; } RescueHook component = ((Component)item).GetComponent(); Character target; if ((Object)(object)component != (Object)null) { return AimLock.TryGetLockedTarget(component, out target); } return false; } } [HarmonyPatch(typeof(Item), "ContinueUsePrimary")] internal static class InstantCastHoldPatch { private static bool Prefix(Item __instance) { if (InstantCastStartPatch.ShouldInstantCast(__instance)) { return !__instance.finishedCast; } return true; } } [HarmonyPatch(typeof(RescueHook), "RPCA_RescueCharacter")] internal static class RescueCharacterRememberPatch { private static void Postfix(RescueHook __instance, PhotonView characterView) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)characterView == (Object)null) && !((Object)(object)((MonoBehaviourPun)__instance).photonView == (Object)null) && ((MonoBehaviourPun)__instance).photonView.IsMine) { Character playerHoldingItem = __instance.playerHoldingItem; Character component = ((Component)characterView).GetComponent(); if (!((Object)(object)playerHoldingItem == (Object)null) && !((Object)(object)component == (Object)null) && playerHoldingItem.IsLocal) { AutoCarry.RememberHooked(playerHoldingItem, component); } } } } [HarmonyPatch(typeof(RescueHook), "Fire")] internal static class FirePatch { private static bool Prefix(RescueHook __instance) { if (!AimLock.TryGetLockedTarget(__instance, out Character target)) { return true; } __instance.sinceFire = 0f; PlayShots(__instance); if ((Object)(object)__instance.playerHoldingItem != (Object)null && __instance.playerHoldingItem.IsLocal) { AutoCarry.RememberHooked(__instance.playerHoldingItem, target); } ((MonoBehaviourPun)__instance).photonView.RPC("RPCA_RescueCharacter", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)target).photonView }); return false; } private static void PlayShots(RescueHook hook) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (hook.rescueShot == null) { return; } for (int i = 0; i < hook.rescueShot.Length; i++) { if ((Object)(object)hook.rescueShot[i] != (Object)null) { hook.rescueShot[i].Play(((Component)hook).transform.position); } } } } [BepInPlugin("youxia173.RescueClawAimLock", "RescueClawAimLock", "1.3.7")] public sealed class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static ConfigEntry AimLockKey; internal static ConfigEntry AimLockFov; internal static ConfigEntry ShowFovRing; internal static ConfigEntry ShowAimLockPrompt; internal static ConfigEntry LockColorR; internal static ConfigEntry LockColorG; internal static ConfigEntry LockColorB; internal static ConfigEntry AutoCarryAfterHook; internal static ConfigEntry AutoCarryRangeMeters; private void Awake() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_0218: 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) //IL_019a: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; AimLockKey = ((BaseUnityPlugin)this).Config.Bind("1. Aim Lock 自瞄", "Aim Lock Key 自瞄按键", (KeyCode)324, "EN: Hold this key while holding a Rescue Claw to lock onto the teammate nearest the crosshair. Mouse1 = right mouse button.\n中文:手持救援爪时按住此键,准星附近的队友会被锁定。Mouse1 = 鼠标右键。"); AimLockFov = ((BaseUnityPlugin)this).Config.Bind("1. Aim Lock 自瞄", "Aim Lock FOV 自瞄视角", 8f, new ConfigDescription("EN: Max angle from crosshair (degrees) to acquire a lock. Already-locked targets stay until you release the key.\n中文:首次锁定允许的准星夹角(度)。锁上后按住不放就会保持,直到松键。", (AcceptableValueBase)(object)new AcceptableValueRange(2f, 25f), Array.Empty())); ShowFovRing = ((BaseUnityPlugin)this).Config.Bind("1. Aim Lock 自瞄", "Show FOV Ring 显示自瞄圈", true, "EN: Show the FOV ring while holding the Rescue Claw and the aim-lock key. Turn off to hide the circle.\n中文:拿出救援爪并按住自瞄键时显示 FOV 圈。关闭则不画圈。"); ShowAimLockPrompt = ((BaseUnityPlugin)this).Config.Bind("1. Aim Lock 自瞄", "Show Aim Lock Prompt 显示自瞄按键提示", true, "EN: Show the aim-lock key next to vanilla item-use prompts (bottom-right). Does not replace left-click Use.\n中文:在右下角原版道具按键旁显示自瞄键提示,不覆盖左键使用。"); LockColorR = ((BaseUnityPlugin)this).Config.Bind("1. Aim Lock 自瞄", "Lock Color R 锁定颜色R", 90, new ConfigDescription("EN: Red 0-255 of the ring when a teammate is locked.\n中文:锁到队友时圈的红色 0-255。", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), Array.Empty())); LockColorG = ((BaseUnityPlugin)this).Config.Bind("1. Aim Lock 自瞄", "Lock Color G 锁定颜色G", 255, new ConfigDescription("EN: Green 0-255 of the ring when a teammate is locked.\n中文:锁到队友时圈的绿色 0-255。", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), Array.Empty())); LockColorB = ((BaseUnityPlugin)this).Config.Bind("1. Aim Lock 自瞄", "Lock Color B 锁定颜色B", 140, new ConfigDescription("EN: Blue 0-255 of the ring when a teammate is locked.\n中文:锁到队友时圈的蓝色 0-255。", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), Array.Empty())); try { if (typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(((BaseUnityPlugin)this).Config) is Dictionary dictionary) { dictionary.Remove(new ConfigDefinition("2. Teammate Range 抓队友距离", "Unlimited Teammate Grab 无限抓队友")); dictionary.Remove(new ConfigDefinition("2. Teammate Range 抓队友距离", "Max Aim Lock Range Meters 自瞄最大距离米")); } } catch { } AutoCarryAfterHook = ((BaseUnityPlugin)this).Config.Bind("3. Auto Carry 自动背人", "Auto Carry After Hook 钩上后自动背", true, "EN: Default ON. After you hook a teammate, automatically piggyback that same hooked scout when they enter range — awake or passed out. If both have backpacks, yours is dropped at your feet first. Press 4 to drop. Never picks a nearby bystander.\n中文:默认开启。钩中队友后,进入范围内会自动背起**这次钩中的那位**(清醒或昏迷都行)。双方都有背包时先把你的背包扔在脚跟再背。按 4 放下。不会背边上其他人。"); AutoCarryRangeMeters = ((BaseUnityPlugin)this).Config.Bind("3. Auto Carry 自动背人", "Auto Carry Range Meters 自动背人范围米", 10f, new ConfigDescription("EN: Distance in meters to start piggyback after the hook (default 10, range 3–40).\n中文:钩上来后开始自动背人的距离(米),默认 10,范围 3–40。", (AcceptableValueBase)(object)new AcceptableValueRange(3f, 40f), Array.Empty())); new Harmony("youxia173.RescueClawAimLock").PatchAll(); Log.LogInfo((object)"RescueClawAimLock v1.3.7 loaded"); } private void Update() { AutoCarry.Tick(); } private void OnGUI() { AimLockHud.Draw(); } internal static bool IsAimLockHeld() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (Application.isFocused) { return Input.GetKey(AimLockKey.Value); } return false; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "youxia173.RescueClawAimLock"; public const string PLUGIN_NAME = "RescueClawAimLock"; public const string PLUGIN_VERSION = "1.3.7"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }