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 GrappleHook v0.1.0
GrappleHook.dll
Decompiled 28 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using ModMenu; using TraversalShared; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; using UnityEngine.InputSystem; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GrappleHook")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+bdb18500433aaf97864dd37e06893335db75febf")] [assembly: AssemblyProduct("GrappleHook")] [assembly: AssemblyTitle("GrappleHook")] [assembly: AssemblyVersion("0.1.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TraversalShared { internal class CableMesh : MonoBehaviour { private Mesh _mesh; private Vector3[] _verts; private Vector3[] _normals; private int _sides; private int _segs; private float _radius; private Vector3 _a; private Vector3 _b; private float _sag = -1f; private Vector3[] _pts; internal static CableMesh Create(string name, Material mat, float radius, int segs = 20, int sides = 6, Transform parent = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GameObject val = new GameObject(name); if ((Object)(object)parent != (Object)null) { val.transform.SetParent(parent, false); } CableMesh cableMesh = val.AddComponent<CableMesh>(); cableMesh._radius = radius; cableMesh._sides = Mathf.Max(3, sides); cableMesh._segs = Mathf.Max(1, segs); cableMesh.Init(mat); return cableMesh; } private void Init(Material mat) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown _mesh = new Mesh { name = ((Object)this).name + ".Mesh" }; _mesh.MarkDynamic(); int num = _segs + 1; _verts = (Vector3[])(object)new Vector3[num * _sides]; _normals = (Vector3[])(object)new Vector3[num * _sides]; _pts = (Vector3[])(object)new Vector3[num]; int[] array = new int[_segs * _sides * 6]; int num2 = 0; for (int i = 0; i < _segs; i++) { for (int j = 0; j < _sides; j++) { int num3 = i * _sides + j; int num4 = i * _sides + (j + 1) % _sides; int num5 = num3 + _sides; int num6 = num4 + _sides; array[num2++] = num3; array[num2++] = num5; array[num2++] = num4; array[num2++] = num4; array[num2++] = num5; array[num2++] = num6; } } _mesh.vertices = _verts; _mesh.normals = _normals; _mesh.triangles = array; ((Component)this).gameObject.AddComponent<MeshFilter>().sharedMesh = _mesh; MeshRenderer obj = ((Component)this).gameObject.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = mat; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)obj).receiveShadows = true; } internal void Set(Vector3 a, Vector3 b, float sag) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_mesh == (Object)null) { return; } Vector3 val = a - _a; if (((Vector3)(ref val)).sqrMagnitude < 1E-08f) { val = b - _b; if (((Vector3)(ref val)).sqrMagnitude < 1E-08f && Mathf.Abs(sag - _sag) < 0.0001f) { return; } } _a = a; _b = b; _sag = sag; for (int i = 0; i <= _segs; i++) { float num = (float)i / (float)_segs; _pts[i] = Vector3.Lerp(a, b, num) + Vector3.down * (4f * sag * num * (1f - num)); } Rebuild(); } private void Rebuild() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00c5: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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) Transform transform = ((Component)this).transform; for (int i = 0; i <= _segs; i++) { Vector3 val = ((i < _segs) ? (_pts[i + 1] - _pts[i]) : (_pts[i] - _pts[i - 1])); if (((Vector3)(ref val)).sqrMagnitude < 1E-10f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = ((Mathf.Abs(Vector3.Dot(val, Vector3.up)) > 0.95f) ? Vector3.right : Vector3.up); Vector3 val3 = Vector3.Cross(val, val2); Vector3 normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = Vector3.Cross(normalized, val); Vector3 val5 = transform.InverseTransformPoint(_pts[i]); for (int j = 0; j < _sides; j++) { float num = (float)j * MathF.PI * 2f / (float)_sides; Vector3 val6 = normalized * Mathf.Cos(num) + val4 * Mathf.Sin(num); Vector3 val7 = transform.InverseTransformDirection(val6); _verts[i * _sides + j] = val5 + val7 * _radius; _normals[i * _sides + j] = val7; } } _mesh.vertices = _verts; _mesh.normals = _normals; _mesh.RecalculateBounds(); } internal void Show(bool on) { MeshRenderer component = ((Component)this).GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null && ((Renderer)component).enabled != on) { ((Renderer)component).enabled = on; } } private void OnDestroy() { if ((Object)(object)_mesh != (Object)null) { Object.Destroy((Object)(object)_mesh); } } } internal class Fx : MonoBehaviour { private class P { public Transform T; public MeshRenderer R; public Vector3 Pos; public Vector3 Vel; public float Age; public float Life; public float Size0; public float Size1; public float Len; public Color Tint; public bool Spark; public float Spin; } private static Fx _inst; private static Material _puff; private static Material _spark; private static Mesh _quad; private static readonly List<P> Live = new List<P>(); private static readonly Stack<P> Pool = new Stack<P>(); private static MaterialPropertyBlock _mpb; private const int MaxLive = 160; private static readonly int UnlitColor = Shader.PropertyToID("_UnlitColor"); internal static void Init(Material puff, Material spark) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown _puff = puff; _spark = spark; if (!((Object)(object)_inst != (Object)null)) { GameObject val = new GameObject("TraversalFx"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; _inst = val.AddComponent<Fx>(); _mpb = new MaterialPropertyBlock(); _quad = MakeQuad(); } } internal static void Puff(Vector3 pos, Vector3 dir, float scale = 1f, int count = 7) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0091: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_puff == (Object)null) { return; } dir = ((((Vector3)(ref dir)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref dir)).normalized : Vector3.up); for (int i = 0; i < count; i++) { P p = Take(spark: false); if (p == null) { break; } float num = (float)i / (float)Mathf.Max(1, count - 1); p.Pos = pos + dir * (0.02f + 0.06f * num) * scale; p.Vel = (dir * Random.Range(1.2f, 2.6f) + Random.insideUnitSphere * 0.7f) * scale; p.Life = Random.Range(0.45f, 0.8f); p.Size0 = Random.Range(0.05f, 0.09f) * scale; p.Size1 = Random.Range(0.22f, 0.36f) * scale; p.Tint = new Color(0.85f, 0.87f, 0.9f, Random.Range(0.4f, 0.6f)); p.Spin = Random.Range(-90f, 90f); } } internal static void Sparks(Vector3 pos, Vector3 normal, int count = 12, float speed = 4f) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_008a: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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) if ((Object)(object)_spark == (Object)null) { return; } normal = ((((Vector3)(ref normal)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref normal)).normalized : Vector3.up); for (int i = 0; i < count; i++) { P p = Take(spark: true); if (p == null) { break; } p.Pos = pos + normal * 0.02f; Vector3 val = normal + Random.insideUnitSphere * 0.9f; Vector3 normalized = ((Vector3)(ref val)).normalized; p.Vel = normalized * Random.Range(0.5f, 1.2f) * speed; p.Life = Random.Range(0.18f, 0.42f); p.Size0 = (p.Size1 = Random.Range(0.006f, 0.012f)); p.Len = Random.Range(0.03f, 0.06f); p.Tint = new Color(1f, Random.Range(0.5f, 0.7f), 0.25f, 1f) * 3f; } } private static P Take(bool spark) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown if ((Object)(object)_inst == (Object)null || Live.Count >= 160) { return null; } P p = ((Pool.Count > 0) ? Pool.Pop() : null); if (p == null || (Object)(object)p.T == (Object)null) { GameObject val = new GameObject("fx"); val.transform.SetParent(((Component)_inst).transform, false); val.AddComponent<MeshFilter>().sharedMesh = _quad; MeshRenderer val2 = val.AddComponent<MeshRenderer>(); ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; p = new P { T = val.transform, R = val2 }; } ((Renderer)p.R).sharedMaterial = (spark ? _spark : _puff); p.Spark = spark; p.Age = 0f; ((Component)p.T).gameObject.SetActive(true); Live.Add(p); return p; } private void LateUpdate() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_023a: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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) if (Live.Count == 0) { return; } Transform val = Cam(); float deltaTime = Time.deltaTime; for (int num = Live.Count - 1; num >= 0; num--) { P p = Live[num]; p.Age += deltaTime; if ((Object)(object)p.T == (Object)null || p.Age >= p.Life || (Object)(object)val == (Object)null) { if ((Object)(object)p.T != (Object)null) { ((Component)p.T).gameObject.SetActive(false); } Live.RemoveAt(num); Pool.Push(p); } else { float num2 = p.Age / p.Life; if (p.Spark) { p.Vel += Physics.gravity * 0.6f * deltaTime; } else { p.Vel *= Mathf.Max(0f, 1f - 3.5f * deltaTime); } p.Pos += p.Vel * deltaTime; Vector3 val2 = val.position - p.Pos; if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f) { val2 = Vector3.forward; } ((Vector3)(ref val2)).Normalize(); p.T.position = p.Pos; if (p.Spark) { Vector3 val3 = ((((Vector3)(ref p.Vel)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref p.Vel)).normalized : Vector3.up); Vector3 val4 = -Vector3.ProjectOnPlane(val2, val3); if (((Vector3)(ref val4)).sqrMagnitude < 1E-06f) { val4 = -val2; } p.T.rotation = Quaternion.LookRotation(((Vector3)(ref val4)).normalized, val3); float num3 = p.Len * (0.6f + ((Vector3)(ref p.Vel)).magnitude * 0.12f); p.T.localScale = new Vector3(p.Size0, num3, 1f); Color tint = p.Tint; tint.a = 1f - num2 * num2; _mpb.SetColor(UnlitColor, tint * (1f - 0.6f * num2)); } else { p.T.rotation = Quaternion.LookRotation(-val2, Vector3.up) * Quaternion.Euler(0f, 0f, p.Spin * p.Age); float num4 = Mathf.Lerp(p.Size0, p.Size1, 1f - (1f - num2) * (1f - num2)); p.T.localScale = new Vector3(num4, num4, 1f); Color tint2 = p.Tint; tint2.a *= (1f - num2) * Mathf.Clamp01(p.Age * 20f); _mpb.SetColor(UnlitColor, tint2); } ((Renderer)p.R).SetPropertyBlock(_mpb); } } } private static Transform Cam() { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.activeCamera != (Object)null) { return ((Component)instance.activeCamera).transform; } if (!((Object)(object)Camera.main != (Object)null)) { return null; } return ((Component)Camera.main).transform; } private static Mesh MakeQuad() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) Mesh val = new Mesh { name = "TraversalFxQuad" }; val.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.5f, -0.5f, 0f), new Vector3(0.5f, -0.5f, 0f), new Vector3(-0.5f, 0.5f, 0f), new Vector3(0.5f, 0.5f, 0f) }; val.uv = (Vector2[])(object)new Vector2[4] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f) }; val.normals = (Vector3[])(object)new Vector3[4] { Vector3.back, Vector3.back, Vector3.back, Vector3.back }; val.triangles = new int[6] { 0, 2, 1, 2, 3, 1 }; val.bounds = new Bounds(Vector3.zero, Vector3.one * 2f); return val; } } internal static class Wav { public static AudioClip Load(Stream s, string name) { if (s == null) { Debug.LogError((object)("[Traversal] sound " + name + " is missing.")); return null; } using (s) { using BinaryReader binaryReader = new BinaryReader(s); binaryReader.ReadBytes(12); int num = 1; int num2 = 44100; int num3 = 16; byte[] array = null; while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length - 8) { string text = Encoding.ASCII.GetString(binaryReader.ReadBytes(4)); int num4 = binaryReader.ReadInt32(); if (text == "fmt ") { binaryReader.ReadInt16(); num = binaryReader.ReadInt16(); num2 = binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadInt16(); num3 = binaryReader.ReadInt16(); if (num4 > 16) { binaryReader.ReadBytes(num4 - 16); } } else { if (text == "data") { array = binaryReader.ReadBytes(num4); break; } binaryReader.ReadBytes(num4 + (num4 & 1)); } } if (array == null || num3 != 16) { Debug.LogError((object)("[Traversal] sound " + name + " isn't 16-bit PCM.")); return null; } int num5 = array.Length / 2; float[] array2 = new float[num5]; for (int i = 0; i < num5; i++) { array2[i] = (float)BitConverter.ToInt16(array, i * 2) / 32768f; } AudioClip obj = AudioClip.Create(name, num5 / num, num, num2, false); obj.SetData(array2, 0); return obj; } } } } namespace GrappleHook { internal struct Aim { public HookKind Kind; public Vector3 Point; public Vector3 Normal; public ulong TargetId; public int Part; } internal static class Aiming { private static int _propMask = -1; private static readonly RaycastHit[] Hits = (RaycastHit[])(object)new RaycastHit[24]; internal static int WallMask { get { if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return 1107298561; } return StartOfRound.Instance.collidersAndRoomMaskAndDefault; } } internal static int PropMask { get { if (_propMask >= 0) { return _propMask; } int num = 64; int num2 = LayerMask.NameToLayer("PlayerRagdoll"); if (num2 >= 0) { num |= 1 << num2; } int num3 = LayerMask.NameToLayer("Props"); if (num3 >= 0) { num |= 1 << num3; } return _propMask = num; } } internal static Aim Cast(PlayerControllerB me, GrabbableObject self, Vector3 eye, Vector3 dir, float range) { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_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_011d: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) int num = Physics.RaycastNonAlloc(eye, dir, Hits, range, WallMask | PropMask, (QueryTriggerInteraction)1); RaycastHit val = default(RaycastHit); float num2 = float.MaxValue; for (int i = 0; i < num; i++) { RaycastHit val2 = Hits[i]; if (!((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null) && !(((RaycastHit)(ref val2)).distance >= num2) && !(((RaycastHit)(ref val2)).distance < 0.05f) && !((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(((Component)me).transform) && (!((Object)(object)self != (Object)null) || !((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(((Component)self).transform))) { GrabbableObject componentInParent = ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<GrabbableObject>(); if (!((Object)(object)componentInParent != (Object)null) || (!componentInParent.isHeld && !componentInParent.isHeldByEnemy && !componentInParent.isPocketed) || componentInParent is RagdollGrabbableObject) { val = val2; num2 = ((RaycastHit)(ref val2)).distance; } } } if (num2 == float.MaxValue) { return new Aim { Kind = HookKind.Miss, Point = eye + dir * range, Normal = -dir }; } Aim result = new Aim { Kind = HookKind.Surface, Point = ((RaycastHit)(ref val)).point, Normal = ((RaycastHit)(ref val)).normal }; Collider collider = ((RaycastHit)(ref val)).collider; DeadBodyInfo componentInParent2 = ((Component)collider).GetComponentInParent<DeadBodyInfo>(); if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)componentInParent2.grabBodyObject != (Object)null && (Object)(object)((NetworkBehaviour)componentInParent2.grabBodyObject).NetworkObject != (Object)null && componentInParent2.bodyParts != null) { result.Kind = HookKind.Body; result.TargetId = ((NetworkBehaviour)componentInParent2.grabBodyObject).NetworkObjectId; result.Part = 0; Rigidbody attachedRigidbody = collider.attachedRigidbody; for (int j = 0; j < componentInParent2.bodyParts.Length; j++) { if ((Object)(object)componentInParent2.bodyParts[j] != (Object)null && (Object)(object)componentInParent2.bodyParts[j] == (Object)(object)attachedRigidbody) { result.Part = j; break; } } return result; } GrabbableObject componentInParent3 = ((Component)collider).GetComponentInParent<GrabbableObject>(); RagdollGrabbableObject val3 = (RagdollGrabbableObject)(object)((componentInParent3 is RagdollGrabbableObject) ? componentInParent3 : null); if (val3 != null && (Object)(object)val3.ragdoll != (Object)null && (Object)(object)((NetworkBehaviour)val3).NetworkObject != (Object)null) { result.Kind = HookKind.Body; result.TargetId = ((NetworkBehaviour)val3).NetworkObjectId; return result; } if ((Object)(object)componentInParent3 != (Object)null && (Object)(object)((NetworkBehaviour)componentInParent3).NetworkObject != (Object)null && ((NetworkBehaviour)componentInParent3).NetworkObject.IsSpawned && Yankable(componentInParent3)) { result.Kind = HookKind.Item; result.TargetId = ((NetworkBehaviour)componentInParent3).NetworkObjectId; } return result; } internal static bool Yankable(GrabbableObject g) { if ((Object)(object)g != (Object)null && !(g is RagdollGrabbableObject) && g.grabbable && !g.deactivated && !g.isHeld && !g.isHeldByEnemy && !g.isPocketed && (Object)(object)g.parentObject == (Object)null && !g.isInShipRoom && !g.isInElevator && (Object)(object)g.itemProperties != (Object)null) { LungProp val = (LungProp)(object)((g is LungProp) ? g : null); if (val == null || !val.isLungDocked) { return !Yanks.IsFlying(g); } } return false; } internal static Vector3 FeetSpot(PlayerControllerB holder, GrabbableObject g) { //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = ((Component)holder).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); Vector3 val = ((Component)holder).transform.position + Vector3.up * 1f; Vector3 val2 = val + forward * 1.1f; RaycastHit val3 = default(RaycastHit); if (Physics.Linecast(val, val2, ref val3, WallMask, (QueryTriggerInteraction)1)) { val2 = ((RaycastHit)(ref val3)).point - forward * 0.3f; } RaycastHit val4 = default(RaycastHit); return (Physics.Raycast(val2, Vector3.down, ref val4, 4f, WallMask, (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val4)).point : ((Component)holder).transform.position) + Vector3.up * (((Object)(object)g.itemProperties != (Object)null) ? g.itemProperties.verticalOffset : 0.1f); } } public class GrappleItem : GrabbableObject { internal enum HookPhase { Idle, Out, Latched, Back } private const float Cooldown = 0.4f; private const float BackSpeed = 45f; private const float CableRadius = 0.0045f; private Shot _shot; private float _phaseStart; private Vector3 _backFrom; private Transform _target; private float _lastShot = -10f; private bool _hitPlayed; private Transform _muzzle; private Transform _seat; private CableMesh _cable; private GameObject _hook; private AudioSource _audio; private AudioSource _reel; internal HookPhase Phase { get; private set; } internal ulong ShotHolder { get; private set; } internal float Charge { get { if (base.insertedBattery == null) { return 0f; } return base.insertedBattery.charge; } set { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown float num = Mathf.Clamp01(value); if (base.insertedBattery == null) { base.insertedBattery = new Battery(num <= 0f, num); return; } base.insertedBattery.charge = num; base.insertedBattery.empty = num <= 0.001f; } } internal int ShotsLeft => Mathf.FloorToInt(Charge * (float)Net.Charges + 0.01f); internal Vector3 MuzzlePosition { get { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_muzzle != (Object)null)) { return ((Component)this).transform.position; } return _muzzle.position; } } public override void Start() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Invalid comparison between Unknown and I4 ((GrabbableObject)this).Start(); if (base.insertedBattery == null) { base.insertedBattery = new Battery(false, 1f); } _audio = ((Component)this).GetComponent<AudioSource>(); Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "Marker_Muzzle" || ((Object)val).name == "Muzzle") { _muzzle = val; } else if (((Object)val).name == "HookSeat") { _seat = val; } } GameObject val2 = new GameObject("Reel"); val2.transform.SetParent(((Component)this).transform, false); _reel = val2.AddComponent<AudioSource>(); _reel.playOnAwake = false; _reel.loop = true; _reel.clip = Registry.ReelClip; if ((Object)(object)_audio != (Object)null) { _reel.outputAudioMixerGroup = _audio.outputAudioMixerGroup; _reel.spatialBlend = _audio.spatialBlend; _reel.rolloffMode = _audio.rolloffMode; _reel.minDistance = _audio.minDistance; _reel.maxDistance = _audio.maxDistance; if ((int)_audio.rolloffMode == 2) { _reel.SetCustomCurve((AudioSourceCurveType)0, _audio.GetCustomCurve((AudioSourceCurveType)0)); } } } public override int GetItemDataToSave() { return Mathf.Clamp(Mathf.RoundToInt(Charge * 1000f), 0, 1000); } public override void LoadItemSaveData(int saveData) { Charge = (float)Mathf.Clamp(saveData, 0, 1000) / 1000f; } public override void ChargeBatteries() { ((GrabbableObject)this).ChargeBatteries(); ((GrabbableObject)this).SetControlTipsForItem(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((GrabbableObject)this).SetControlTipsForItem(); } public override void PocketItem() { LetGoLocal(); ((GrabbableObject)this).PocketItem(); } public override void DiscardItem() { LetGoLocal(); ((GrabbableObject)this).DiscardItem(); } public override void OnDestroy() { if ((Object)(object)Pull.Item == (Object)(object)this) { Pull.End(arrived: false, "gun gone"); } if ((Object)(object)_cable != (Object)null) { Object.Destroy((Object)(object)((Component)_cable).gameObject); } if ((Object)(object)_hook != (Object)null) { Object.Destroy((Object)(object)_hook); } ((GrabbableObject)this).OnDestroy(); } private bool IsLocalHolder() { if ((Object)(object)base.playerHeldBy != (Object)null && (Object)(object)GameNetworkManager.Instance != (Object)null) { return (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController; } return false; } private void LetGoLocal() { if (Phase != HookPhase.Idle && Phase != HookPhase.Back && IsLocalHolder()) { if ((Object)(object)Pull.Item == (Object)(object)this) { Pull.End(arrived: false, "gun put away"); } else { Net.RequestRelease(this); } } } public override void SetControlTipsForItem() { if (((NetworkBehaviour)this).IsOwner && IsLocalHolder() && !((Object)(object)HUDManager.Instance == (Object)null)) { string[] array = ((Phase != HookPhase.Out && Phase != HookPhase.Latched) ? new string[1] { (ShotsLeft > 0) ? $"Fire hook ({ShotsLeft} left) : [LMB]" : "Tank empty: charge it on the ship" } : new string[1] { "Let go : [LMB] or [Jump]" }); HUDManager.Instance.ChangeControlTipMultiple(array, true, base.itemProperties); } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!buttonDown || !IsLocalHolder()) { return; } PlayerControllerB playerHeldBy = base.playerHeldBy; if (Phase == HookPhase.Out || Phase == HookPhase.Latched) { if ((Object)(object)Pull.Item == (Object)(object)this) { Pull.End(arrived: false, "let go"); } else { Net.RequestRelease(this); } } else { if (Phase == HookPhase.Back || Time.time - _lastShot < 0.4f) { return; } if (ShotsLeft <= 0) { Play(Registry.EmptyClip, 0.7f); HUDManager instance = HUDManager.Instance; if (instance != null) { instance.DisplayTip("Grapple hook", "The air tank is empty. Charge it on the ship.", false, false, "LC_Tip1"); } } else { _lastShot = Time.time; Transform transform = ((Component)playerHeldBy.gameplayCamera).transform; Aim aim = Aiming.Cast(playerHeldBy, (GrabbableObject)(object)this, transform.position, transform.forward, Net.Range); Net.RequestFire(this, transform.position, transform.forward, aim); } } } internal void OnShot(Shot s) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) _shot = s; ShotHolder = s.Holder; Charge = s.Charge; _lastShot = Time.time; _target = null; _hitPlayed = false; if (s.Kind == HookKind.Item) { GrabbableObject val = Net.FindGrabbable(s.TargetId); if ((Object)(object)val != (Object)null) { _target = ((Component)val).transform; } } else if (s.Kind == HookKind.Body) { GrabbableObject obj = Net.FindGrabbable(s.TargetId); RagdollGrabbableObject val2 = (RagdollGrabbableObject)(object)((obj is RagdollGrabbableObject) ? obj : null); Rigidbody[] array = (((Object)(object)val2 != (Object)null && (Object)(object)val2.ragdoll != (Object)null) ? val2.ragdoll.bodyParts : null); int num = Mathf.RoundToInt(s.Local.x); if (array != null && num >= 0 && num < array.Length && (Object)(object)array[num] != (Object)null) { _target = ((Component)array[num]).transform; } } SetPhase(HookPhase.Out); EnsureVisuals(); Vector3 muzzlePosition = MuzzlePosition; Play(Registry.FireClip, 1f); Fx.Puff(muzzlePosition, s.Dir); Fx.Puff(((Component)this).transform.position, -((Component)this).transform.right + Vector3.up * 0.3f, 0.5f, 3); PlayerControllerB val3 = Net.Player(s.Holder); if ((Object)(object)RoundManager.Instance != (Object)null && Plugin.NoiseRange.Value > 0f) { RoundManager.Instance.PlayAudibleNoise(muzzlePosition, Plugin.NoiseRange.Value, 0.5f, 0, (Object)(object)val3 != (Object)null && val3.isInHangarShipRoom, 0); } if ((Object)(object)val3 != (Object)null && (Object)(object)val3 == (Object)(object)GameNetworkManager.Instance.localPlayerController) { if (s.Kind == HookKind.Surface) { Pull.Begin(this, s); } ((GrabbableObject)this).SetControlTipsForItem(); } if (s.Kind == HookKind.Item && (Object)(object)_target != (Object)null) { Yanks.StartItem(((Component)_target).GetComponent<GrabbableObject>(), s, this); } if (s.Kind == HookKind.Body && (Object)(object)_target != (Object)null) { GrabbableObject obj2 = Net.FindGrabbable(s.TargetId); Yanks.StartBody((RagdollGrabbableObject)(object)((obj2 is RagdollGrabbableObject) ? obj2 : null), Mathf.RoundToInt(s.Local.x), s, this); } } internal void OnRelease() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (Phase != HookPhase.Idle && Phase != HookPhase.Back) { _backFrom = HookPoint(); SetPhase(HookPhase.Back); Play(Registry.RetractClip, 0.8f); if ((Object)(object)Pull.Item == (Object)(object)this) { Pull.End(arrived: false, "released by host"); } Yanks.Stop(this); if (IsLocalHolder()) { ((GrabbableObject)this).SetControlTipsForItem(); } } } internal void OnYankDone() { if (Net.IsHost && (Phase == HookPhase.Latched || Phase == HookPhase.Out)) { Net.HostRelease(((NetworkBehaviour)this).NetworkObjectId); } } private void SetPhase(HookPhase p) { Phase = p; _phaseStart = Time.time; if ((Object)(object)_reel != (Object)null) { bool flag = (p == HookPhase.Latched && _shot.Kind != HookKind.Miss) || p == HookPhase.Back; if (flag && (Object)(object)Registry.ReelClip != (Object)null && !_reel.isPlaying) { _reel.volume = 0.55f * Plugin.Volume.Value; _reel.pitch = ((p == HookPhase.Back) ? 1.25f : 1f); _reel.Play(); } else if (!flag && _reel.isPlaying) { _reel.Stop(); } else if (flag) { _reel.pitch = ((p == HookPhase.Back) ? 1.25f : 1f); } } } private Vector3 HookPoint() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = Anchor(); switch (Phase) { case HookPhase.Out: return Vector3.Lerp(MuzzlePosition, val, Mathf.Clamp01((Time.time - _phaseStart) / Mathf.Max(0.05f, _shot.Travel))); case HookPhase.Latched: return val; case HookPhase.Back: { float num = Mathf.Clamp01((Time.time - _phaseStart) * 45f / Mathf.Max(0.3f, Vector3.Distance(_backFrom, MuzzlePosition))); return Vector3.Lerp(_backFrom, MuzzlePosition, num * num); } default: return MuzzlePosition; } } private Vector3 Anchor() { //IL_0045: 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_0022: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_target != (Object)null) { if (_shot.Kind != HookKind.Item) { return _target.position; } return _target.TransformPoint(_shot.Local); } return _shot.Point; } public override void Update() { //IL_0131: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (Phase == HookPhase.Idle) { return; } float num = Time.time - _phaseStart; switch (Phase) { case HookPhase.Out: if (num >= _shot.Travel) { if (_shot.Kind == HookKind.Miss) { _backFrom = _shot.Point; SetPhase(HookPhase.Back); } else { SetPhase(HookPhase.Latched); Landed(); } } break; case HookPhase.Latched: if (num > _shot.MaxSeconds + 3f || ((_shot.Kind == HookKind.Item || _shot.Kind == HookKind.Body) && (Object)(object)_target == (Object)null)) { if (Net.IsHost) { Net.HostRelease(((NetworkBehaviour)this).NetworkObjectId); } else if (num > _shot.MaxSeconds + 6f) { OnRelease(); } } if (Net.IsHost && (Object)(object)base.playerHeldBy == (Object)null && (Object)(object)Pull.Item != (Object)(object)this && _shot.Kind == HookKind.Surface && num > 0.5f) { Net.HostRelease(((NetworkBehaviour)this).NetworkObjectId); } break; case HookPhase.Back: if (Vector3.Distance(HookPoint(), MuzzlePosition) < 0.02f || num > 2f) { SetPhase(HookPhase.Idle); Play(Registry.HitClip, 0.25f); if (IsLocalHolder()) { ((GrabbableObject)this).SetControlTipsForItem(); } } break; } } private void Landed() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!_hitPlayed) { _hitPlayed = true; Vector3 val = Anchor(); PlayAt(Registry.HitClip, val, (_shot.Kind == HookKind.Surface) ? 1f : 0.7f); if (_shot.Kind == HookKind.Surface) { Fx.Sparks(val, _shot.Normal); } else { Fx.Sparks(val, -_shot.Dir, 5, 2.5f); } } } private void EnsureVisuals() { if ((Object)(object)_cable == (Object)null && (Object)(object)Registry.CableMat != (Object)null) { _cable = CableMesh.Create("GrappleCable", Registry.CableMat, 0.0045f, 24); } if ((Object)(object)_hook == (Object)null && (Object)(object)Registry.HookAsset != (Object)null) { _hook = Object.Instantiate<GameObject>(Registry.HookAsset); ((Object)_hook).name = "GrappleHookHead"; Renderer[] componentsInChildren = _hook.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].shadowCastingMode = (ShadowCastingMode)1; } } } public override void LateUpdate() { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).LateUpdate(); bool flag = Phase != HookPhase.Idle; bool flag2 = flag && !base.isPocketed && ((Object)(object)base.mainObjectRenderer == (Object)null || ((Renderer)base.mainObjectRenderer).enabled || (Object)(object)base.playerHeldBy == (Object)null); if ((Object)(object)_seat != (Object)null && ((Component)_seat).gameObject.activeSelf == flag) { ((Component)_seat).gameObject.SetActive(!flag); } if ((Object)(object)_cable != (Object)null) { _cable.Show(flag2); } if ((Object)(object)_hook != (Object)null && _hook.activeSelf != flag2) { _hook.SetActive(flag2); } if (!flag2) { return; } Vector3 muzzlePosition = MuzzlePosition; Vector3 val = HookPoint(); float num = Vector3.Distance(muzzlePosition, val); float num2 = ((Phase == HookPhase.Out) ? (0.02f * num) : ((Phase == HookPhase.Back) ? (0.04f * num) : (0.004f * num))); if ((Object)(object)_cable != (Object)null) { _cable.Set(muzzlePosition, val, Mathf.Min(num2, 0.6f)); } if ((Object)(object)_hook != (Object)null) { Vector3 val2 = ((Phase == HookPhase.Back) ? (val - muzzlePosition) : ((_shot.Kind == HookKind.Surface && Phase == HookPhase.Latched) ? (-_shot.Normal + _shot.Dir) : (val - muzzlePosition))); if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f) { val2 = _shot.Dir; } _hook.transform.SetPositionAndRotation(val, Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up)); } } private void Play(AudioClip clip, float volume) { if (!((Object)(object)clip == (Object)null) && !((Object)(object)_audio == (Object)null)) { _audio.PlayOneShot(clip, volume * Plugin.Volume.Value); WalkieTalkie.TransmitOneShotAudio(_audio, clip, volume * Plugin.Volume.Value); } } private void PlayAt(AudioClip clip, Vector3 at, float volume) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_004d: 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_0085: Invalid comparison between Unknown and I4 if ((Object)(object)clip == (Object)null) { return; } GameObject val = new GameObject("GrappleHit"); val.transform.position = at; AudioSource val2 = val.AddComponent<AudioSource>(); if ((Object)(object)_audio != (Object)null) { val2.outputAudioMixerGroup = _audio.outputAudioMixerGroup; val2.rolloffMode = _audio.rolloffMode; val2.minDistance = _audio.minDistance; val2.maxDistance = _audio.maxDistance; if ((int)_audio.rolloffMode == 2) { val2.SetCustomCurve((AudioSourceCurveType)0, _audio.GetCustomCurve((AudioSourceCurveType)0)); } } val2.spatialBlend = 1f; val2.PlayOneShot(clip, volume * Plugin.Volume.Value); Object.Destroy((Object)val, clip.length + 0.2f); } } [HarmonyPatch(typeof(GrabbableObject), "UseItemBatteries")] internal static class GrappleUsePatch { private static bool Prefix(GrabbableObject __instance, ref bool __result) { if (!(__instance is GrappleItem)) { return true; } __result = true; return false; } } internal static class MenuHooks { internal const string ModMenuGuid = "daniel.lethalcompany.modmenu"; private const string Tab = "Grapple Hook"; [MethodImpl(MethodImplOptions.NoInlining)] internal static void Register() { MenuApi.Button("Grapple Hook", "Spawn grapple hook", (Func<string>)(() => Registry.Spawn(Player())), true, true, (Func<string>)NotInGame, (string)null); MenuApi.Button("Grapple Hook", "Refill held tank", (Func<string>)RefillHeld, true, true, (Func<string>)NoGunHeld, (string)null); try { AllSettings(); } catch (Exception) { } } [MethodImpl(MethodImplOptions.NoInlining)] private static void AllSettings() { MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.PullItems, "Hook items", true, "off: items hold like walls", (Func<string>)null); MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.PullBodies, "Hook bodies", true, (string)null, (Func<string>)null); MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.Volume, "Volume", false, "yours alone", (Func<string>)null); MenuApi.Tuning((Action)delegate { MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.Price, "Store price", true, "credits; from the next lobby you host", (Func<string>)null); MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.Charges, "Shots per charge", true, (string)null, (Func<string>)null); MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.Range, "Range (m)", true, (string)null, (Func<string>)null); MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.PullSpeed, "Pull speed (m/s)", true, (string)null, (Func<string>)null); MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.MaxPullSeconds, "Longest pull (s)", true, (string)null, (Func<string>)null); MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.YankSpeed, "Item yank speed (m/s)", true, (string)null, (Func<string>)null); MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.ArrivalHop, "Arrival hop", true, "0 = none", (Func<string>)null); MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.GraceSeconds, "No fall damage grace (s)", true, (string)null, (Func<string>)null); MenuApi.Setting("Grapple Hook", (ConfigEntryBase)(object)Plugin.NoiseRange, "Noise range (m)", true, (string)null, (Func<string>)null); }); } private static PlayerControllerB Player() { if (!((Object)(object)GameNetworkManager.Instance != (Object)null)) { return null; } return GameNetworkManager.Instance.localPlayerController; } private static string NotInGame() { if ((Object)(object)Registry.Prefab == (Object)null) { return "grapple item not built"; } PlayerControllerB val = Player(); if (!((Object)(object)val == (Object)null) && !((Object)(object)StartOfRound.Instance == (Object)null)) { if (!val.isPlayerDead) { return null; } return "you're dead"; } return "join a game first"; } private static GrappleItem Held() { PlayerControllerB val = Player(); if (!((Object)(object)val != (Object)null)) { return null; } return val.currentlyHeldObjectServer as GrappleItem; } private static string NoGunHeld() { object obj = NotInGame(); if (obj == null) { if (!((Object)(object)Held() == (Object)null)) { return null; } obj = "hold a grapple hook"; } return (string)obj; } private static string RefillHeld() { GrappleItem grappleItem = Held(); if ((Object)(object)grappleItem == (Object)null) { return "hold a grapple hook"; } ((GrabbableObject)grappleItem).SyncBatteryClientRpc(100); return $"tank full ({Net.Charges} shots)"; } } internal enum HookKind : byte { Miss, Surface, Item, Body } internal struct Shot { public ulong ItemId; public ulong Holder; public ulong TargetId; public HookKind Kind; public Vector3 Point; public Vector3 Normal; public Vector3 Dir; public Vector3 Local; public float Charge; public float PullSpeed; public float MaxSeconds; public float Hop; public float Grace; public float Travel; public Vector3 YankTo; public float YankSeconds; public void Write(FastBufferWriter w) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref ItemId, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref Holder, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref TargetId, default(ForPrimitives)); byte kind = (byte)Kind; ((FastBufferWriter)(ref w)).WriteValueSafe<byte>(ref kind, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe(ref Point); ((FastBufferWriter)(ref w)).WriteValueSafe(ref Normal); ((FastBufferWriter)(ref w)).WriteValueSafe(ref Dir); ((FastBufferWriter)(ref w)).WriteValueSafe(ref Local); ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref Charge, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref PullSpeed, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref MaxSeconds, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref Hop, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref Grace, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref Travel, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe(ref YankTo); ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref YankSeconds, default(ForPrimitives)); } public static Shot Read(FastBufferReader r) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) Shot result = default(Shot); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref result.ItemId, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref result.Holder, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref result.TargetId, default(ForPrimitives)); byte kind = default(byte); ((FastBufferReader)(ref r)).ReadValueSafe<byte>(ref kind, default(ForPrimitives)); result.Kind = (HookKind)kind; ((FastBufferReader)(ref r)).ReadValueSafe(ref result.Point); ((FastBufferReader)(ref r)).ReadValueSafe(ref result.Normal); ((FastBufferReader)(ref r)).ReadValueSafe(ref result.Dir); ((FastBufferReader)(ref r)).ReadValueSafe(ref result.Local); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref result.Charge, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref result.PullSpeed, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref result.MaxSeconds, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref result.Hop, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref result.Grace, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref result.Travel, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe(ref result.YankTo); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref result.YankSeconds, default(ForPrimitives)); return result; } } internal static class Net { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnFireRequest; public static HandleNamedMessageDelegate <1>__OnReleaseRequest; public static HandleNamedMessageDelegate <2>__OnFire; public static HandleNamedMessageDelegate <3>__OnRelease; public static HandleNamedMessageDelegate <4>__OnConfig; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static HandleNamedMessageDelegate <>9__17_0; public static Func<ulong, bool> <>9__21_0; public static Func<ulong, bool> <>9__27_0; public static Action<FastBufferWriter> <>9__29_0; internal void <Register>b__17_0(ulong sender, FastBufferReader r) { SendConfig(sender); } internal bool <HostFire>b__21_0(ulong c) { return c != 0; } internal bool <HostRelease>b__27_0(ulong c) { return c != 0; } internal void <SendConfig>b__29_0(FastBufferWriter w) { //IL_0011: 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_002e: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) int value = Plugin.Price.Value; ((FastBufferWriter)(ref w)).WriteValueSafe<int>(ref value, default(ForPrimitives)); value = Plugin.Charges.Value; ((FastBufferWriter)(ref w)).WriteValueSafe<int>(ref value, default(ForPrimitives)); float value2 = Plugin.Range.Value; ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref value2, default(ForPrimitives)); } } private const string MsgFireRequest = "DanielLC.Grapple.FireRequest"; private const string MsgFire = "DanielLC.Grapple.Fire"; private const string MsgReleaseRequest = "DanielLC.Grapple.ReleaseRequest"; private const string MsgRelease = "DanielLC.Grapple.Release"; private const string MsgConfigRequest = "DanielLC.Grapple.ConfigRequest"; private const string MsgConfig = "DanielLC.Grapple.Config"; private static readonly string[] All = new string[6] { "DanielLC.Grapple.FireRequest", "DanielLC.Grapple.Fire", "DanielLC.Grapple.ReleaseRequest", "DanielLC.Grapple.Release", "DanielLC.Grapple.ConfigRequest", "DanielLC.Grapple.Config" }; internal const float HookSpeed = 70f; private static bool _registered; private static int? _hostCharges; private static float? _hostRange; public static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton != (Object)null) { return NetworkManager.Singleton.IsServer; } return false; } } public static int Charges => Math.Max(1, _hostCharges ?? Plugin.Charges.Value); public static float Range => Mathf.Max(1f, _hostRange ?? Plugin.Range.Value); public static void Register() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; if (_registered || (Object)(object)singleton == (Object)null || singleton.CustomMessagingManager == null) { return; } CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; _hostCharges = null; _hostRange = null; if (singleton.IsServer) { object obj = <>O.<0>__OnFireRequest; if (obj == null) { HandleNamedMessageDelegate val = OnFireRequest; <>O.<0>__OnFireRequest = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Grapple.FireRequest", (HandleNamedMessageDelegate)obj); object obj2 = <>O.<1>__OnReleaseRequest; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReleaseRequest; <>O.<1>__OnReleaseRequest = val2; obj2 = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Grapple.ReleaseRequest", (HandleNamedMessageDelegate)obj2); object obj3 = <>c.<>9__17_0; if (obj3 == null) { HandleNamedMessageDelegate val3 = delegate(ulong sender, FastBufferReader r) { SendConfig(sender); }; <>c.<>9__17_0 = val3; obj3 = (object)val3; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Grapple.ConfigRequest", (HandleNamedMessageDelegate)obj3); } else { object obj4 = <>O.<2>__OnFire; if (obj4 == null) { HandleNamedMessageDelegate val4 = OnFire; <>O.<2>__OnFire = val4; obj4 = (object)val4; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Grapple.Fire", (HandleNamedMessageDelegate)obj4); object obj5 = <>O.<3>__OnRelease; if (obj5 == null) { HandleNamedMessageDelegate val5 = OnRelease; <>O.<3>__OnRelease = val5; obj5 = (object)val5; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Grapple.Release", (HandleNamedMessageDelegate)obj5); object obj6 = <>O.<4>__OnConfig; if (obj6 == null) { HandleNamedMessageDelegate val6 = OnConfig; <>O.<4>__OnConfig = val6; obj6 = (object)val6; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Grapple.Config", (HandleNamedMessageDelegate)obj6); Send("DanielLC.Grapple.ConfigRequest", 0uL, null); } _registered = true; } public static void Unregister() { CustomMessagingManager val = (((Object)(object)NetworkManager.Singleton != (Object)null) ? NetworkManager.Singleton.CustomMessagingManager : null); if (val != null) { string[] all = All; foreach (string text in all) { try { val.UnregisterNamedMessageHandler(text); } catch (Exception) { } } } _registered = false; _hostCharges = null; _hostRange = null; } public static void RequestFire(GrappleItem item, Vector3 eye, Vector3 dir, Aim aim) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) if (IsHost) { HostFire(((NetworkBehaviour)item).NetworkObjectId, eye, dir, aim, 0uL); return; } Send("DanielLC.Grapple.FireRequest", 0uL, delegate(FastBufferWriter w) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //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) ulong networkObjectId = ((NetworkBehaviour)item).NetworkObjectId; ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe(ref eye); ((FastBufferWriter)(ref w)).WriteValueSafe(ref dir); byte kind = (byte)aim.Kind; ((FastBufferWriter)(ref w)).WriteValueSafe<byte>(ref kind, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe(ref aim.Point); ((FastBufferWriter)(ref w)).WriteValueSafe(ref aim.Normal); ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref aim.TargetId, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<int>(ref aim.Part, default(ForPrimitives)); }); } private static void OnFireRequest(ulong sender, FastBufferReader r) { //IL_0006: 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) //IL_0033: 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_0070: 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_0088: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) ulong itemId = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref itemId, default(ForPrimitives)); Vector3 eye = default(Vector3); ((FastBufferReader)(ref r)).ReadValueSafe(ref eye); Vector3 dir = default(Vector3); ((FastBufferReader)(ref r)).ReadValueSafe(ref dir); Aim aim = default(Aim); byte kind = default(byte); ((FastBufferReader)(ref r)).ReadValueSafe<byte>(ref kind, default(ForPrimitives)); aim.Kind = (HookKind)kind; ((FastBufferReader)(ref r)).ReadValueSafe(ref aim.Point); ((FastBufferReader)(ref r)).ReadValueSafe(ref aim.Normal); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref aim.TargetId, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref aim.Part, default(ForPrimitives)); HostFire(itemId, eye, dir, aim, sender); } private static void HostFire(ulong itemId, Vector3 eye, Vector3 dir, Aim aim, ulong sender) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_01df: 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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) GrappleItem grappleItem = FindItem(itemId); if ((Object)(object)grappleItem == (Object)null) { return; } PlayerControllerB playerHeldBy = ((GrabbableObject)grappleItem).playerHeldBy; if ((Object)(object)playerHeldBy == (Object)null || playerHeldBy.actualClientId != sender || playerHeldBy.isPlayerDead) { Plugin.Log.LogInfo((object)"Grapple: shot refused (sender isn't holding it)."); return; } if (grappleItem.Phase != GrappleItem.HookPhase.Idle) { Plugin.Log.LogInfo((object)"Grapple: shot refused (the hook is still out)."); return; } float num = 1f / (float)Charges; if (grappleItem.Charge < num - 0.001f) { Plugin.Log.LogInfo((object)"Grapple: shot refused (tank empty)."); return; } Vector3 val = (((Object)(object)playerHeldBy.gameplayCamera != (Object)null) ? ((Component)playerHeldBy.gameplayCamera).transform.position : (((Component)playerHeldBy).transform.position + Vector3.up * 1.6f)); if (Vector3.Distance(eye, val) > 3f) { eye = val; } dir = ((((Vector3)(ref dir)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref dir)).normalized : ((Component)playerHeldBy).transform.forward); float value = Plugin.Range.Value; Shot shot = new Shot { ItemId = itemId, Holder = sender, Kind = aim.Kind, Dir = dir, Normal = aim.Normal, PullSpeed = Plugin.PullSpeed.Value, MaxSeconds = Plugin.MaxPullSeconds.Value, Hop = Plugin.ArrivalHop.Value, Grace = Plugin.GraceSeconds.Value }; if (!HostCheck(ref shot, aim, eye, dir, value, playerHeldBy)) { shot.Kind = HookKind.Miss; shot.Point = eye + dir * value; shot.TargetId = 0uL; } shot.Charge = Mathf.Max(0f, grappleItem.Charge - num); Vector3 muzzlePosition = grappleItem.MuzzlePosition; shot.Travel = Mathf.Clamp(Vector3.Distance(muzzlePosition, shot.Point) / 70f, 0.05f, 1.5f); NetworkManager singleton = NetworkManager.Singleton; List<ulong> list = singleton.ConnectedClientsIds.Where((ulong c) => c != 0).ToList(); if (list.Count > 0) { FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(256, (Allocator)2, 1024); try { shot.Write(val2); singleton.CustomMessagingManager.SendNamedMessage("DanielLC.Grapple.Fire", (IReadOnlyList<ulong>)list, val2, (NetworkDelivery)3); } finally { ((FastBufferWriter)(ref val2)).Dispose(); } } Plugin.Log.LogInfo((object)$"Grapple: {shot.Kind} at {Vector3.Distance(eye, shot.Point):F1} m, charge {shot.Charge:F2} left."); Apply(shot); } private static bool HostCheck(ref Shot shot, Aim aim, Vector3 eye, Vector3 dir, float range, PlayerControllerB holder) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) if (aim.Kind == HookKind.Miss) { return false; } Vector3 point = aim.Point; float num = Vector3.Distance(eye, point); if (num > range + 2f) { Plugin.Log.LogInfo((object)$"Grapple: hook point {num:F1} m away, past the range."); return false; } Vector3 val = point - eye; Vector3 val2 = point - ((Vector3)(ref val)).normalized * 0.25f; RaycastHit val3 = default(RaycastHit); if (Vector3.Distance(eye, val2) > 0.3f && Physics.Linecast(eye, val2, ref val3, Aiming.WallMask, (QueryTriggerInteraction)1) && Vector3.Distance(((RaycastHit)(ref val3)).point, point) > 1f) { Plugin.Log.LogInfo((object)("Grapple: hook point blocked by " + ((Object)((RaycastHit)(ref val3)).collider).name + ".")); return false; } shot.Point = point; switch (aim.Kind) { case HookKind.Surface: if (!Physics.CheckSphere(point, 0.3f, Aiming.WallMask, (QueryTriggerInteraction)1)) { return false; } shot.Kind = HookKind.Surface; return true; case HookKind.Item: { GrabbableObject val6 = FindGrabbable(aim.TargetId); if ((Object)(object)val6 == (Object)null || !Plugin.PullItems.Value || !Aiming.Yankable(val6) || Vector3.Distance(((Component)val6).transform.position, point) > 2.5f) { shot.Kind = HookKind.Surface; return Physics.CheckSphere(point, 0.4f, Aiming.WallMask | Aiming.PropMask, (QueryTriggerInteraction)1); } shot.Kind = HookKind.Item; shot.TargetId = aim.TargetId; shot.Local = ((Component)val6).transform.InverseTransformPoint(point); shot.YankTo = Aiming.FeetSpot(holder, val6); shot.YankSeconds = Mathf.Clamp(Vector3.Distance(((Component)val6).transform.position, shot.YankTo) / Mathf.Max(1f, Plugin.YankSpeed.Value), 0.25f, 3f); return true; } case HookKind.Body: { GrabbableObject obj = FindGrabbable(aim.TargetId); RagdollGrabbableObject val4 = (RagdollGrabbableObject)(object)((obj is RagdollGrabbableObject) ? obj : null); DeadBodyInfo val5 = (((Object)(object)val4 != (Object)null) ? val4.ragdoll : null); if ((Object)(object)val5 == (Object)null || !Plugin.PullBodies.Value || ((GrabbableObject)val4).isHeld || (Object)(object)val5.attachedTo != (Object)null || val5.bodyParts == null) { return false; } int num2 = Mathf.Clamp(aim.Part, 0, val5.bodyParts.Length - 1); if ((Object)(object)val5.bodyParts[num2] == (Object)null || Vector3.Distance(val5.bodyParts[num2].position, point) > 3f) { return false; } shot.Kind = HookKind.Body; shot.TargetId = aim.TargetId; shot.Local = new Vector3((float)num2, 0f, 0f); shot.MaxSeconds = Mathf.Max(1.5f, shot.MaxSeconds); return true; } default: return false; } } private static void OnFire(ulong sender, FastBufferReader r) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Apply(Shot.Read(r)); } private static void Apply(Shot s) { GrappleItem grappleItem = FindItem(s.ItemId); if (!((Object)(object)grappleItem == (Object)null)) { grappleItem.OnShot(s); } } public static void RequestRelease(GrappleItem item) { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || !singleton.IsListening || (Object)(object)item == (Object)null || (Object)(object)((NetworkBehaviour)item).NetworkObject == (Object)null || !((NetworkBehaviour)item).NetworkObject.IsSpawned) { return; } if (IsHost) { HostRelease(((NetworkBehaviour)item).NetworkObjectId); return; } Send("DanielLC.Grapple.ReleaseRequest", 0uL, delegate(FastBufferWriter w) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ulong networkObjectId = ((NetworkBehaviour)item).NetworkObjectId; ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); }); } private static void OnReleaseRequest(ulong sender, FastBufferReader r) { //IL_0006: 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) ulong id = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref id, default(ForPrimitives)); GrappleItem grappleItem = FindItem(id); if (!((Object)(object)grappleItem == (Object)null) && (!((Object)(object)((GrabbableObject)grappleItem).playerHeldBy != (Object)null) || ((GrabbableObject)grappleItem).playerHeldBy.actualClientId == sender || grappleItem.ShotHolder == sender)) { HostRelease(id); } } internal static void HostRelease(ulong id) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; List<ulong> list = singleton.ConnectedClientsIds.Where((ulong c) => c != 0).ToList(); if (list.Count > 0) { FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(16, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref id, default(ForPrimitives)); singleton.CustomMessagingManager.SendNamedMessage("DanielLC.Grapple.Release", (IReadOnlyList<ulong>)list, val, (NetworkDelivery)3); } finally { ((FastBufferWriter)(ref val)).Dispose(); } } FindItem(id)?.OnRelease(); } private static void OnRelease(ulong sender, FastBufferReader r) { //IL_0006: 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) ulong id = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref id, default(ForPrimitives)); FindItem(id)?.OnRelease(); } private static void SendConfig(ulong client) { Send("DanielLC.Grapple.Config", client, delegate(FastBufferWriter w) { //IL_0011: 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_002e: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) int value = Plugin.Price.Value; ((FastBufferWriter)(ref w)).WriteValueSafe<int>(ref value, default(ForPrimitives)); value = Plugin.Charges.Value; ((FastBufferWriter)(ref w)).WriteValueSafe<int>(ref value, default(ForPrimitives)); float value2 = Plugin.Range.Value; ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref value2, default(ForPrimitives)); }); } private static void OnConfig(ulong sender, FastBufferReader r) { //IL_0006: 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) //IL_0018: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) int num = default(int); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref num, default(ForPrimitives)); int num2 = default(int); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref num2, default(ForPrimitives)); float num3 = default(float); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref num3, default(ForPrimitives)); _hostCharges = num2; _hostRange = num3; Registry.ApplyPrice(num); Plugin.Log.LogInfo((object)$"Grapple: host settings: price {num}, {num2} shots a tank, ra