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 CargoZipline v0.1.0
CargoZipline.dll
Decompiled 14 hours 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.Events; 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("CargoZipline")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+157a67bb2afd0b33c6ae444e34bb3211135f5e79")] [assembly: AssemblyProduct("CargoZipline")] [assembly: AssemblyTitle("CargoZipline")] [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 CargoZipline { internal class Cargo : MonoBehaviour { private class Load { public LineView Line; public GrabbableObject Item; public float T; public float Speed; public float Started; public int Dir; public GameObject Trolley; public AudioSource Roll; } private const float HookDrop = 0.6f; private const float ItemDrop = 0.45f; private const float GrabGrace = 0.8f; private static readonly List<Load> Loads = new List<Load>(); internal static bool Clippable(GrabbableObject g) { if ((Object)(object)g != (Object)null && !(g is ZiplineKit) && !(g is RagdollGrabbableObject) && (Object)(object)g.itemProperties != (Object)null && (Object)(object)((NetworkBehaviour)g).NetworkObject != (Object)null) { return !g.deactivated; } return false; } internal static void Reset() { //IL_0036: 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) foreach (Load load in Loads) { Finish(load, ((Object)(object)load.Item != (Object)null) ? ((Component)load.Item).transform.position : Vector3.zero, drop: true); } Loads.Clear(); } internal static void LineGone(int lineId) { //IL_005d: 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) for (int num = Loads.Count - 1; num >= 0; num--) { Load load = Loads[num]; if (!((Object)(object)load.Line != (Object)null) || load.Line.Data.Id == lineId) { Finish(load, ((Object)(object)load.Item != (Object)null) ? ((Component)load.Item).transform.position : Vector3.zero, drop: true); Loads.RemoveAt(num); } } } internal static void Apply(int lineId, ulong itemId, float t, int dir, float speed) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) LineView lineView = LineView.Get(lineId); GrabbableObject val = Net.FindGrabbable(itemId); if ((Object)(object)lineView == (Object)null || (Object)(object)val == (Object)null) { return; } for (int num = Loads.Count - 1; num >= 0; num--) { if ((Object)(object)Loads[num].Item == (Object)(object)val) { Finish(Loads[num], ((Component)val).transform.position, drop: true); Loads.RemoveAt(num); } } Load load = new Load { Line = lineView, Item = val, T = t, Dir = dir, Speed = Mathf.Max(0.5f, speed), Started = Time.time }; load.Trolley = Registry.MakeTrolley($"ZiplinePulley{itemId}"); if ((Object)(object)load.Trolley != (Object)null) { load.Roll = Registry.Source(load.Trolley, loop: true); load.Roll.clip = Registry.RollClip; load.Roll.volume = 0.6f * Plugin.Volume.Value; load.Roll.pitch = Mathf.Lerp(0.85f, 1.25f, Mathf.Clamp01(speed / 15f)); if ((Object)(object)load.Roll.clip != (Object)null) { load.Roll.Play(); } } Loads.Add(load); Registry.PlayAt(Registry.ClipClip, lineView.Point(t), 1f); Registry.Noise(lineView.Point(t), 0.4f); Plugin.Log.LogInfo((object)string.Format("Zipline: {0} clipped to line {1}, running {2}.", val.itemProperties.itemName, lineId, (dir > 0) ? "to B" : "to A")); } private void LateUpdate() { //IL_0040: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0136: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) Ride.LateTick(); for (int num = Loads.Count - 1; num >= 0; num--) { Load load = Loads[num]; if ((Object)(object)load.Line == (Object)null || (Object)(object)load.Item == (Object)null) { Finish(load, Vector3.zero, drop: false); Loads.RemoveAt(num); } else if (Time.time - load.Started > 0.8f && (load.Item.isHeld || load.Item.isHeldByEnemy || load.Item.isPocketed)) { Finish(load, Vector3.zero, drop: false); Loads.RemoveAt(num); } else { float num2 = ((load.Dir > 0) ? load.Line.TMax : load.Line.TMin); load.T = Mathf.MoveTowards(load.T, num2, load.Speed * Time.deltaTime / Mathf.Max(0.5f, load.Line.Length)); Vector3 val = load.Line.Point(load.T); Vector3 val2 = load.Line.Tangent(load.T) * (float)load.Dir; if ((Object)(object)load.Trolley != (Object)null) { load.Trolley.transform.SetPositionAndRotation(val, Quaternion.LookRotation(val2, Vector3.up)); } Vector3 val3 = val + Vector3.down * 1.05f; if (Mathf.Abs(load.T - num2) < 0.0001f) { Registry.PlayAt(Registry.ArriveClip, val, 0.8f); Finish(load, val3, drop: true); Loads.RemoveAt(num); } else if (!load.Item.isHeld) { Hold(load.Item, val3); } } } } private static void Finish(Load l, Vector3 dropAt, bool drop) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)l.Trolley != (Object)null) { Object.Destroy((Object)(object)l.Trolley); } l.Trolley = null; if (drop && (Object)(object)l.Item != (Object)null && !l.Item.isHeld && !l.Item.isPocketed) { Drop(l.Item, dropAt); } } private static void Hold(GrabbableObject it, Vector3 pos) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (((Object)(object)((Component)it).transform.parent != (Object)null) ? ((Component)it).transform.parent.InverseTransformPoint(pos) : pos); it.fallTime = 1f; it.startFallingPosition = val; it.targetFloorPosition = val; it.reachedFloorTarget = true; it.hasHitGround = true; ((Component)it).transform.position = pos; } private static void Drop(GrabbableObject it, Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0050: 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) Hold(it, pos); it.startFallingPosition = (((Object)(object)((Component)it).transform.parent != (Object)null) ? ((Component)it).transform.parent.InverseTransformPoint(pos) : pos); Vector3 itemFloorPosition = it.GetItemFloorPosition(pos); it.targetFloorPosition = (((Object)(object)((Component)it).transform.parent != (Object)null) ? ((Component)it).transform.parent.InverseTransformPoint(itemFloorPosition) : itemFloorPosition); it.fallTime = 0f; it.floorYRot = -1; it.reachedFloorTarget = false; it.hasHitGround = false; } } internal struct LineData { public int Id; public ulong KitId; public Vector3 A; public Vector3 B; public float Sag; } internal class LineView : MonoBehaviour { internal const float EyeHeight = 3.25f; internal const float Hang = 2.45f; internal const float EndGap = 1.1f; private const float CableRadius = 0.008f; internal static readonly Dictionary<int, LineView> All = new Dictionary<int, LineView>(); internal LineData Data; internal Vector3 EyeA; internal Vector3 EyeB; internal float Length; internal float SagM; private readonly List<InteractTrigger> _triggers = new List<InteractTrigger>(); private string _tip; private CableMesh _cable; internal float TMin => Mathf.Clamp01(1.1f / Mathf.Max(0.1f, Length)); internal float TMax => 1f - TMin; internal static LineView Create(LineData d) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) Remove(d.Id); LineView lineView = new GameObject($"Zipline{d.Id}").AddComponent<LineView>(); lineView.Init(d); All[d.Id] = lineView; return lineView; } internal static void Remove(int id) { if (All.TryGetValue(id, out var value)) { All.Remove(id); if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } } } internal static void ClearAll() { foreach (LineView value in All.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } } All.Clear(); } internal static LineView Get(int id) { if (!All.TryGetValue(id, out var value)) { return null; } return value; } internal Vector3 Point(float t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) return Vector3.Lerp(EyeA, EyeB, t) + Vector3.down * (4f * SagM * t * (1f - t)); } internal Vector3 Tangent(float t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) Vector3 val = EyeB - EyeA + Vector3.down * (4f * SagM * (1f - 2f * t)); if (!(((Vector3)(ref val)).sqrMagnitude > 1E-08f)) { return Vector3.forward; } return ((Vector3)(ref val)).normalized; } internal float Nearest(Vector3 p) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) float num = 0f; float num2 = float.MaxValue; Vector3 val; for (int i = 0; i <= 48; i++) { float num3 = (float)i / 48f; val = Point(num3) - p; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num2) { num2 = sqrMagnitude; num = num3; } } float num4 = 1f / 48f; for (int j = 0; j < 6; j++) { num4 *= 0.5f; float num5 = Mathf.Clamp01(num - num4); float num6 = Mathf.Clamp01(num + num4); val = Point(num5) - p; float sqrMagnitude2 = ((Vector3)(ref val)).sqrMagnitude; val = Point(num6) - p; float sqrMagnitude3 = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude2 < num2) { num2 = sqrMagnitude2; num = num5; } if (sqrMagnitude3 < num2) { num2 = sqrMagnitude3; num = num6; } } return num; } internal static Vector3 Eye(Vector3 foot) { //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_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) return foot + Vector3.up * 3.25f; } private void Init(LineData d) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) Data = d; EyeA = Eye(d.A); EyeB = Eye(d.B); Length = Vector3.Distance(EyeA, EyeB); SagM = Mathf.Clamp(d.Sag, 0f, 0.05f) * Length; Registry.MakePost(((Component)this).transform, d.A, d.B, "PostA"); Registry.MakePost(((Component)this).transform, d.B, d.A, "PostB"); if ((Object)(object)Registry.CableMat != (Object)null) { _cable = CableMesh.Create("Cable", Registry.CableMat, 0.008f, Mathf.Clamp(Mathf.CeilToInt(Length / 1.5f), 8, 64), 6, ((Component)this).transform); _cable.Set(EyeA, EyeB, SagM); } BuildTriggers(); } private void BuildTriggers() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0147: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) int num = LayerMask.NameToLayer("InteractableObject"); int num2 = Mathf.Clamp(Mathf.CeilToInt(Length / 3f), 1, 40); PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); for (int i = 0; i < num2; i++) { float t = Mathf.Lerp(TMin * 0.5f, 1f - TMin * 0.5f, (float)i / (float)num2); float t2 = Mathf.Lerp(TMin * 0.5f, 1f - TMin * 0.5f, (float)(i + 1) / (float)num2); Vector3 val2 = Point(t); Vector3 val3 = Point(t2); GameObject val4 = new GameObject($"Grab{i}"); val4.transform.SetParent(((Component)this).transform, false); Vector3 val5 = val3 - val2; Vector3 val6 = Vector3.ProjectOnPlane(val5, Vector3.up); Vector3 val7 = Vector3.Cross(Vector3.up, (((Vector3)(ref val6)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref val6)).normalized : Vector3.forward); Vector3 val8 = Vector3.Cross(((Vector3)(ref val5)).normalized, val7); Vector3 val9 = ((Vector3)(ref val8)).normalized; if (val9.y < 0f) { val9 = -val9; } val4.transform.SetPositionAndRotation((val2 + val3) * 0.5f - val9 * 0.55f, Quaternion.LookRotation(((Vector3)(ref val5)).normalized, val9)); val4.layer = ((num >= 0) ? num : 9); val4.tag = "InteractTrigger"; BoxCollider obj = val4.AddComponent<BoxCollider>(); ((Collider)obj).isTrigger = true; obj.size = new Vector3(0.8f, 1.5f, ((Vector3)(ref val5)).magnitude + 0.05f); InteractTrigger val10 = val4.AddComponent<InteractTrigger>(); FieldInfo[] fields = typeof(InteractTrigger).GetFields(BindingFlags.Instance | BindingFlags.Public); foreach (FieldInfo fieldInfo in fields) { if (typeof(UnityEventBase).IsAssignableFrom(fieldInfo.FieldType) && fieldInfo.GetValue(val10) == null) { fieldInfo.SetValue(val10, Activator.CreateInstance(fieldInfo.FieldType)); } } val10.hoverTip = "Ride the zipline : [E]"; val10.disabledHoverTip = ""; val10.hoverIcon = (((Object)(object)val != (Object)null) ? val.grabItemIcon : null); val10.interactable = true; val10.oneHandedItemAllowed = true; val10.twoHandedItemAllowed = true; val10.holdInteraction = false; val10.interactCooldown = false; ((UnityEvent<PlayerControllerB>)(object)val10.onInteract).AddListener((UnityAction<PlayerControllerB>)OnGrab); _triggers.Add(val10); } } private void Update() { bool can; string text = TipFor(((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null, out can); if (text == _tip) { return; } _tip = text; foreach (InteractTrigger trigger in _triggers) { if (!((Object)(object)trigger == (Object)null)) { trigger.hoverTip = text; trigger.disabledHoverTip = text; trigger.interactable = can; } } } private static string TipFor(PlayerControllerB me, out bool can) { can = false; if ((Object)(object)me == (Object)null || me.isPlayerDead) { return ""; } if (Ride.Active) { return ""; } GrabbableObject currentlyHeldObjectServer = me.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer != (Object)null && Cargo.Clippable(currentlyHeldObjectServer)) { if (!Net.AllowCargo) { return "Cargo is switched off"; } can = true; return "Clip " + currentlyHeldObjectServer.itemProperties.itemName.ToLowerInvariant() + " to the line : [E]"; } if (!Net.AllowRiding) { return "Riding is switched off"; } can = true; return "Ride the zipline : [E]"; } private void OnGrab(PlayerControllerB player) { //IL_00cd: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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) PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); if ((Object)(object)player == (Object)null || (Object)(object)player != (Object)(object)val || val.isPlayerDead || Ride.Active) { return; } GrabbableObject currentlyHeldObjectServer = val.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer != (Object)null && Cargo.Clippable(currentlyHeldObjectServer)) { if (Net.AllowCargo) { float num = Mathf.Clamp(Nearest(((Component)val.gameplayCamera).transform.position), TMin, TMax); int dir = ((num < 0.5f) ? 1 : (-1)); val.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); Net.RequestCargo(Data.Id, currentlyHeldObjectServer, num, dir); } } else if (Net.AllowRiding) { float t = Mathf.Clamp(Nearest(((Component)val).transform.position + Vector3.up * 2.45f), TMin, TMax); Vector3 val2 = Vector3.ProjectOnPlane(((Component)val.gameplayCamera).transform.forward, Vector3.up); Vector3 val3 = Vector3.ProjectOnPlane(EyeB - EyeA, Vector3.up); int dir2 = ((Vector3.Dot(val2, val3) >= 0f) ? 1 : (-1)); Net.RequestRide(Data.Id, t, dir2); } } private void OnDestroy() { Ride.LineGone(Data.Id); Cargo.LineGone(Data.Id); } } internal static class PendingStakes { internal struct Stake { public Vector3 Foot; public Vector3 Facing; public GameObject Go; } internal static readonly Dictionary<ulong, Stake> All = new Dictionary<ulong, Stake>(); internal static bool Has(ulong kitId) { return All.ContainsKey(kitId); } internal static bool TryGet(ulong kitId, out Stake s) { return All.TryGetValue(kitId, out s); } internal static void Set(ulong kitId, Vector3 foot, Vector3 facing) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_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) Clear(kitId); GameObject val = new GameObject($"ZiplineStake{kitId}"); Registry.MakePost(val.transform, foot, foot + facing, "Post"); All[kitId] = new Stake { Foot = foot, Facing = facing, Go = val }; } internal static void Clear(ulong kitId) { if (All.TryGetValue(kitId, out var value) && (Object)(object)value.Go != (Object)null) { Object.Destroy((Object)(object)value.Go); } All.Remove(kitId); } internal static void ClearAll() { foreach (Stake value in All.Values) { if ((Object)(object)value.Go != (Object)null) { Object.Destroy((Object)(object)value.Go); } } All.Clear(); } } internal static class MenuHooks { internal const string ModMenuGuid = "daniel.lethalcompany.modmenu"; private const string Tab = "Cargo Zipline"; [MethodImpl(MethodImplOptions.NoInlining)] internal static void Register() { MenuApi.Button("Cargo Zipline", "Spawn zipline kit", (Func<string>)(() => Registry.Spawn(Player())), true, true, (Func<string>)NotInGame, (string)null); MenuApi.Button("Cargo Zipline", "Clear lines here", (Func<string>)ClearHere, false, false, (Func<string>)NoLines, (string)null); try { AllSettings(); } catch (Exception) { } } [MethodImpl(MethodImplOptions.NoInlining)] private static void AllSettings() { MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.AllowRiding, "Riding", true, (string)null, (Func<string>)null); MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.AllowCargo, "Cargo", true, "clip scrap to the line", (Func<string>)null); MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.Volume, "Volume", false, "yours alone", (Func<string>)null); MenuApi.Tuning((Action)delegate { MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.Price, "Store price", true, "credits; from the next lobby you host", (Func<string>)null); MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.MaxLength, "Longest line (m)", true, (string)null, (Func<string>)null); MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.MinLength, "Shortest line (m)", true, (string)null, (Func<string>)null); MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.Sag, "Cable sag", true, "share of the length", (Func<string>)null); MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.TopSpeed, "Top speed (m/s)", true, (string)null, (Func<string>)null); MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.CrankSpeed, "Crank speed (m/s)", true, (string)null, (Func<string>)null); MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.Gravity, "Downhill pull", true, (string)null, (Func<string>)null); MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.CargoSpeed, "Cargo speed (m/s)", true, (string)null, (Func<string>)null); MenuApi.Setting("Cargo Zipline", (ConfigEntryBase)(object)Plugin.GraceSeconds, "No fall damage grace (s)", true, (string)null, (Func<string>)null); MenuApi.Setting("Cargo Zipline", (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 "zipline 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 string NoLines() { if (LineView.All.Count != 0 || PendingStakes.All.Count != 0) { return null; } return "no lines up"; } private static string ClearHere() { int num = LineView.All.Count + PendingStakes.All.Count; Net.ClearWorld(); return $"cleared {num} on this game"; } } internal struct RideSpec { public float TopSpeed; public float CrankSpeed; public float Gravity; public float Grace; } internal static class Net { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnPlantRequest; public static HandleNamedMessageDelegate <1>__OnTakeDownRequest; public static HandleNamedMessageDelegate <2>__OnRideRequest; public static HandleNamedMessageDelegate <3>__OnRideEndRequest; public static HandleNamedMessageDelegate <4>__OnCargoRequest; public static HandleNamedMessageDelegate <5>__OnStake; public static HandleNamedMessageDelegate <6>__OnRide; public static HandleNamedMessageDelegate <7>__OnCargo; public static HandleNamedMessageDelegate <8>__OnConfig; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static HandleNamedMessageDelegate <>9__30_0; public static HandleNamedMessageDelegate <>9__30_1; public static HandleNamedMessageDelegate <>9__30_2; public static Func<LineView, int> <>9__39_3; public static Func<LineView, bool> <>9__58_0; public static Func<LineView, LineData> <>9__58_1; public static Func<ulong, bool> <>9__65_0; public static HandleNamedMessageDelegate <>9__67_0; internal void <Register>b__30_0(ulong sender, FastBufferReader r) { SendConfig(sender); } internal void <Register>b__30_1(ulong s, FastBufferReader r) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ApplyLine(ReadLine(r)); } internal void <Register>b__30_2(ulong s, 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) int id = default(int); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref id, default(ForPrimitives)); ApplyLineGone(id); } internal int <HostTakeDown>b__39_3(LineView l) { return l.Data.Id; } internal bool <SendConfig>b__58_0(LineView l) { return (Object)(object)l != (Object)null; } internal LineData <SendConfig>b__58_1(LineView l) { return l.Data; } internal bool <Broadcast>b__65_0(ulong c) { return c != 0; } internal unsafe void <RegisterRefused>b__67_0(ulong s, 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) FixedString128Bytes val = default(FixedString128Bytes); ((FastBufferReader)(ref r)).ReadValueSafe<FixedString128Bytes>(ref val, default(ForFixedStrings)); Tip(((object)(*(FixedString128Bytes*)(&val))/*cast due to .constrained prefix*/).ToString()); } } private const string P = "DanielLC.Zipline."; private const string MsgPlantRequest = "DanielLC.Zipline.PlantRequest"; private const string MsgTakeDownRequest = "DanielLC.Zipline.TakeDownRequest"; private const string MsgStake = "DanielLC.Zipline.Stake"; private const string MsgLine = "DanielLC.Zipline.Line"; private const string MsgLineGone = "DanielLC.Zipline.LineGone"; private const string MsgRideRequest = "DanielLC.Zipline.RideRequest"; private const string MsgRideEndRequest = "DanielLC.Zipline.RideEndRequest"; private const string MsgRide = "DanielLC.Zipline.Ride"; private const string MsgCargoRequest = "DanielLC.Zipline.CargoRequest"; private const string MsgCargo = "DanielLC.Zipline.Cargo"; private const string MsgConfigRequest = "DanielLC.Zipline.ConfigRequest"; private const string MsgConfig = "DanielLC.Zipline.Config"; private static readonly string[] AllNames = new string[12] { "DanielLC.Zipline.PlantRequest", "DanielLC.Zipline.TakeDownRequest", "DanielLC.Zipline.Stake", "DanielLC.Zipline.Line", "DanielLC.Zipline.LineGone", "DanielLC.Zipline.RideRequest", "DanielLC.Zipline.RideEndRequest", "DanielLC.Zipline.Ride", "DanielLC.Zipline.CargoRequest", "DanielLC.Zipline.Cargo", "DanielLC.Zipline.ConfigRequest", "DanielLC.Zipline.Config" }; private static bool _registered; private static int _nextLine = 1; private static bool? _hostRiding; private static bool? _hostCargo; private static float? _hostNoise; private static float? _hostMax; public static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton != (Object)null) { return NetworkManager.Singleton.IsServer; } return false; } } public static bool AllowRiding => _hostRiding ?? Plugin.AllowRiding.Value; public static bool AllowCargo => _hostCargo ?? Plugin.AllowCargo.Value; public static float NoiseRange => _hostNoise ?? Plugin.NoiseRange.Value; public static float MaxLength => _hostMax ?? Plugin.MaxLength.Value; public static void Register() { //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_0144: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_018d: 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_0198: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown //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_0119: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; if (_registered || (Object)(object)singleton == (Object)null || singleton.CustomMessagingManager == null) { return; } CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; ClearHostValues(); if (singleton.IsServer) { object obj = <>O.<0>__OnPlantRequest; if (obj == null) { HandleNamedMessageDelegate val = OnPlantRequest; <>O.<0>__OnPlantRequest = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.PlantRequest", (HandleNamedMessageDelegate)obj); object obj2 = <>O.<1>__OnTakeDownRequest; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnTakeDownRequest; <>O.<1>__OnTakeDownRequest = val2; obj2 = (object)val2; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.TakeDownRequest", (HandleNamedMessageDelegate)obj2); object obj3 = <>O.<2>__OnRideRequest; if (obj3 == null) { HandleNamedMessageDelegate val3 = OnRideRequest; <>O.<2>__OnRideRequest = val3; obj3 = (object)val3; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.RideRequest", (HandleNamedMessageDelegate)obj3); object obj4 = <>O.<3>__OnRideEndRequest; if (obj4 == null) { HandleNamedMessageDelegate val4 = OnRideEndRequest; <>O.<3>__OnRideEndRequest = val4; obj4 = (object)val4; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.RideEndRequest", (HandleNamedMessageDelegate)obj4); object obj5 = <>O.<4>__OnCargoRequest; if (obj5 == null) { HandleNamedMessageDelegate val5 = OnCargoRequest; <>O.<4>__OnCargoRequest = val5; obj5 = (object)val5; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.CargoRequest", (HandleNamedMessageDelegate)obj5); object obj6 = <>c.<>9__30_0; if (obj6 == null) { HandleNamedMessageDelegate val6 = delegate(ulong sender, FastBufferReader r) { SendConfig(sender); }; <>c.<>9__30_0 = val6; obj6 = (object)val6; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.ConfigRequest", (HandleNamedMessageDelegate)obj6); } else { object obj7 = <>O.<5>__OnStake; if (obj7 == null) { HandleNamedMessageDelegate val7 = OnStake; <>O.<5>__OnStake = val7; obj7 = (object)val7; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.Stake", (HandleNamedMessageDelegate)obj7); object obj8 = <>c.<>9__30_1; if (obj8 == null) { HandleNamedMessageDelegate val8 = delegate(ulong s, FastBufferReader r) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ApplyLine(ReadLine(r)); }; <>c.<>9__30_1 = val8; obj8 = (object)val8; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.Line", (HandleNamedMessageDelegate)obj8); object obj9 = <>c.<>9__30_2; if (obj9 == null) { HandleNamedMessageDelegate val9 = delegate(ulong s, 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) int id = default(int); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref id, default(ForPrimitives)); ApplyLineGone(id); }; <>c.<>9__30_2 = val9; obj9 = (object)val9; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.LineGone", (HandleNamedMessageDelegate)obj9); object obj10 = <>O.<6>__OnRide; if (obj10 == null) { HandleNamedMessageDelegate val10 = OnRide; <>O.<6>__OnRide = val10; obj10 = (object)val10; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.Ride", (HandleNamedMessageDelegate)obj10); object obj11 = <>O.<7>__OnCargo; if (obj11 == null) { HandleNamedMessageDelegate val11 = OnCargo; <>O.<7>__OnCargo = val11; obj11 = (object)val11; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.Cargo", (HandleNamedMessageDelegate)obj11); object obj12 = <>O.<8>__OnConfig; if (obj12 == null) { HandleNamedMessageDelegate val12 = OnConfig; <>O.<8>__OnConfig = val12; obj12 = (object)val12; } customMessagingManager.RegisterNamedMessageHandler("DanielLC.Zipline.Config", (HandleNamedMessageDelegate)obj12); Send("DanielLC.Zipline.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[] allNames = AllNames; foreach (string text in allNames) { try { val.UnregisterNamedMessageHandler(text); } catch (Exception) { } } } _registered = false; ClearHostValues(); } private static void ClearHostValues() { _hostRiding = (_hostCargo = null); _hostNoise = (_hostMax = null); } public static void RequestPlant(ulong kitId, Vector3 point, Vector3 facing) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (IsHost) { HostPlant(kitId, point, facing, 0uL); return; } Send("DanielLC.Zipline.PlantRequest", 0uL, delegate(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) ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref kitId, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe(ref point); ((FastBufferWriter)(ref w)).WriteValueSafe(ref facing); }); } private static void OnPlantRequest(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_0025: 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) ulong kitId = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref kitId, default(ForPrimitives)); Vector3 point = default(Vector3); ((FastBufferReader)(ref r)).ReadValueSafe(ref point); Vector3 facing = default(Vector3); ((FastBufferReader)(ref r)).ReadValueSafe(ref facing); HostPlant(kitId, point, facing, sender); } private static void HostPlant(ulong kitId, Vector3 point, Vector3 facing, ulong sender) { //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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_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_00d1: 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_00ed: 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_0112: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: 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_027e: 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_02a4: 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_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: 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_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) ZiplineKit ziplineKit = FindGrabbable(kitId) as ZiplineKit; PlayerControllerB val = (((Object)(object)ziplineKit != (Object)null) ? ((GrabbableObject)ziplineKit).playerHeldBy : null); if ((Object)(object)val == (Object)null || val.actualClientId != sender || val.isPlayerDead) { Refuse(sender, "Hold the kit to plant a stake."); return; } if (Vector3.Distance(((Object)(object)val.gameplayCamera != (Object)null) ? ((Component)val.gameplayCamera).transform.position : (((Component)val).transform.position + Vector3.up * 1.6f), point) > 7f) { Refuse(sender, "That's out of reach."); return; } int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault; RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(point + Vector3.up * 0.6f, Vector3.down, ref val2, 1.5f, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) || ((RaycastHit)(ref val2)).normal.y < 0.6f) { Refuse(sender, "A stake needs flat, solid ground."); return; } Vector3 foot = ((RaycastHit)(ref val2)).point; facing = Vector3.ProjectOnPlane(facing, Vector3.up); facing = ((((Vector3)(ref facing)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref facing)).normalized : Vector3.forward); if (ziplineKit.StakesLeft == 0) { Refuse(sender, "Both stakes are in."); return; } if (!PendingStakes.TryGet(kitId, out var s)) { if (Physics.Raycast(foot + Vector3.up * 0.1f, Vector3.up, 3.25f, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Refuse(sender, "No room for the post to stand here."); return; } Broadcast("DanielLC.Zipline.Stake", delegate(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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref kitId, default(ForPrimitives)); bool flag = true; ((FastBufferWriter)(ref w)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); flag = false; ((FastBufferWriter)(ref w)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe(ref foot); ((FastBufferWriter)(ref w)).WriteValueSafe(ref facing); }, delegate { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ApplyStake(kitId, on: true, foot, facing); }); Plugin.Log.LogInfo((object)$"Zipline: stake A in at {foot}."); return; } float num = Vector3.Distance(s.Foot, foot); float value = Plugin.MaxLength.Value; float value2 = Plugin.MinLength.Value; if (num > value) { Refuse(sender, $"Too far: {num:F0} m. The cable reaches {value:F0} m."); return; } if (num < value2) { Refuse(sender, $"Too close to stake A. Walk at least {value2:F0} m away."); return; } if (Physics.Raycast(foot + Vector3.up * 0.1f, Vector3.up, 3.25f, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Refuse(sender, "No room for the post to stand here."); return; } Vector3 val3 = LineView.Eye(s.Foot); Vector3 val4 = LineView.Eye(foot); Vector3 val5 = val4 - val3; Vector3 normalized = ((Vector3)(ref val5)).normalized; RaycastHit val6 = default(RaycastHit); if (Physics.Linecast(val3 + normalized * 0.3f, val4 - normalized * 0.3f, ref val6, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Refuse(sender, "Something is in the way of the cable (" + Clean(((Object)((RaycastHit)(ref val6)).collider).name) + ")."); return; } LineData d = new LineData { Id = _nextLine++, KitId = kitId, A = s.Foot, B = foot, Sag = Plugin.Sag.Value }; Broadcast("DanielLC.Zipline.Stake", delegate(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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref kitId, default(ForPrimitives)); bool flag = false; ((FastBufferWriter)(ref w)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); flag = false; ((FastBufferWriter)(ref w)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); Vector3 zero = Vector3.zero; ((FastBufferWriter)(ref w)).WriteValueSafe(ref zero); zero = Vector3.zero; ((FastBufferWriter)(ref w)).WriteValueSafe(ref zero); }, delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) ApplyStake(kitId, on: false, Vector3.zero, Vector3.zero); }); Broadcast("DanielLC.Zipline.Line", delegate(FastBufferWriter w) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) WriteLine(w, d); }, delegate { ApplyLine(d); }); Plugin.Log.LogInfo((object)$"Zipline: line {d.Id} strung, {num:F1} m."); } private static string Clean(string n) { if (!string.IsNullOrEmpty(n)) { return n.Replace("(Clone)", "").Trim(); } return "a wall"; } public static void RequestTakeDown(ulong kitId) { if (IsHost) { HostTakeDown(kitId, 0uL); return; } Send("DanielLC.Zipline.TakeDownRequest", 0uL, delegate(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) ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref kitId, default(ForPrimitives)); }); } private static void OnTakeDownRequest(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 kitId = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref kitId, default(ForPrimitives)); HostTakeDown(kitId, sender); } private static void HostTakeDown(ulong kitId, ulong sender) { ZiplineKit ziplineKit = FindGrabbable(kitId) as ZiplineKit; if ((Object)(object)ziplineKit == (Object)null || (Object)(object)((GrabbableObject)ziplineKit).playerHeldBy == (Object)null || ((GrabbableObject)ziplineKit).playerHeldBy.actualClientId != sender) { return; } if (PendingStakes.Has(kitId)) { Broadcast("DanielLC.Zipline.Stake", delegate(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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref kitId, default(ForPrimitives)); bool flag = false; ((FastBufferWriter)(ref w)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); flag = true; ((FastBufferWriter)(ref w)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); Vector3 zero = Vector3.zero; ((FastBufferWriter)(ref w)).WriteValueSafe(ref zero); zero = Vector3.zero; ((FastBufferWriter)(ref w)).WriteValueSafe(ref zero); }, delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) ApplyStake(kitId, on: false, Vector3.zero, Vector3.zero, pulled: true); }); } foreach (int item in (from l in LineView.All.Values where (Object)(object)l != (Object)null && l.Data.KitId == kitId select l.Data.Id).ToList()) { int id = item; Broadcast("DanielLC.Zipline.LineGone", delegate(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) ((FastBufferWriter)(ref w)).WriteValueSafe<int>(ref id, default(ForPrimitives)); }, delegate { ApplyLineGone(id); }); } Plugin.Log.LogInfo((object)$"Zipline: kit {kitId} taken down."); } private static void OnStake(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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_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) ulong kitId = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref kitId, default(ForPrimitives)); bool flag = default(bool); ((FastBufferReader)(ref r)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); bool pulled = default(bool); ((FastBufferReader)(ref r)).ReadValueSafe<bool>(ref pulled, default(ForPrimitives)); Vector3 foot = default(Vector3); ((FastBufferReader)(ref r)).ReadValueSafe(ref foot); Vector3 facing = default(Vector3); ((FastBufferReader)(ref r)).ReadValueSafe(ref facing); ApplyStake(kitId, flag, foot, facing, pulled); } private static void ApplyStake(ulong kitId, bool on, Vector3 foot, Vector3 facing, bool pulled = false) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_001c: 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_0030: 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_0060: Unknown result type (might be due to invalid IL or missing references) if (on) { PendingStakes.Set(kitId, foot, facing); Registry.PlayAt(Registry.PlantClip, foot, 1f); Fx.Puff(foot + Vector3.up * 0.05f, Vector3.up, 0.6f, 5); Registry.Noise(foot, 0.6f); } else { if (pulled && PendingStakes.TryGet(kitId, out var s)) { Registry.PlayAt(Registry.TakeDownClip, s.Foot, 0.9f); } PendingStakes.Clear(kitId); } } private static void ApplyLine(LineData d) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_0051: 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) LineView lineView = LineView.Create(d); Registry.PlayAt(Registry.PlantClip, d.B, 1f); Fx.Puff(d.B + Vector3.up * 0.05f, Vector3.up, 0.6f, 5); Registry.PlayAt(Registry.TwangClip, lineView.Point(0.5f), 1f); Registry.Noise(d.B, 0.6f); } private static void ApplyLineGone(int id) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) LineView lineView = LineView.Get(id); if ((Object)(object)lineView != (Object)null) { Registry.PlayAt(Registry.TakeDownClip, lineView.Data.B, 0.9f); } LineView.Remove(id); } private static void WriteLine(FastBufferWriter w, LineData d) { //IL_000b: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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) ((FastBufferWriter)(ref w)).WriteValueSafe<int>(ref d.Id, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref d.KitId, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe(ref d.A); ((FastBufferWriter)(ref w)).WriteValueSafe(ref d.B); ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref d.Sag, default(ForPrimitives)); } private static LineData ReadLine(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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) LineData result = default(LineData); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref result.Id, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref result.KitId, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe(ref result.A); ((FastBufferReader)(ref r)).ReadValueSafe(ref result.B); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref result.Sag, default(ForPrimitives)); return result; } public static void RequestRide(int lineId, float t, int dir) { if (IsHost) { HostRide(lineId, t, dir, 0uL); return; } Send("DanielLC.Zipline.RideRequest", 0uL, delegate(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) ((FastBufferWriter)(ref w)).WriteValueSafe<int>(ref lineId, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<float>(ref t, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<int>(ref dir, default(ForPrimitives)); }); } private static void OnRideRequest(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 lineId = default(int); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref lineId, default(ForPrimitives)); float t = default(float); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref t, default(ForPrimitives)); int dir = default(int); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref dir, default(ForPrimitives)); HostRide(lineId, t, dir, sender); } private static void HostRide(int lineId, float t, int dir, ulong sender) { //IL_007d: 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_008c: 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_009d: Unknown result type (might be due to invalid IL or missing references) LineView lineView = LineView.Get(lineId); PlayerControllerB val = Player(sender); if ((Object)(object)lineView == (Object)null || (Object)(object)val == (Object)null || val.isPlayerDead || !Plugin.AllowRiding.Value) { return; } t = Mathf.Clamp(t, lineView.TMin, lineView.TMax); if (Vector3.Distance(((Component)val).transform.position + Vector3.up * 2.45f, lineView.Point(t)) > 4.5f) { Plugin.Log.LogInfo((object)"Zipline: ride refused (too far from the cable)."); return;