Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Skyhoppers Guns v2.5.3
SkyhoppersGuns.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.UI; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace M1911Mod; internal static class AimPose { private sealed class Arm { public Transform Upper; public Transform Lower; public Transform Hand; } private static PlayerControllerB _for; private static Arm _right; private static Arm _left; private static readonly Dictionary<string, Transform> _fingers = new Dictionary<string, Transform>(); private static bool _logged; private static float _blend; private static float _sprint; private static float _nextDiag; private static float _move; private static float _phase; private static Vector3 _prevPos; private static Vector3 _elbowLocal; private static bool _hadPrev; private static bool _elbowInit; private static Quaternion _prevCam = Quaternion.identity; private static Vector2 _sway; private static Vector2 _swayV; private static int _diag; internal static readonly Vector3 HandFwd = new Vector3(0.12f, -0.12f, 1f); internal static readonly Vector3 HandThumb = new Vector3(-0.25f, 1f, 0f); internal static readonly Vector3 PalmOffset = new Vector3(0.02f, 0f, -0.012f); internal const float PalmFromWrist = 0.075f; internal const float PalmDepth = 0.018f; private static readonly Vector3 ElbowDir = new Vector3(0.507f, -0.815f, -0.282f); private static readonly Vector3 TriggerTouch = new Vector3(0.004f, -0.004f, 0.006f); private static readonly Vector3 ThumbTip = new Vector3(-0.022f, -0.045f, -0.02f); private static readonly float[,] Curl = new float[3, 2] { { -75f, -85f }, { -80f, -90f }, { -85f, -95f } }; private static readonly Dictionary<string, Quaternion> FingerRest = new Dictionary<string, Quaternion> { { "finger1.R", new Quaternion(0.22461f, 0.67048f, -0.22461f, 0.67048f) }, { "finger1.R.001", new Quaternion(-0.22129f, -0.00875f, -0.03853f, 0.97441f) }, { "finger2.R", new Quaternion(0.05296f, 0.70512f, -0.10809f, 0.6988f) }, { "finger2.R.001", new Quaternion(-0.07482f, -0.02182f, -0.18532f, 0.97958f) }, { "finger3.R", new Quaternion(0.035f, 0.70624f, -0.0359f, 0.7062f) }, { "finger3.R.001", new Quaternion(-0.05372f, -0.01092f, -0.2043f, 0.97737f) }, { "finger4.R", new Quaternion(0.01847f, 0.70687f, 0.02224f, 0.70676f) }, { "finger4.R.001", new Quaternion(-0.07394f, -0.01217f, -0.21834f, 0.97299f) }, { "finger5.R", new Quaternion(0.06097f, 0.70447f, 0.08411f, 0.70209f) }, { "finger5.R.001", new Quaternion(-0.11482f, -0.00902f, -0.2783f, 0.95356f) } }; internal static void Patch(Harmony h) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(PlayerControllerB), "LateUpdate", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(AimPose), "LateUpdatePostfix", (Type[])null); h.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } internal static bool Active(M1911Item gun) { return Plugin.UseAimPose.Value && (Object)(object)_for != (Object)null && _right != null && (Object)(object)gun != (Object)null && (Object)(object)_for.currentlyHeldObjectServer == (Object)(object)gun && _blend > 0f && (Object)(object)((GrabbableObject)gun).parentObject != (Object)null && (Object)(object)((GrabbableObject)gun).parentObject == (Object)(object)_for.localItemHolder; } private static void LateUpdatePostfix(PlayerControllerB __instance) { //IL_0178: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_0810: Unknown result type (might be due to invalid IL or missing references) //IL_0806: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_0825: Unknown result type (might be due to invalid IL or missing references) //IL_082a: Unknown result type (might be due to invalid IL or missing references) //IL_082f: Unknown result type (might be due to invalid IL or missing references) //IL_0834: Unknown result type (might be due to invalid IL or missing references) //IL_0836: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_083d: Unknown result type (might be due to invalid IL or missing references) //IL_0842: Unknown result type (might be due to invalid IL or missing references) //IL_0844: Unknown result type (might be due to invalid IL or missing references) //IL_0846: Unknown result type (might be due to invalid IL or missing references) //IL_084b: Unknown result type (might be due to invalid IL or missing references) //IL_0850: Unknown result type (might be due to invalid IL or missing references) //IL_0852: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_085e: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_0862: Unknown result type (might be due to invalid IL or missing references) //IL_0864: Unknown result type (might be due to invalid IL or missing references) //IL_0869: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_0873: Unknown result type (might be due to invalid IL or missing references) //IL_0875: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_0881: Unknown result type (might be due to invalid IL or missing references) //IL_0886: Unknown result type (might be due to invalid IL or missing references) //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_0895: Unknown result type (might be due to invalid IL or missing references) //IL_089a: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08ab: Unknown result type (might be due to invalid IL or missing references) //IL_08b0: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_08e3: Unknown result type (might be due to invalid IL or missing references) //IL_08ef: Unknown result type (might be due to invalid IL or missing references) //IL_08f1: Unknown result type (might be due to invalid IL or missing references) //IL_08f3: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Unknown result type (might be due to invalid IL or missing references) //IL_0925: Unknown result type (might be due to invalid IL or missing references) //IL_092a: Unknown result type (might be due to invalid IL or missing references) //IL_092c: Unknown result type (might be due to invalid IL or missing references) //IL_092d: Unknown result type (might be due to invalid IL or missing references) //IL_0932: Unknown result type (might be due to invalid IL or missing references) //IL_0937: Unknown result type (might be due to invalid IL or missing references) //IL_0939: Unknown result type (might be due to invalid IL or missing references) //IL_093e: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_0712: Unknown result type (might be due to invalid IL or missing references) //IL_0717: Unknown result type (might be due to invalid IL or missing references) //IL_071c: Unknown result type (might be due to invalid IL or missing references) //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_0720: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_076a: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_0781: Unknown result type (might be due to invalid IL or missing references) //IL_0795: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Unknown result type (might be due to invalid IL or missing references) //IL_07a1: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07bc: Unknown result type (might be due to invalid IL or missing references) //IL_07c1: Unknown result type (might be due to invalid IL or missing references) //IL_07d5: Unknown result type (might be due to invalid IL or missing references) //IL_07dc: Unknown result type (might be due to invalid IL or missing references) //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07e6: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Unknown result type (might be due to invalid IL or missing references) //IL_099f: Unknown result type (might be due to invalid IL or missing references) //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_09a8: Unknown result type (might be due to invalid IL or missing references) //IL_09ad: Unknown result type (might be due to invalid IL or missing references) //IL_09b2: Unknown result type (might be due to invalid IL or missing references) //IL_09c7: Unknown result type (might be due to invalid IL or missing references) //IL_09cc: Unknown result type (might be due to invalid IL or missing references) //IL_09d1: Unknown result type (might be due to invalid IL or missing references) //IL_09d3: Unknown result type (might be due to invalid IL or missing references) //IL_09d5: Unknown result type (might be due to invalid IL or missing references) //IL_09d9: Unknown result type (might be due to invalid IL or missing references) //IL_09de: Unknown result type (might be due to invalid IL or missing references) //IL_09e3: Unknown result type (might be due to invalid IL or missing references) //IL_09eb: Unknown result type (might be due to invalid IL or missing references) //IL_09ed: Unknown result type (might be due to invalid IL or missing references) //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_0957: Unknown result type (might be due to invalid IL or missing references) //IL_095c: Unknown result type (might be due to invalid IL or missing references) //IL_0961: Unknown result type (might be due to invalid IL or missing references) //IL_0963: Unknown result type (might be due to invalid IL or missing references) //IL_0968: Unknown result type (might be due to invalid IL or missing references) //IL_0a21: Unknown result type (might be due to invalid IL or missing references) //IL_09fe: Unknown result type (might be due to invalid IL or missing references) //IL_0a03: Unknown result type (might be due to invalid IL or missing references) //IL_0a17: Unknown result type (might be due to invalid IL or missing references) //IL_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_0a2e: Unknown result type (might be due to invalid IL or missing references) //IL_0a36: Unknown result type (might be due to invalid IL or missing references) //IL_0a3b: Unknown result type (might be due to invalid IL or missing references) //IL_0a40: Unknown result type (might be due to invalid IL or missing references) //IL_0a42: Unknown result type (might be due to invalid IL or missing references) //IL_0a47: Unknown result type (might be due to invalid IL or missing references) //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) //IL_0a52: Unknown result type (might be due to invalid IL or missing references) //IL_0a57: Unknown result type (might be due to invalid IL or missing references) //IL_0a5c: Unknown result type (might be due to invalid IL or missing references) //IL_0a68: Unknown result type (might be due to invalid IL or missing references) //IL_0a6a: Unknown result type (might be due to invalid IL or missing references) //IL_0a6c: Unknown result type (might be due to invalid IL or missing references) //IL_0a71: Unknown result type (might be due to invalid IL or missing references) //IL_0a73: Unknown result type (might be due to invalid IL or missing references) //IL_0a75: Unknown result type (might be due to invalid IL or missing references) //IL_0a77: Unknown result type (might be due to invalid IL or missing references) //IL_0a7c: Unknown result type (might be due to invalid IL or missing references) //IL_0a81: Unknown result type (might be due to invalid IL or missing references) //IL_0a86: Unknown result type (might be due to invalid IL or missing references) //IL_0a9a: Unknown result type (might be due to invalid IL or missing references) //IL_0a9c: Unknown result type (might be due to invalid IL or missing references) //IL_0a9e: Unknown result type (might be due to invalid IL or missing references) //IL_0aa3: Unknown result type (might be due to invalid IL or missing references) //IL_0aa5: Unknown result type (might be due to invalid IL or missing references) //IL_0ab9: Unknown result type (might be due to invalid IL or missing references) //IL_0ac0: Unknown result type (might be due to invalid IL or missing references) //IL_0acc: Unknown result type (might be due to invalid IL or missing references) //IL_0ad1: Unknown result type (might be due to invalid IL or missing references) //IL_0ad3: Unknown result type (might be due to invalid IL or missing references) //IL_0ad8: Unknown result type (might be due to invalid IL or missing references) //IL_0add: Unknown result type (might be due to invalid IL or missing references) //IL_0adf: Unknown result type (might be due to invalid IL or missing references) //IL_0ae1: Unknown result type (might be due to invalid IL or missing references) //IL_0ae6: Unknown result type (might be due to invalid IL or missing references) //IL_0aeb: Unknown result type (might be due to invalid IL or missing references) //IL_0aee: Unknown result type (might be due to invalid IL or missing references) //IL_0af0: Unknown result type (might be due to invalid IL or missing references) //IL_0afd: Unknown result type (might be due to invalid IL or missing references) //IL_0b02: Unknown result type (might be due to invalid IL or missing references) //IL_0b8d: Unknown result type (might be due to invalid IL or missing references) //IL_0b8f: Unknown result type (might be due to invalid IL or missing references) //IL_0b91: Unknown result type (might be due to invalid IL or missing references) //IL_0b98: Unknown result type (might be due to invalid IL or missing references) //IL_0b9d: Unknown result type (might be due to invalid IL or missing references) //IL_0ba2: Unknown result type (might be due to invalid IL or missing references) //IL_0ba7: Unknown result type (might be due to invalid IL or missing references) //IL_0ba9: Unknown result type (might be due to invalid IL or missing references) //IL_0bae: Unknown result type (might be due to invalid IL or missing references) //IL_0bb3: Unknown result type (might be due to invalid IL or missing references) //IL_0bb8: Unknown result type (might be due to invalid IL or missing references) //IL_0b53: Unknown result type (might be due to invalid IL or missing references) //IL_0b5a: Unknown result type (might be due to invalid IL or missing references) //IL_0b64: Unknown result type (might be due to invalid IL or missing references) //IL_0bd2: Unknown result type (might be due to invalid IL or missing references) //IL_0be3: Unknown result type (might be due to invalid IL or missing references) //IL_0be5: Unknown result type (might be due to invalid IL or missing references) //IL_0bf6: Unknown result type (might be due to invalid IL or missing references) //IL_0bfb: Unknown result type (might be due to invalid IL or missing references) //IL_0c00: Unknown result type (might be due to invalid IL or missing references) //IL_0c33: Unknown result type (might be due to invalid IL or missing references) //IL_0c35: Unknown result type (might be due to invalid IL or missing references) //IL_0c37: Unknown result type (might be due to invalid IL or missing references) //IL_0c4b: Unknown result type (might be due to invalid IL or missing references) //IL_0c52: Unknown result type (might be due to invalid IL or missing references) //IL_0c57: Unknown result type (might be due to invalid IL or missing references) //IL_0c5c: Unknown result type (might be due to invalid IL or missing references) //IL_0c6b: Unknown result type (might be due to invalid IL or missing references) //IL_0c8f: Unknown result type (might be due to invalid IL or missing references) //IL_0cb3: Unknown result type (might be due to invalid IL or missing references) //IL_0ce9: Unknown result type (might be due to invalid IL or missing references) //IL_0cee: Unknown result type (might be due to invalid IL or missing references) //IL_0cf0: Unknown result type (might be due to invalid IL or missing references) //IL_0cf5: Unknown result type (might be due to invalid IL or missing references) //IL_0cfa: Unknown result type (might be due to invalid IL or missing references) //IL_0cff: Unknown result type (might be due to invalid IL or missing references) //IL_0d17: Unknown result type (might be due to invalid IL or missing references) //IL_0d10: Unknown result type (might be due to invalid IL or missing references) //IL_0d19: Unknown result type (might be due to invalid IL or missing references) //IL_0d1b: Unknown result type (might be due to invalid IL or missing references) //IL_0d1d: Unknown result type (might be due to invalid IL or missing references) //IL_1331: Unknown result type (might be due to invalid IL or missing references) //IL_134f: Unknown result type (might be due to invalid IL or missing references) //IL_1370: Unknown result type (might be due to invalid IL or missing references) //IL_1387: Unknown result type (might be due to invalid IL or missing references) //IL_139c: Unknown result type (might be due to invalid IL or missing references) //IL_13b2: Unknown result type (might be due to invalid IL or missing references) //IL_13eb: Unknown result type (might be due to invalid IL or missing references) //IL_0d47: Unknown result type (might be due to invalid IL or missing references) //IL_0d4c: Unknown result type (might be due to invalid IL or missing references) //IL_0d4e: Unknown result type (might be due to invalid IL or missing references) //IL_0d5f: Unknown result type (might be due to invalid IL or missing references) //IL_0d64: Unknown result type (might be due to invalid IL or missing references) //IL_0d69: Unknown result type (might be due to invalid IL or missing references) //IL_0d6b: Unknown result type (might be due to invalid IL or missing references) //IL_0d6d: Unknown result type (might be due to invalid IL or missing references) //IL_0d7e: Unknown result type (might be due to invalid IL or missing references) //IL_0d83: Unknown result type (might be due to invalid IL or missing references) //IL_0d88: Unknown result type (might be due to invalid IL or missing references) //IL_0d8d: Unknown result type (might be due to invalid IL or missing references) //IL_0d95: Unknown result type (might be due to invalid IL or missing references) //IL_0d9a: Unknown result type (might be due to invalid IL or missing references) //IL_0daa: Unknown result type (might be due to invalid IL or missing references) //IL_0daf: Unknown result type (might be due to invalid IL or missing references) //IL_0db4: Unknown result type (might be due to invalid IL or missing references) //IL_0db9: Unknown result type (might be due to invalid IL or missing references) //IL_0dbb: Unknown result type (might be due to invalid IL or missing references) //IL_0dbd: Unknown result type (might be due to invalid IL or missing references) //IL_0dce: Unknown result type (might be due to invalid IL or missing references) //IL_0dd3: Unknown result type (might be due to invalid IL or missing references) //IL_0dd8: Unknown result type (might be due to invalid IL or missing references) //IL_0ddd: Unknown result type (might be due to invalid IL or missing references) //IL_0de2: Unknown result type (might be due to invalid IL or missing references) //IL_0de4: Unknown result type (might be due to invalid IL or missing references) //IL_0de6: Unknown result type (might be due to invalid IL or missing references) //IL_0deb: Unknown result type (might be due to invalid IL or missing references) //IL_0e00: Unknown result type (might be due to invalid IL or missing references) //IL_0e02: Unknown result type (might be due to invalid IL or missing references) //IL_0e15: Unknown result type (might be due to invalid IL or missing references) //IL_0e1a: Unknown result type (might be due to invalid IL or missing references) //IL_10fd: Unknown result type (might be due to invalid IL or missing references) //IL_1109: Unknown result type (might be due to invalid IL or missing references) //IL_1114: Unknown result type (might be due to invalid IL or missing references) //IL_111e: Unknown result type (might be due to invalid IL or missing references) //IL_1123: Unknown result type (might be due to invalid IL or missing references) //IL_112e: Unknown result type (might be due to invalid IL or missing references) //IL_1138: Unknown result type (might be due to invalid IL or missing references) //IL_113d: Unknown result type (might be due to invalid IL or missing references) //IL_0e30: Unknown result type (might be due to invalid IL or missing references) //IL_0e32: Unknown result type (might be due to invalid IL or missing references) //IL_0e34: Unknown result type (might be due to invalid IL or missing references) //IL_0e39: Unknown result type (might be due to invalid IL or missing references) //IL_0e4f: Unknown result type (might be due to invalid IL or missing references) //IL_0e54: Unknown result type (might be due to invalid IL or missing references) //IL_0e56: Unknown result type (might be due to invalid IL or missing references) //IL_0e58: Unknown result type (might be due to invalid IL or missing references) //IL_0e5a: Unknown result type (might be due to invalid IL or missing references) //IL_0e5f: Unknown result type (might be due to invalid IL or missing references) //IL_11b6: Unknown result type (might be due to invalid IL or missing references) //IL_11bb: Unknown result type (might be due to invalid IL or missing references) //IL_0e72: Unknown result type (might be due to invalid IL or missing references) //IL_0e74: Unknown result type (might be due to invalid IL or missing references) //IL_0e87: Unknown result type (might be due to invalid IL or missing references) //IL_0e8c: Unknown result type (might be due to invalid IL or missing references) //IL_0e8e: Unknown result type (might be due to invalid IL or missing references) //IL_0e90: Unknown result type (might be due to invalid IL or missing references) //IL_0e92: Unknown result type (might be due to invalid IL or missing references) //IL_0e97: Unknown result type (might be due to invalid IL or missing references) //IL_11c9: Unknown result type (might be due to invalid IL or missing references) //IL_11cb: Unknown result type (might be due to invalid IL or missing references) //IL_11dc: Unknown result type (might be due to invalid IL or missing references) //IL_11e1: Unknown result type (might be due to invalid IL or missing references) //IL_11e6: Unknown result type (might be due to invalid IL or missing references) //IL_11e8: Unknown result type (might be due to invalid IL or missing references) //IL_11ed: Unknown result type (might be due to invalid IL or missing references) //IL_11f2: Unknown result type (might be due to invalid IL or missing references) //IL_11f7: Unknown result type (might be due to invalid IL or missing references) //IL_11fe: Unknown result type (might be due to invalid IL or missing references) //IL_1203: Unknown result type (might be due to invalid IL or missing references) //IL_0eb0: Unknown result type (might be due to invalid IL or missing references) //IL_0eb2: Unknown result type (might be due to invalid IL or missing references) //IL_0eb4: Unknown result type (might be due to invalid IL or missing references) //IL_0eb9: Unknown result type (might be due to invalid IL or missing references) //IL_0eca: Unknown result type (might be due to invalid IL or missing references) //IL_0ecf: Unknown result type (might be due to invalid IL or missing references) //IL_0ed4: Unknown result type (might be due to invalid IL or missing references) //IL_0ed9: Unknown result type (might be due to invalid IL or missing references) //IL_1067: Unknown result type (might be due to invalid IL or missing references) //IL_1069: Unknown result type (might be due to invalid IL or missing references) //IL_108c: Unknown result type (might be due to invalid IL or missing references) //IL_1091: Unknown result type (might be due to invalid IL or missing references) //IL_125c: Unknown result type (might be due to invalid IL or missing references) //IL_1261: Unknown result type (might be due to invalid IL or missing references) //IL_126b: Unknown result type (might be due to invalid IL or missing references) //IL_1211: Unknown result type (might be due to invalid IL or missing references) //IL_1213: Unknown result type (might be due to invalid IL or missing references) //IL_1224: Unknown result type (might be due to invalid IL or missing references) //IL_1229: Unknown result type (might be due to invalid IL or missing references) //IL_122e: Unknown result type (might be due to invalid IL or missing references) //IL_1230: Unknown result type (might be due to invalid IL or missing references) //IL_1235: Unknown result type (might be due to invalid IL or missing references) //IL_123a: Unknown result type (might be due to invalid IL or missing references) //IL_1241: Unknown result type (might be due to invalid IL or missing references) //IL_1246: Unknown result type (might be due to invalid IL or missing references) //IL_0ef3: Unknown result type (might be due to invalid IL or missing references) //IL_0ef5: Unknown result type (might be due to invalid IL or missing references) //IL_0ef7: Unknown result type (might be due to invalid IL or missing references) //IL_0efc: Unknown result type (might be due to invalid IL or missing references) //IL_0f12: Unknown result type (might be due to invalid IL or missing references) //IL_0f17: Unknown result type (might be due to invalid IL or missing references) //IL_0f44: Unknown result type (might be due to invalid IL or missing references) //IL_0f46: Unknown result type (might be due to invalid IL or missing references) //IL_0f5a: Unknown result type (might be due to invalid IL or missing references) //IL_0f5f: Unknown result type (might be due to invalid IL or missing references) //IL_0f64: Unknown result type (might be due to invalid IL or missing references) //IL_0f69: Unknown result type (might be due to invalid IL or missing references) //IL_0ff8: Unknown result type (might be due to invalid IL or missing references) //IL_0ffa: Unknown result type (might be due to invalid IL or missing references) //IL_0ffc: Unknown result type (might be due to invalid IL or missing references) //IL_0fd1: Unknown result type (might be due to invalid IL or missing references) //IL_0fd3: Unknown result type (might be due to invalid IL or missing references) //IL_0fe4: Unknown result type (might be due to invalid IL or missing references) //IL_0fe9: Unknown result type (might be due to invalid IL or missing references) //IL_0fee: Unknown result type (might be due to invalid IL or missing references) //IL_0f8b: Unknown result type (might be due to invalid IL or missing references) //IL_0f8d: Unknown result type (might be due to invalid IL or missing references) //IL_0f9e: Unknown result type (might be due to invalid IL or missing references) //IL_0fa3: Unknown result type (might be due to invalid IL or missing references) //IL_0fa8: Unknown result type (might be due to invalid IL or missing references) //IL_0fad: Unknown result type (might be due to invalid IL or missing references) //IL_1001: Unknown result type (might be due to invalid IL or missing references) //IL_1003: Unknown result type (might be due to invalid IL or missing references) //IL_1005: Unknown result type (might be due to invalid IL or missing references) //IL_102c: Unknown result type (might be due to invalid IL or missing references) //IL_1031: Unknown result type (might be due to invalid IL or missing references) try { if (!Plugin.UseAimPose.Value || (Object)(object)__instance == (Object)null || (Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController) { return; } M1911Item m1911Item = __instance.currentlyHeldObjectServer as M1911Item; bool flag = (Object)(object)m1911Item != (Object)null && ((GrabbableObject)m1911Item).isHeld && !((GrabbableObject)m1911Item).isPocketed && !__instance.isPlayerDead && !__instance.inTerminalMenu && (Object)(object)((GrabbableObject)m1911Item).parentObject != (Object)null && (Object)(object)((GrabbableObject)m1911Item).parentObject == (Object)(object)__instance.localItemHolder && !__instance.inSpecialInteractAnimation && !__instance.isClimbingLadder && (Object)(object)__instance.gameplayCamera != (Object)null; _blend = Mathf.MoveTowards(_blend, (!flag) ? 0f : 1f, Time.deltaTime * 5f); if (_blend <= 0f || (Object)(object)m1911Item == (Object)null || !flag) { return; } if ((Object)(object)_for != (Object)(object)__instance) { _for = __instance; FindArms(__instance); } if (_right == null) { return; } Transform cam = ((Component)__instance.gameplayCamera).transform; Quaternion rotation = cam.rotation; float x = _right.Hand.lossyScale.x; _sprint = Mathf.MoveTowards(_sprint, (!__instance.isSprinting) ? 0f : 1f, Time.deltaTime * 4f); float num = Mathf.Max(Time.deltaTime, 0.0001f); Vector3 position = ((Component)__instance).transform.position; Vector3 val = ((!_hadPrev) ? Vector3.zero : ((position - _prevPos) / num)); _prevPos = position; _hadPrev = true; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(val.x, val.z); float magnitude = ((Vector2)(ref val2)).magnitude; bool flag2 = (Object)(object)__instance.thisController == (Object)null || __instance.thisController.isGrounded; float num2 = Mathf.Clamp01(magnitude / 4.5f) * ((!flag2) ? 0.3f : 1f); _move = Mathf.Lerp(_move, num2, num * 8f); _phase += num * (5.5f + 4f * Mathf.Clamp01(magnitude / 6f)) * ((!flag2) ? 0.2f : 1f); float num3 = Mathf.Sin(_phase) * 0.01f * _move * Plugin.BobAmount.Value; float num4 = (0f - Mathf.Abs(Mathf.Cos(_phase))) * 0.012f * _move * Plugin.BobAmount.Value; float num5 = Mathf.Sin(Time.time * 1.6f) * 0.0025f * (1f - _move); Quaternion val3 = Quaternion.Inverse(_prevCam) * rotation; Vector3 eulerAngles = ((Quaternion)(ref val3)).eulerAngles; _prevCam = rotation; float num6 = Mathf.DeltaAngle(0f, eulerAngles.y); float num7 = Mathf.DeltaAngle(0f, eulerAngles.x); Vector2 val4 = new Vector2(num6, num7) / num; Vector2 val5 = Vector2.ClampMagnitude(-val4 * 0.00012f * Plugin.SwayAmount.Value, 0.03f); Vector2 val6 = (val5 - _sway) * 160f - _swayV * 20f; _swayV += val6 * num; _sway += _swayV * num; float num8 = ((!(m1911Item.KickTime >= 0f)) ? 1f : Mathf.Clamp01((Time.time - m1911Item.KickTime) / 0.26f)); float num9 = ((!(num8 < 1f)) ? 0f : (Mathf.Sin(Mathf.Min(1f, num8 * 4f) * (float)Math.PI * 0.5f) * (1f - num8) * (1f - num8))); num9 *= Plugin.RecoilKick.Value; Vector3 val7 = default(Vector3); ((Vector3)(ref val7))..ctor(num3 + _sway.x + num9 * 0.004f * m1911Item.KickSide, num4 + num5 + _sway.y + num9 * 0.022f, (0f - num9) * 0.07f); Vector3 val8 = default(Vector3); ((Vector3)(ref val8))..ctor((0f - num9) * 16f + _sway.y * 120f, _sway.x * -160f + num9 * 2.5f * m1911Item.KickSide, num3 * 120f + _sway.x * 250f - num9 * 3f * m1911Item.KickSide); Quaternion val9 = rotation * Quaternion.Euler(Plugin.GunAngleV + val8 + new Vector3(25f, -20f, 0f) * _sprint); Vector3 val10 = cam.position + rotation * (Plugin.GripPositionV + val7 + new Vector3(-0.02f, -0.1f, -0.08f) * _sprint); float reloadK = m1911Item.ReloadK; bool flag3 = reloadK >= 0f; float num10 = 0f; if (flag3) { num10 = S01(reloadK, 0f, 0.12f) * (1f - S01(reloadK, 0.84f, 1f)); float num11 = Bump(reloadK, 0.54f, 0.62f); float num12 = Bump(reloadK, 0.88f, 0.95f); float num13 = Bump(reloadK, 0.08f, 0.19f); float num14 = ((!(reloadK >= 0.7f) || !(reloadK < 0.88f)) ? 0f : S01(reloadK, 0.7f, 0.84f)); num12 *= 1.6f; val9 *= Quaternion.Euler(-8f * num10 - 5f * num11 - 6f * num12 + 9f * num13 - 5f * num14, -14f * num10 + 8f * num14, 38f * num10 + 10f * num13 - 9f * num14); val10 += rotation * (new Vector3(-0.015f, 0.006f, -0.04f) * num14 + new Vector3(0f, 0.004f, 0.02f) * num12); val10 += rotation * (new Vector3(-0.05f, 0.035f, -0.07f) * num10 + new Vector3(0f, 0.012f, 0f) * num11 + new Vector3(0f, 0.008f, -0.01f) * num12 + new Vector3(0.006f, -0.02f, 0f) * num13); } Vector3 val11 = ((_left == null) ? Vector3.zero : _left.Hand.position); Quaternion val12 = FrameY(val9 * HandFwd, val9 * HandThumb); Vector3 val13 = val12 * Vector3.right; Vector3 val14 = val12 * Vector3.up; Vector3 val15 = val12 * Vector3.forward; Vector3 val16 = val10 + val9 * PalmOffset; Vector3 val17 = val16 - val14 * (0.075f * x) + val15 * (0.018f * x); Vector3 position2 = _right.Upper.position; float num15 = Vector3.Distance(position2, _right.Lower.position); float num16 = Vector3.Distance(_right.Lower.position, _right.Hand.position); Vector3 val18 = val17 - position2; float num17 = Mathf.Clamp(((Vector3)(ref val18)).magnitude, Mathf.Abs(num15 - num16) + 0.001f, num15 + num16 - 0.001f); Vector3 normalized = ((Vector3)(ref val18)).normalized; Vector3 val19 = Vector3.ProjectOnPlane(rotation * ElbowDir, normalized); if (((Vector3)(ref val19)).sqrMagnitude < 1E-08f) { val19 = Vector3.ProjectOnPlane(-cam.up, normalized); } ((Vector3)(ref val19)).Normalize(); float num18 = Mathf.Clamp((num15 * num15 + num17 * num17 - num16 * num16) / (2f * num15 * num17), -1f, 1f); Vector3 val20 = position2 + normalized * (num15 * num18) + val19 * (num15 * Mathf.Sqrt(1f - num18 * num18)); Vector3 val21 = position2 + normalized * num17; Vector3 val22 = cam.InverseTransformPoint(val20); _elbowLocal = ((!_elbowInit) ? val22 : Vector3.Lerp(_elbowLocal, val22, Mathf.Min(1f, num * 25f))); _elbowInit = true; Vector3 val23 = cam.TransformPoint(_elbowLocal) - position2; val20 = position2 + ((Vector3)(ref val23)).normalized * num15; Set(_right.Upper, FrameY(val20 - position2, -Vector3.Cross(val19, val20 - position2))); Set(_right.Lower, FrameY(val21 - val20, val13)); Set(_right.Hand, val12); Vector3 val24 = val10 + (_right.Hand.position - val21) + (val21 - val17); m1911Item.PlaceAt(val24, val9); Vector3 position3 = ((Component)m1911Item).transform.position; float value = Plugin.ModelScale.Value; foreach (KeyValuePair<string, Quaternion> item in FingerRest) { if (_fingers.TryGetValue(item.Key, out var value2) && (Object)(object)value2 != (Object)null) { value2.localRotation = Quaternion.Slerp(value2.localRotation, item.Value, _blend); } } Vector3 val25 = position3 + val9 * (Plugin.TriggerPoint * value) + val9 * TriggerTouch; if (!flag3 || reloadK > 0.95f) { AimChain("finger2.R", val25); } else { AimChain("finger2.R", val25 + val9 * new Vector3(-0.002f, 0.028f, 0.045f)); } float num19 = ((!flag3) ? 0f : Bump(reloadK, 0.04f, 0.14f)); AimChain("finger1.R", position3 + val9 * Vector3.Lerp(ThumbTip, new Vector3(-0.02f, -0.058f, -0.05f), num19)); CurlChain("finger3.R", val13, Curl[0, 0], Curl[0, 1]); CurlChain("finger4.R", val13, Curl[1, 0], Curl[1, 1]); CurlChain("finger5.R", val13, Curl[2, 0], Curl[2, 1]); bool flag4 = false; if (_left != null) { Vector3 val26 = _right.Hand.position + val9 * Plugin.SupportHandV; Vector3 val27 = ((!Plugin.TwoHanded.Value) ? val11 : val26); Vector3 target = val27; float num20 = ((!Plugin.TwoHanded.Value) ? 0f : 1f); if (flag3) { Vector3 val28 = m1911Item.MagWorldCenter(); Vector3 val29 = val9 * new Vector3(-0.012f, -0.085f, -0.05f); Vector3 val30 = val28 + val9 * new Vector3(0f, -0.1f, 0.005f); Vector3 val31 = cam.position + rotation * new Vector3(-0.1f, -0.46f, 0.16f); Vector3 val32 = val24 + val9 * new Vector3(-0.085f, 0.075f, -0.075f); bool flag5 = true; Vector3 val33 = val31 - val29; float num21 = 0.55f; if (reloadK < 0.28f) { target = Vector3.Lerp(val27, val31, S01(reloadK, 0.06f, 0.28f)); } else if (reloadK < num21 - 0.07f) { val33 = Vector3.Lerp(val31 - val29, val30, S01(reloadK, 0.28f, num21 - 0.07f)); target = val33 + val29; flag4 = true; } else if (reloadK < num21) { val33 = Vector3.Lerp(val30, val28, S01(reloadK, num21 - 0.07f, num21)); target = val33 + val29; flag4 = true; } else if (reloadK < num21 + 0.05f) { target = val28 + val29 + val9 * new Vector3(0f, 0.01f, 0f); } else if (flag5 && reloadK < 0.7f) { target = Vector3.Lerp(val28 + val29, val32, S01(reloadK, num21 + 0.05f, 0.7f)); } else if (flag5 && reloadK < 0.86f) { float num22 = S01(reloadK, 0.72f, 0.84f); target = val32 + val9 * new Vector3(0f, 0f, -0.075f * num22); m1911Item.SlideOverride = num22; } else if (flag5 && reloadK < 0.88f) { target = val32 + val9 * new Vector3(0f, 0.005f, -0.075f); m1911Item.SlideOverride = 1f; } else { m1911Item.SlideOverride = -1f; Vector3 val34 = ((!flag5) ? (val28 + val29) : (val32 + val9 * new Vector3(0f, 0.03f, -0.09f))); target = Vector3.Lerp(val34, val27, S01(reloadK, (!flag5) ? (num21 + 0.05f) : 0.88f, 1f)); } if (flag4 && (Object)(object)m1911Item.SpareMag != (Object)null) { float num23 = S01(reloadK, 0.3f, num21 - 0.07f); m1911Item.SpareMag.SetPositionAndRotation(val33, val9 * Quaternion.Euler(25f * (1f - num23), 0f, -50f * (1f - num23))); } if (!Plugin.TwoHanded.Value) { num20 = Mathf.Max(num20, S01(reloadK, 0f, 0.08f) * (1f - S01(reloadK, 0.92f, 1f))); } } else { m1911Item.SlideOverride = -1f; } if (num20 > 0f) { SolveSimple(_left, target, _left.Upper.position - cam.up * 0.3f - cam.right * 0.2f, _blend * num20); if (flag3) { float num24 = S01(reloadK, 0.24f, 0.3f) * (1f - S01(reloadK, 0.57f, 0.63f)); float num25 = S01(reloadK, 0.6f, 0.68f) * (1f - S01(reloadK, 0.88f, 0.94f)); Quaternion val35 = _left.Hand.rotation; if (num24 > 0f) { val35 = Quaternion.Slerp(val35, FrameYZ(val9 * new Vector3(0.35f, 0f, 1f), -(val9 * Vector3.up)), num24); } if (num25 > 0f) { val35 = Quaternion.Slerp(val35, FrameYZ(val9 * new Vector3(1f, 0f, 0.1f), val9 * Vector3.up), num25); } _left.Hand.rotation = Quaternion.Slerp(_left.Hand.rotation, val35, _blend * num20); } } } if ((Object)(object)m1911Item.SpareMag != (Object)null) { bool flag6 = flag4 && _left != null; if (((Component)m1911Item.SpareMag).gameObject.activeSelf != flag6) { ((Component)m1911Item.SpareMag).gameObject.SetActive(flag6); } } if (Plugin.PoseDiagnostics.Value && _diag < 3 && Time.time > _nextDiag) { _diag++; _nextDiag = Time.time + 3f; Func<Vector3, string> func = delegate(Vector3 v) { //IL_0006: 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_000c: Unknown result type (might be due to invalid IL or missing references) Vector3 val36 = cam.InverseTransformPoint(v); return ((Vector3)(ref val36)).ToString("F3"); }; Plugin.Log.LogInfo((object)("[M1911 pose] shoulder=" + func(position2) + " elbow=" + func(_right.Lower.position) + " wrist=" + func(_right.Hand.position) + " wantWrist=" + func(val17) + " grip=" + func(val24) + " trigger=" + func(val25) + " indexTip=" + ((!_fingers.ContainsKey("finger2.R.001")) ? "?" : func(_fingers["finger2.R.001"].position)) + " scale=" + x.ToString("F3") + " reach=" + ((Vector3)(ref val18)).magnitude.ToString("F3") + "/" + (num15 + num16).ToString("F3"))); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("M1911 aim pose disabled: " + ex)); Plugin.UseAimPose.Value = false; } } private static void Set(Transform t, Quaternion q) { //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_000d: Unknown result type (might be due to invalid IL or missing references) t.rotation = Quaternion.Slerp(t.rotation, q, _blend); } internal static Quaternion FrameY(Vector3 y, Vector3 xHint) { //IL_0007: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0049: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) ((Vector3)(ref y)).Normalize(); Vector3 val = xHint - y * Vector3.Dot(xHint, y); if (((Vector3)(ref val)).sqrMagnitude < 1E-08f) { val = Vector3.Cross(y, Vector3.forward); } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(val, y); return Quaternion.LookRotation(val2, y); } private static Quaternion FrameYZ(Vector3 y, Vector3 zWant) { //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_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) return FrameY(y, Vector3.Cross(y, zWant)); } private static List<Transform> Chain(string root) { List<Transform> list = new List<Transform>(); if (!_fingers.TryGetValue(root, out var value) || (Object)(object)value == (Object)null) { return list; } while ((Object)(object)value != (Object)null) { list.Add(value); value = ((value.childCount <= 0) ? null : value.GetChild(0)); } return list; } private static void AimChain(string root, Vector3 target) { //IL_0017: 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_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_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_0040: 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_007c: 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_0089: 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_0098: Unknown result type (might be due to invalid IL or missing references) List<Transform> list = Chain(root); for (int i = 0; i + 1 < list.Count; i++) { Vector3 val = list[i + 1].position - list[i].position; Vector3 val2 = target - list[i].position; if (!(((Vector3)(ref val)).sqrMagnitude < 1E-10f) && !(((Vector3)(ref val2)).sqrMagnitude < 1E-10f)) { list[i].rotation = Quaternion.Slerp(list[i].rotation, Quaternion.FromToRotation(val, val2) * list[i].rotation, _blend); } } } private static void CurlChain(string root, Vector3 axis, float a0, float a1) { //IL_0021: 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_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_0043: 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_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_007a: 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_0089: Unknown result type (might be due to invalid IL or missing references) List<Transform> list = Chain(root); if (list.Count > 0) { list[0].rotation = Quaternion.Slerp(list[0].rotation, Quaternion.AngleAxis(a0, axis) * list[0].rotation, _blend); } if (list.Count > 1) { list[1].rotation = Quaternion.Slerp(list[1].rotation, Quaternion.AngleAxis(a1, axis) * list[1].rotation, _blend); } } private static float Bump(float k, float a, float b) { if (k <= a || k >= b) { return 0f; } float num = (k - a) / (b - a); return Mathf.Sin(Mathf.Min(1f, num * 3f) * (float)Math.PI * 0.5f) * (1f - num) * (1f - num) * 1.6f; } private static float S01(float k, float a, float b) { return Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((k - a) / (b - a))); } private static void SolveSimple(Arm arm, Vector3 target, Vector3 pole, float weight) { //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) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0024: 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_002d: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_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_0086: 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_008d: 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_00e7: 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_00ee: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_011f: 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) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_013c: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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) //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_01a5: 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_01bb: 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_00ac: 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_00b3: Unknown result type (might be due to invalid IL or missing references) Vector3 position = arm.Upper.position; Vector3 position2 = arm.Lower.position; Vector3 position3 = arm.Hand.position; float num = Vector3.Distance(position, position2); float num2 = Vector3.Distance(position2, position3); if (!(num < 0.0001f) && !(num2 < 0.0001f)) { Vector3 val = target - position; float num3 = Mathf.Clamp(((Vector3)(ref val)).magnitude, Mathf.Abs(num - num2) + 0.001f, num + num2 - 0.001f); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = Vector3.ProjectOnPlane(pole - position, normalized); if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f) { val2 = Vector3.ProjectOnPlane(Vector3.down, normalized); } ((Vector3)(ref val2)).Normalize(); float num4 = Mathf.Clamp((num * num + num3 * num3 - num2 * num2) / (2f * num * num3), -1f, 1f); Vector3 val3 = position + normalized * (num * num4) + val2 * (num * Mathf.Sqrt(1f - num4 * num4)); Quaternion val4 = Quaternion.FromToRotation(position2 - position, val3 - position) * arm.Upper.rotation; arm.Upper.rotation = Quaternion.Slerp(arm.Upper.rotation, val4, weight); position2 = arm.Lower.position; position3 = arm.Hand.position; Quaternion val5 = Quaternion.FromToRotation(position3 - position2, position + normalized * num3 - position2) * arm.Lower.rotation; arm.Lower.rotation = Quaternion.Slerp(arm.Lower.rotation, val5, weight); } } private static void FindArms(PlayerControllerB p) { _right = (_left = null); _fingers.Clear(); Transform playerModelArmsMetarig = p.playerModelArmsMetarig; if ((Object)(object)playerModelArmsMetarig == (Object)null) { return; } Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform[] componentsInChildren = ((Component)playerModelArmsMetarig).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (!dictionary.ContainsKey(((Object)val).name)) { dictionary[((Object)val).name] = val; } } if (dictionary.TryGetValue("arm.R_upper", out var value) && dictionary.TryGetValue("arm.R_lower", out var value2) && dictionary.TryGetValue("hand.R", out var value3)) { Arm arm = new Arm(); arm.Upper = value; arm.Lower = value2; arm.Hand = value3; _right = arm; } if (dictionary.TryGetValue("arm.L_upper", out value) && dictionary.TryGetValue("arm.L_lower", out value2) && dictionary.TryGetValue("hand.L", out value3)) { Arm arm = new Arm(); arm.Upper = value; arm.Lower = value2; arm.Hand = value3; _left = arm; } foreach (string key in FingerRest.Keys) { if (dictionary.TryGetValue(key, out var value4)) { _fingers[key] = value4; } } if (!_logged) { _logged = true; Plugin.Log.LogInfo((object)("M1911 pose: right arm " + ((_right == null) ? "MISSING" : "found") + ", left arm " + ((_left == null) ? "missing" : "found") + ", " + _fingers.Count + "/10 finger bones.")); } } } internal static class AmmoReserve { private class Runner : MonoBehaviour { private void Update() { try { Tick(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Ammo reserve: " + ex.Message)); } } } private const string SaveKey = "SkyhoppersGuns_Reserve"; private const string Msg = "SKG_Reserve"; private const string OpMsg = "SKG_ReserveOp"; private static float _lastLocalChange = -99f; private static readonly Dictionary<ulong, int> Rounds = new Dictionary<ulong, int>(); private static readonly Dictionary<ulong, int> BySteam = new Dictionary<ulong, int>(); private static readonly Dictionary<ulong, ulong> SlotSteam = new Dictionary<ulong, ulong>(); private static CustomMessagingManager _registered; private static int _lastClients = -1; private static bool _loaded; private static bool _dirty; private static float _nextCheck; private static bool IsHost => (Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer; internal static int Get(PlayerControllerB p) { int value; return ((Object)(object)p != (Object)null && Rounds.TryGetValue(p.playerClientId, out value)) ? value : 0; } internal static void Add(PlayerControllerB p, int n) { if (!((Object)(object)p == (Object)null) && n > 0) { Rounds[p.playerClientId] = Get(p) + n; } } internal static int Take(PlayerControllerB p, int want) { if ((Object)(object)p == (Object)null || want <= 0) { return 0; } int num = Get(p); int num2 = Mathf.Min(num, want); Rounds[p.playerClientId] = num - num2; return num2; } internal static void MarkDirty() { _dirty = true; } internal unsafe static void Change(PlayerControllerB p, int delta, string why) { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null || delta == 0) { return; } if (delta > 0) { Add(p, delta); } else { Take(p, -delta); } _lastLocalChange = Time.unscaledTime; if (IsHost) { Log(p, delta, why); _dirty = true; return; } NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.CustomMessagingManager == null) { return; } byte[] bytes = Encoding.UTF8.GetBytes(why ?? string.Empty); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(12 + bytes.Length, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteBytesSafe(BitConverter.GetBytes(delta), 4, 0); ((FastBufferWriter)(ref val)).WriteBytesSafe(BitConverter.GetBytes(bytes.Length), 4, 0); if (bytes.Length > 0) { ((FastBufferWriter)(ref val)).WriteBytesSafe(bytes, bytes.Length, 0); } singleton.CustomMessagingManager.SendNamedMessage("SKG_ReserveOp", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } internal static int Request(PlayerControllerB p, int want) { int num = Mathf.Min(Get(p), Mathf.Max(0, want)); if (num > 0) { Change(p, -num, "reload"); } return num; } private static void Log(PlayerControllerB p, int delta, string why) { Plugin.Log.LogInfo((object)("[Reserve] " + (p.playerUsername ?? ("player " + p.playerClientId)) + ((delta <= 0) ? " " : " +") + delta + " (" + why + ") -> " + Get(p))); } private static void OnOp(ulong sender, FastBufferReader r) { try { if (!IsHost) { return; } byte[] value = new byte[4]; ((FastBufferReader)(ref r)).ReadBytesSafe(ref value, 4, 0); int num = BitConverter.ToInt32(value, 0); ((FastBufferReader)(ref r)).ReadBytesSafe(ref value, 4, 0); int num2 = BitConverter.ToInt32(value, 0); string why = string.Empty; if (num2 > 0 && num2 < 256) { byte[] bytes = new byte[num2]; ((FastBufferReader)(ref r)).ReadBytesSafe(ref bytes, num2, 0); why = Encoding.UTF8.GetString(bytes); } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.ClientPlayerList == null || !instance.ClientPlayerList.TryGetValue(sender, out var value2) || value2 < 0 || value2 >= instance.allPlayerScripts.Length) { return; } PlayerControllerB val = instance.allPlayerScripts[value2]; if (num > 0) { Add(val, Mathf.Min(num, 1000)); } else { int num3 = Get(val); if (num3 < -num) { Plugin.Log.LogWarning((object)("[Reserve] " + val.playerUsername + " used " + -num + " but the host only had " + num3 + " for them.")); } Take(val, -num); } Log(val, num, why); _dirty = true; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Ammo reserve change failed: " + ex.Message)); } } internal static void Clear() { Rounds.Clear(); BySteam.Clear(); SlotSteam.Clear(); _loaded = false; _lastClients = -1; } internal static void Patch(Harmony h) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(GameNetworkManager), "SaveItemsInShip", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(AmmoReserve), "SavePostfix", (Type[])null); h.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); methodInfo = AccessTools.Method(typeof(StartOfRound), "ResetShip", (Type[])null, (Type[])null); val = new HarmonyMethod(typeof(AmmoReserve), "ResetPostfix", (Type[])null); h.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); GameObject val2 = new GameObject("SkyhoppersGuns_Reserve"); Object.DontDestroyOnLoad((Object)(object)val2); ((Object)val2).hideFlags = (HideFlags)61; val2.AddComponent<Runner>(); } private static void SavePostfix(GameNetworkManager __instance) { try { if (!IsHost) { return; } SyncSlotsToSteam(); StringBuilder stringBuilder = new StringBuilder(); foreach (KeyValuePair<ulong, int> item in BySteam) { stringBuilder.Append(item.Key).Append(':').Append(item.Value) .Append(';'); } ES3.Save<string>("SkyhoppersGuns_Reserve", stringBuilder.ToString(), __instance.currentSaveFileName); Plugin.Log.LogInfo((object)("[Reserve] Saved: " + stringBuilder.ToString())); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Could not save the ammo reserve: " + ex.Message)); } } private static void ResetPostfix() { Plugin.Log.LogInfo((object)"[Reserve] Crew fired: everyone's reserve is reset."); Rounds.Clear(); BySteam.Clear(); SlotSteam.Clear(); _dirty = true; } private static void Load() { _loaded = true; BySteam.Clear(); try { string text = ((!((Object)(object)GameNetworkManager.Instance != (Object)null)) ? null : GameNetworkManager.Instance.currentSaveFileName); if (string.IsNullOrEmpty(text) || !ES3.KeyExists("SkyhoppersGuns_Reserve", text)) { return; } string text2 = ES3.Load<string>("SkyhoppersGuns_Reserve", text, string.Empty); string[] array = text2.Split(new char[1] { ';' }); foreach (string text3 in array) { string[] array2 = text3.Split(new char[1] { ':' }); if (array2.Length == 2 && ulong.TryParse(array2[0], out var result) && int.TryParse(array2[1], out var result2) && result2 > 0) { BySteam[result] = result2; } } Plugin.Log.LogInfo((object)("Loaded the M1911 ammo reserve for " + BySteam.Count + " player(s): " + text2)); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Could not load the ammo reserve: " + ex.Message)); } } private static void SyncSlotsToSteam() { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return; } for (int i = 0; i < instance.allPlayerScripts.Length; i++) { PlayerControllerB val = instance.allPlayerScripts[i]; ulong num = (ulong)i; ulong num2 = ((!((Object)(object)val != (Object)null) || (!val.isPlayerControlled && !val.isPlayerDead) || val.playerSteamId == 0) ? 0 : val.playerSteamId); SlotSteam.TryGetValue(num, out var value); if (value == num2) { if (num2 != 0) { BySteam[num2] = RoundsAt(num); } continue; } if (value != 0) { BySteam[value] = RoundsAt(num); Plugin.Log.LogInfo((object)("[Reserve] Seat " + num + " left (" + value + "), kept " + RoundsAt(num))); } SlotSteam[num] = num2; Rounds[num] = ((num2 != 0 && BySteam.TryGetValue(num2, out var value2)) ? value2 : 0); if (num2 != 0) { Plugin.Log.LogInfo((object)("[Reserve] " + (val.playerUsername ?? "?") + " (" + num2 + ") in seat " + num + ": " + Rounds[num])); } _dirty = true; } } private static int RoundsAt(ulong idx) { int value; return Rounds.TryGetValue(idx, out value) ? value : 0; } private static void Tick() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || singleton.CustomMessagingManager == null || !singleton.IsListening) { _registered = null; return; } if (_registered != singleton.CustomMessagingManager) { _registered = singleton.CustomMessagingManager; _registered.RegisterNamedMessageHandler("SKG_Reserve", new HandleNamedMessageDelegate(OnTable)); _registered.RegisterNamedMessageHandler("SKG_ReserveOp", new HandleNamedMessageDelegate(OnOp)); } if (!singleton.IsServer || (Object)(object)StartOfRound.Instance == (Object)null) { return; } if (!_loaded) { Load(); } if (Time.unscaledTime >= _nextCheck) { _nextCheck = Time.unscaledTime + 1f; SyncSlotsToSteam(); int count = singleton.ConnectedClientsIds.Count; if (count != _lastClients) { _lastClients = count; _dirty = true; } } if (_dirty) { _dirty = false; Broadcast(singleton); } } private unsafe static void Broadcast(NetworkManager nm) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) MemoryStream memoryStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write(Rounds.Count); foreach (KeyValuePair<ulong, int> round in Rounds) { binaryWriter.Write(round.Key); binaryWriter.Write(round.Value); } byte[] array = memoryStream.ToArray(); FastBufferWriter val = default(FastBufferWriter); foreach (ulong connectedClientsId in nm.ConnectedClientsIds) { if (connectedClientsId != nm.LocalClientId) { ((FastBufferWriter)(ref val))..ctor(array.Length + 8, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteBytesSafe(BitConverter.GetBytes(array.Length), 4, 0); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, array.Length, 0); nm.CustomMessagingManager.SendNamedMessage("SKG_Reserve", connectedClientsId, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } } } private static void OnTable(ulong sender, FastBufferReader r) { try { if (sender != 0) { return; } byte[] value = new byte[4]; ((FastBufferReader)(ref r)).ReadBytesSafe(ref value, 4, 0); int num = BitConverter.ToInt32(value, 0); if (num >= 4 && num <= 65536) { byte[] buffer = new byte[num]; ((FastBufferReader)(ref r)).ReadBytesSafe(ref buffer, num, 0); BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer)); int num2 = binaryReader.ReadInt32(); PlayerControllerB val = ((!((Object)(object)GameNetworkManager.Instance != (Object)null)) ? null : GameNetworkManager.Instance.localPlayerController); int num3 = Get(val); Rounds.Clear(); for (int i = 0; i < num2 && i < 64; i++) { ulong key = binaryReader.ReadUInt64(); Rounds[key] = binaryReader.ReadInt32(); } if ((Object)(object)val != (Object)null && Get(val) != num3 && Time.unscaledTime - _lastLocalChange > 3f) { Plugin.Log.LogWarning((object)("[Reserve] Host corrected my reserve: " + num3 + " -> " + Get(val))); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Ammo reserve message failed: " + ex.Message)); } } } internal sealed class Bapm { internal sealed class Mat { public string Name; public Color Color; public float Metallic; public float Smoothness; public int Texture; } internal sealed class Part { public string Name; public string Bone; public int Material; public Mesh Mesh; } public readonly List<Texture2D> Textures = new List<Texture2D>(); public readonly List<Mat> Materials = new List<Mat>(); public readonly List<Part> Parts = new List<Part>(); public readonly Dictionary<string, KeyValuePair<Vector3, Vector3>> Anchors = new Dictionary<string, KeyValuePair<Vector3, Vector3>>(); public static Bapm Load(string path) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Expected O, but got Unknown Bapm bapm = new Bapm(); using (BinaryReader binaryReader = new BinaryReader(File.OpenRead(path))) { if (new string(binaryReader.ReadChars(4)) != "BAPM") { throw new Exception("not a .bapm file"); } int num = binaryReader.ReadInt32(); int num2 = binaryReader.ReadInt32(); for (int i = 0; i < num2; i++) { byte[] array = binaryReader.ReadBytes(binaryReader.ReadInt32()); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); ImageConversion.LoadImage(val, array, false); ((Texture)val).wrapMode = (TextureWrapMode)0; ((Texture)val).filterMode = (FilterMode)1; ((Object)val).name = "M1911_Tex" + i; Object.DontDestroyOnLoad((Object)(object)val); bapm.Textures.Add(val); } int num3 = binaryReader.ReadInt32(); for (int j = 0; j < num3; j++) { Mat mat = new Mat(); mat.Name = binaryReader.ReadString(); Mat mat2 = mat; mat2.Color = new Color(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); mat2.Metallic = binaryReader.ReadSingle(); mat2.Smoothness = binaryReader.ReadSingle(); mat2.Texture = binaryReader.ReadInt32(); bapm.Materials.Add(mat2); } int num4 = binaryReader.ReadInt32(); for (int k = 0; k < num4; k++) { Part part = new Part(); part.Name = binaryReader.ReadString(); part.Bone = binaryReader.ReadString(); part.Material = binaryReader.ReadInt32(); Part part2 = part; int num5 = binaryReader.ReadInt32(); Vector3[] array2 = (Vector3[])(object)new Vector3[num5]; Vector3[] array3 = (Vector3[])(object)new Vector3[num5]; Vector2[] array4 = (Vector2[])(object)new Vector2[num5]; for (int l = 0; l < num5; l++) { ref Vector3 reference = ref array2[l]; reference = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); } for (int m = 0; m < num5; m++) { ref Vector3 reference2 = ref array3[m]; reference2 = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); } for (int n = 0; n < num5; n++) { ref Vector2 reference3 = ref array4[n]; reference3 = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); } int num6 = binaryReader.ReadInt32(); int[] array5 = new int[num6]; for (int num7 = 0; num7 < num6; num7++) { array5[num7] = binaryReader.ReadInt32(); } Mesh val2 = new Mesh(); ((Object)val2).name = "M1911_" + part2.Name; Mesh val3 = val2; if (num5 > 65000) { val3.indexFormat = (IndexFormat)1; } val3.vertices = array2; val3.normals = array3; val3.uv = array4; val3.triangles = array5; val3.RecalculateBounds(); val3.RecalculateTangents(); Object.DontDestroyOnLoad((Object)(object)val3); part2.Mesh = val3; bapm.Parts.Add(part2); } if (num >= 2) { int num8 = binaryReader.ReadInt32(); Vector3 key2 = default(Vector3); Vector3 value = default(Vector3); for (int num9 = 0; num9 < num8; num9++) { string key = binaryReader.ReadString(); ((Vector3)(ref key2))..ctor(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); ((Vector3)(ref value))..ctor(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); bapm.Anchors[key] = new KeyValuePair<Vector3, Vector3>(key2, value); } } } return bapm; } public Bounds BoundsOf(Func<Part, bool> which) { //IL_0004: 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_0055: 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) bool flag = false; Bounds result = default(Bounds); foreach (Part part in Parts) { if (which(part)) { if (!flag) { result = part.Mesh.bounds; flag = true; } else { ((Bounds)(ref result)).Encapsulate(part.Mesh.bounds); } } } return result; } } internal class CombatHud : MonoBehaviour { private sealed class Entry { public TextMeshProUGUI Text; public float Born; } internal static readonly Color Orange = new Color(0.996f, 0.427f, 0.051f); internal static readonly Color OrangeDim = new Color(0.62f, 0.25f, 0.04f); internal static readonly Color Amber = new Color(1f, 0.78f, 0.32f); internal static readonly Color Panel = new Color(0.035f, 0.012f, 0.004f, 0.86f); private const string OrangeHex = "#FE6D0D"; private const string AmberHex = "#FFC752"; private const string DimHex = "#9E400A"; private const string RedHex = "#FF3B2A"; private static CombatHud _inst; private Canvas _canvas; private TMP_FontAsset _font; private RectTransform _feedRoot; private RectTransform _scorePanel; private TextMeshProUGUI _scoreTitle; private TextMeshProUGUI _scoreBody; private Image _scoreBg; private readonly List<Entry> _entries = new List<Entry>(); private readonly Queue<string> _pending = new Queue<string>(); internal static void Ensure() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if (!((Object)(object)_inst != (Object)null)) { GameObject val = new GameObject("SkyhoppersGuns_Hud"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; _inst = val.AddComponent<CombatHud>(); } } internal static void ShowKill(string killer, string victim) { if (CombatStats.KillFeedOn.Value) { Ensure(); string text = Escape(killer); string text2 = Escape(victim); _inst._pending.Enqueue("<color=#FFC752>" + text + "</color> <color=#9E400A>></color> <color=#FE6D0D>" + text2.ToUpperInvariant() + "</color>"); } } private static string Escape(string s) { if (string.IsNullOrEmpty(s)) { return "?"; } return s.Replace("<", string.Empty).Replace(">", string.Empty); } private void Build() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0130: 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_014c: 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_0180: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0248: 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_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_canvas != (Object)null)) { _canvas = ((Component)this).gameObject.AddComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 500; CanvasScaler val = ((Component)this).gameObject.AddComponent<CanvasScaler>(); val.uiScaleMode = (ScaleMode)1; val.referenceResolution = new Vector2(1920f, 1080f); val.matchWidthOrHeight = 1f; _feedRoot = NewRect("KillFeed", ((Component)this).transform); RectTransform feedRoot = _feedRoot; Vector2 val2 = new Vector2(1f, 1f); _feedRoot.anchorMax = val2; feedRoot.anchorMin = val2; _feedRoot.pivot = new Vector2(1f, 1f); _feedRoot.anchoredPosition = new Vector2(-40f, -230f); _feedRoot.sizeDelta = new Vector2(700f, 400f); _scorePanel = NewRect("Scoreboard", ((Component)this).transform); RectTransform scorePanel = _scorePanel; val2 = new Vector2(0.5f, 1f); _scorePanel.anchorMax = val2; scorePanel.anchorMin = val2; _scorePanel.pivot = new Vector2(0.5f, 1f); _scorePanel.anchoredPosition = new Vector2(0f, -200f); _scorePanel.sizeDelta = new Vector2(840f, 200f); _scoreBg = ((Component)_scorePanel).gameObject.AddComponent<Image>(); ((Graphic)_scoreBg).color = Panel; ((Graphic)_scoreBg).raycastTarget = false; Line(_scorePanel, top: true); Line(_scorePanel, top: false); _scoreTitle = Text("Title", (Transform)(object)_scorePanel, 34f, (TextAlignmentOptions)514); ((TMP_Text)_scoreTitle).rectTransform.anchorMin = new Vector2(0f, 1f); ((TMP_Text)_scoreTitle).rectTransform.anchorMax = new Vector2(1f, 1f); ((TMP_Text)_scoreTitle).rectTransform.pivot = new Vector2(0.5f, 1f); ((TMP_Text)_scoreTitle).rectTransform.anchoredPosition = new Vector2(0f, -14f); ((TMP_Text)_scoreTitle).rectTransform.sizeDelta = new Vector2(0f, 44f); ((Graphic)_scoreTitle).color = Orange; _scoreBody = Text("Body", (Transform)(object)_scorePanel, 27f, (TextAlignmentOptions)257); ((TMP_Text)_scoreBody).rectTransform.anchorMin = new Vector2(0f, 0f); ((TMP_Text)_scoreBody).rectTransform.anchorMax = new Vector2(1f, 1f); ((TMP_Text)_scoreBody).rectTransform.offsetMin = new Vector2(34f, 14f); ((TMP_Text)_scoreBody).rectTransform.offsetMax = new Vector2(-34f, -66f); ((Graphic)_scoreBody).color = Orange; ((Component)_scorePanel).gameObject.SetActive(false); } } private static RectTransform NewRect(string name, Transform parent) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); return (RectTransform)val.transform; } private static void Line(RectTransform parent, bool top) { //IL_0037: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) RectTransform val = NewRect((!top) ? "Bottom" : "Top", (Transform)(object)parent); val.anchorMin = new Vector2(0f, (!top) ? 0f : 1f); val.anchorMax = new Vector2(1f, (!top) ? 0f : 1f); val.pivot = new Vector2(0.5f, (!top) ? 0f : 1f); val.sizeDelta = new Vector2(0f, 4f); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)val2).color = Orange; ((Graphic)val2).raycastTarget = false; } private TextMeshProUGUI Text(string name, Transform parent, float size, TextAlignmentOptions align) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) RectTransform val = NewRect(name, parent); TextMeshProUGUI val2 = ((Component)val).gameObject.AddComponent<TextMeshProUGUI>(); if ((Object)(object)_font != (Object)null) { ((TMP_Text)val2).font = _font; } ((TMP_Text)val2).fontSize = size; ((TMP_Text)val2).alignment = align; ((TMP_Text)val2).enableWordWrapping = false; ((TMP_Text)val2).richText = true; ((Graphic)val2).raycastTarget = false; return val2; } private void FindFont() { if ((Object)(object)_font != (Object)null || (Object)(object)HUDManager.Instance == (Object)null) { return; } try { TextMeshProUGUI val = ((HUDManager.Instance.controlTipLines == null || HUDManager.Instance.controlTipLines.Length <= 0) ? HUDManager.Instance.chatText : HUDManager.Instance.controlTipLines[0]); if (!((Object)(object)val == (Object)null) && !((Object)(object)((TMP_Text)val).font == (Object)null)) { _font = ((TMP_Text)val).font; TextMeshProUGUI[] componentsInChildren = ((Component)this).GetComponentsInChildren<TextMeshProUGUI>(true); foreach (TextMeshProUGUI val2 in componentsInChildren) { ((TMP_Text)val2).font = _font; } } } catch { } } private void Update() { try { Build(); FindFont(); UpdateFeed(); UpdateScore(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Combat HUD: " + ex.Message)); ((Behaviour)this).enabled = false; } } private void UpdateFeed() { //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_003d: 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_0059: 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_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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) while (_pending.Count > 0) { TextMeshProUGUI val = Text("Kill", (Transform)(object)_feedRoot, 30f, (TextAlignmentOptions)516); RectTransform rectTransform = ((TMP_Text)val).rectTransform; Vector2 val2 = new Vector2(1f, 1f); ((TMP_Text)val).rectTransform.anchorMax = val2; rectTransform.anchorMin = val2; ((TMP_Text)val).rectTransform.pivot = new Vector2(1f, 1f); ((TMP_Text)val).rectTransform.sizeDelta = new Vector2(700f, 44f); ((TMP_Text)val).text = "<mark=#0A0300CC padding=\"14,14,4,4\">" + _pending.Dequeue() + "</mark>"; _entries.Insert(0, new Entry { Text = val, Born = Time.unscaledTime }); } float num = Mathf.Max(1f, CombatStats.KillFeedSeconds.Value); Vector2 val3 = default(Vector2); for (int num2 = _entries.Count - 1; num2 >= 0; num2--) { Entry entry = _entries[num2]; float num3 = Time.unscaledTime - entry.Born; if (num3 > num || num2 >= 5) { Object.Destroy((Object)(object)((Component)entry.Text).gameObject); _entries.RemoveAt(num2); } else { float num4 = Mathf.Clamp01(num3 / 0.15f); float alpha = 1f - Mathf.Clamp01((num3 - (num - 0.6f)) / 0.6f); ((TMP_Text)entry.Text).alpha = alpha; ((Vector2)(ref val3))..ctor((1f - num4) * 120f, (float)(-num2) * 50f); ((TMP_Text)entry.Text).rectTransform.anchoredPosition = Vector2.Lerp(((TMP_Text)entry.Text).rectTransform.anchoredPosition, val3, Mathf.Min(1f, Time.unscaledDeltaTime * 18f)); if (num3 < 0.02f) { ((TMP_Text)entry.Text).rectTransform.anchoredPosition = val3; } } } } private void UpdateScore() { //IL_0366: Unknown result type (might be due to invalid IL or missing references) bool flag = CombatStats.ScoreOn.Value && (CombatOverlay.ScoreKeyHeld() || Time.unscaledTime < CombatOverlay.ShowScoreUntil); if (((Component)_scorePanel).gameObject.activeSelf != flag) { ((Component)_scorePanel).gameObject.SetActive(flag); } if (!flag) { return; } List<KeyValuePair<int, CombatStats.Row>> list = new List<KeyValuePair<int, CombatStats.Row>>(CombatStats.Shown); StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null && instance.allPlayerScripts != null) { for (int i = 0; i < instance.allPlayerScripts.Length; i++) { PlayerControllerB val = instance.allPlayerScripts[i]; if (!((Object)(object)val == (Object)null) && (val.isPlayerControlled || val.isPlayerDead) && !CombatStats.Shown.ContainsKey(i)) { list.Add(new KeyValuePair<int, CombatStats.Row>(i, new CombatStats.Row())); } } } list.Sort((KeyValuePair<int, CombatStats.Row> a, KeyValuePair<int, CombatStats.Row> b) => (b.Value.Damage == a.Value.Damage) ? a.Key.CompareTo(b.Key) : b.Value.Damage.CompareTo(a.Value.Damage)); PlayerControllerB val2 = ((!((Object)(object)GameNetworkManager.Instance != (Object)null)) ? null : GameNetworkManager.Instance.localPlayerController); ((TMP_Text)_scoreTitle).text = "DAMAGE REPORT"; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<color=").Append("#9E400A").Append("><size=80%>EMPLOYEE<pos=50%>DMG<pos=63%>KILLS<pos=76%>CRITS<pos=89%>HITS</size></color>\n"); if (list.Count == 0) { stringBuilder.Append("<color=").Append("#9E400A").Append(">No hostiles damaged yet.</color>"); } int num = 0; foreach (KeyValuePair<int, CombatStats.Row> item in list) { num++; PlayerControllerB val3 = CombatStats.PlayerAt(item.Key); string s = ((!((Object)(object)val3 != (Object)null) || string.IsNullOrEmpty(val3.playerUsername)) ? ("Player " + (item.Key + 1)) : val3.playerUsername); s = Escape(s); if (s.Length > 16) { s = s.Substring(0, 16); } bool flag2 = (Object)(object)val3 != (Object)null && (Object)(object)val3 == (Object)(object)val2; stringBuilder.Append("<color=").Append((!flag2) ? "#FE6D0D" : "#FFC752").Append('>') .Append(num) .Append(". ") .Append(s) .Append("<pos=50%>") .Append(item.Value.Damage) .Append("<pos=63%>") .Append(item.Value.Kills) .Append("<pos=76%>") .Append(item.Value.Crits) .Append("<pos=89%>") .Append(item.Value.Hits) .Append("</color>\n"); } ((TMP_Text)_scoreBody).text = stringBuilder.ToString(); float num2 = 80f + (float)Mathf.Max(2, list.Count + 1) * 36f + 10f; _scorePanel.sizeDelta = new Vector2(840f, num2); } } internal static class CombatStats { internal sealed class Row { public int Damage; public int Kills; public int Hits; public int Crits; } internal static ConfigEntry<bool> MarkersOn; internal static ConfigEntry<bool> NumbersOn; internal static ConfigEntry<bool> MarkerSound; internal static ConfigEntry<bool> ScoreOn; internal static ConfigEntry<bool> KillFeedOn; internal static ConfigEntry<string> ScoreKey; internal static ConfigEntry<float> MarkerSize; internal static ConfigEntry<float> ScoreEndSeconds; internal static ConfigEntry<float> KillFeedSeconds; internal static ConfigEntry<float> MarkerVolume; private const string MsgHit = "SKG_Hit"; private const string MsgScore = "SKG_Score"; private const string MsgKill = "SKG_Kill"; private const string MsgCrit = "SKG_Crit"; internal static bool Active; private static readonly Dictionary<int, Row> Rows = new Dictionary<int, Row>(); internal static readonly Dictionary<int, Row> Shown = new Dictionary<int, Row>(); private static readonly Dictionary<EnemyAI, KeyValuePair<int, float>> LastHitter = new Dictionary<EnemyAI, KeyValuePair<int, float>>(); private static bool _dirty; private static float _nextBroadcast; private static CustomMessagingManager _registered; internal static int CritFrame = -1; private static bool IsHost => (Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer; private static PlayerControllerB Local => (!((Object)(object)GameNetworkManager.Instance != (Object)null)) ? null : GameNetworkManager.Instance.localPlayerController; internal static void MarkCrit() { CritFrame = Time.frameCount; } internal static void Bind(ConfigFile cfg) { MarkersOn = cfg.Bind<bool>("Hit Feedback", "Hit Markers", true, "Show an X on your crosshair when YOUR attack hits a creature (guns, flamethrower, shovels...). Yellow = crit, red = kill."); NumbersOn = cfg.Bind<bool>("Hit Feedback", "Damage Numbers", true, "Show the damage of each hit next to the hit marker."); MarkerSound = cfg.Bind<bool>("Hit Feedback", "Hit Sound", true, "Play a short tick on each hit."); MarkerVolume = cfg.Bind<float>("Hit Feedback", "Hit Sound Volume", 0.8f, "Volume of the hit tick (0-1)."); MarkerSize = cfg.Bind<float>("Hit Feedback", "Hit Marker Size", 1f, "Size multiplier for the hit marker."); KillFeedOn = cfg.Bind<bool>("Kill Feed", "Enabled", true, "When anyone kills a creature, a 'Player > CREATURE' line pops up on the right of everyone's screen."); KillFeedSeconds = cfg.Bind<float>("Kill Feed", "Seconds On Screen", 4f, "How long each kill line stays up."); ScoreOn = cfg.Bind<bool>("Scoreboard", "Enabled", true, "Track how much damage each player does to creatures during the day."); ScoreKey = cfg.Bind<string>("Scoreboard", "Hold Key", "Tab", "Hold this key to see the scoreboard (Unity key name, e.g. Tab, F1, K)."); ScoreEndSeconds = cfg.Bind<float>("Scoreboard", "Show At End Of Day Seconds", 20f, "How long the scoreboard stays up on the end-of-day results screen. 0 = don't show it there."); } internal static void Patch(Harmony h) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references