Decompiled source of HeroWobbly Steam v2.0.1
plugins/HeroWobbly.dll
Decompiled 2 weeks 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using HawkNetworking; using Rewired; using Rewired.Platforms.Windows.XInput; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace HeroWobbly; internal static class PowerMath { public static float Clamp(float value, float min, float max) { if (!float.IsNaN(value) && !float.IsInfinity(value)) { return Math.Max(min, Math.Min(max, value)); } return min; } public static float RopeAcceleration(float distance, float length, float outwardSpeed) { if (!(distance <= length)) { return Clamp((distance - length) * 32f + outwardSpeed * 7f, 0f, 140f); } return 0f; } public static float Axis(short value) { float value2 = Clamp((float)value / 32767f, -1f, 1f); if (!(Math.Abs(value2) < 0.18f)) { return (float)Math.Sign(value2) * (Math.Abs(value2) - 0.18f) / 0.82f; } return 0f; } public static bool Pressed(ushort now, ushort before, ushort button) { if ((now & button) != 0) { return (before & button) == 0; } return false; } } internal sealed class Controls { private struct Gamepad { public ushort buttons; public byte lt; public byte rt; public short lx; public short ly; public short rx; public short ry; } private struct State { public uint packet; public Gamepad pad; } public const ushort Up = 1; public const ushort Down = 2; public const ushort Left = 4; public const ushort Right = 8; public const ushort LB = 256; public const ushort RB = 512; public const ushort A = 4096; public const ushort B = 8192; public const ushort X = 16384; public const ushort Y = 32768; private ushort current; private ushort previous; public bool Connected { get; private set; } public bool Trigger { get; private set; } public bool PreviousTrigger { get; private set; } public bool LeftTrigger { get; private set; } public float Horizontal { get; private set; } public float Vertical { get; private set; } [DllImport("xinput1_4.dll", EntryPoint = "XInputGetState")] private static extern uint GetState(uint index, out State state); [DllImport("xinput9_1_0.dll", EntryPoint = "XInputGetState")] private static extern uint GetLegacyState(uint index, out State state); public void Poll(int index) { if (index < 0) { Feed(connected: false, 0, 0, 0, 0, 0); return; } uint num; State state; try { num = GetState((uint)index, out state); } catch (DllNotFoundException) { num = GetLegacyState((uint)index, out state); } Feed(num == 0, state.pad.buttons, state.pad.rt, state.pad.lt, state.pad.lx, state.pad.ly); } internal void Feed(bool connected, ushort buttons, byte rt, byte lt, short lx, short ly) { bool connected2 = Connected; previous = current; PreviousTrigger = Trigger; Connected = connected; current = (ushort)(connected ? buttons : 0); Trigger = connected && rt > (Trigger ? 75 : 110); LeftTrigger = connected && lt > 100; Horizontal = (connected ? PowerMath.Axis(lx) : 0f); Vertical = (connected ? PowerMath.Axis(ly) : 0f); if (connected && !connected2) { previous = current; PreviousTrigger = Trigger; } } public bool Held(ushort button) { return (current & button) != 0; } public bool DownNow(ushort button) { return PowerMath.Pressed(current, previous, button); } } internal sealed class Costume : IDisposable { private readonly PlayerCharacter character; private readonly Hero hero; private readonly List<GameObject> pieces = new List<GameObject>(); private readonly Dictionary<Renderer, bool> hidden = new Dictionary<Renderer, bool>(); private readonly HashSet<Renderer> ours = new HashSet<Renderer>(); private readonly List<Material> materials = new List<Material>(); private Material red; private Material blue; private Material black; private Material white; private Material gold; private readonly List<Mesh> meshes = new List<Mesh>(); private bool replaceBody; public Costume(PlayerCharacter player, Hero selectedHero) { character = player; hero = selectedHero; try { Build(); } catch { Dispose(); throw; } } private Material MakeMaterial(Color color) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Standard") ?? Shader.Find("Unlit/Color"); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("Costume shader missing."); } Material val2 = new Material(val); val2.color = color; if (val2.HasProperty("_Glossiness")) { val2.SetFloat("_Glossiness", 0.18f); } materials.Add(val2); return val2; } private GameObject Shape(PrimitiveType primitive, Transform parent, Vector3 position, Quaternion rotation, Vector3 scale, Material material) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) GameObject val = GameObject.CreatePrimitive(primitive); pieces.Add(val); ((Object)val).name = "SpiderWobbly Costume"; val.layer = 2; Collider component = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component)) { component.enabled = false; Object.Destroy((Object)(object)component); } val.transform.SetParent(parent, false); val.transform.localPosition = position; val.transform.localRotation = rotation; val.transform.localScale = scale; Renderer component2 = val.GetComponent<Renderer>(); component2.sharedMaterial = material; ours.Add(component2); return val; } private void Line(Transform parent, Vector3[] points, float width, Material material) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GameObject val = new GameObject("SpiderWobbly Suit Detail"); pieces.Add(val); val.layer = 2; val.transform.SetParent(parent, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); ours.Add((Renderer)(object)val2); val2.useWorldSpace = false; ((Renderer)val2).sharedMaterial = material; val2.positionCount = points.Length; float startWidth = (val2.endWidth = width); val2.startWidth = startWidth; val2.numCapVertices = 2; val2.SetPositions(points); } private void Build() { //IL_000d: 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_0049: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_029a: 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_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) red = MakeMaterial(HeroSession.ColorOf(hero.MainColor)); blue = MakeMaterial(HeroSession.ColorOf(hero.SecondColor)); black = MakeMaterial(new Color(0.012f, 0.015f, 0.025f)); white = MakeMaterial(new Color(0.96f, 0.98f, 1f)); gold = MakeMaterial(new Color(1f, 0.73f, 0.12f)); PlayerBody playerBody = character.GetPlayerBody(); RagdollPart head = playerBody.GetHead(); int num = 0; foreach (RagdollPart ragdollPart in playerBody.GetRagdollParts()) { if (!Object.op_Implicit((Object)(object)ragdollPart)) { continue; } Rigidbody rigidbody = ragdollPart.GetRigidbody(); if (!Object.op_Implicit((Object)(object)rigidbody)) { continue; } string text = ((Object)ragdollPart).name.ToLowerInvariant(); bool flag = text.Contains("leg") || text.Contains("hip") || text.Contains("upperarm") || text.Contains("thigh"); Material material = (((Object)(object)ragdollPart == (Object)(object)head) ? red : (flag ? blue : red)); Collider[] components = ((Component)rigidbody).GetComponents<Collider>(); foreach (Collider val in components) { if (Object.op_Implicit((Object)(object)val) && !val.isTrigger) { SphereCollider val2 = (SphereCollider)(object)((val is SphereCollider) ? val : null); CapsuleCollider val3 = (CapsuleCollider)(object)((val is CapsuleCollider) ? val : null); BoxCollider val4 = (BoxCollider)(object)((val is BoxCollider) ? val : null); if (Object.op_Implicit((Object)(object)val2)) { Shape((PrimitiveType)0, ((Component)val).transform, val2.center, Quaternion.identity, Vector3.one * val2.radius * 2.08f, material); num++; } else if (Object.op_Implicit((Object)(object)val3)) { Quaternion rotation = ((val3.direction == 0) ? Quaternion.Euler(0f, 0f, 90f) : ((val3.direction == 2) ? Quaternion.Euler(90f, 0f, 0f) : Quaternion.identity)); Shape((PrimitiveType)1, ((Component)val).transform, val3.center, rotation, new Vector3(val3.radius * 2.06f, val3.height * 0.515f, val3.radius * 2.06f), material); num++; } else if (Object.op_Implicit((Object)(object)val4)) { Shape((PrimitiveType)0, ((Component)val).transform, val4.center, Quaternion.identity, val4.size * 1.15f, material); num++; } } } } replaceBody = num >= 7; if (Object.op_Implicit((Object)(object)head)) { Mask(head); } Transform hip = (Object.op_Implicit((Object)(object)playerBody.GetRigidbody()) ? ((Component)playerBody.GetRigidbody()).transform : ((Component)character.GetHipRigidbody()).transform); if (hero.Symbol == "spider") { Emblem(hip); } else { HeroEmblem(hip); } Accessories(playerBody, hip); RefreshHiddenRenderers(); } private void Mask(RagdollPart head) { //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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_0068: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)head).transform; Collider component = ((Component)head).GetComponent<Collider>(); Vector3 val; if (!Object.op_Implicit((Object)(object)component)) { val = Vector3.zero; } else { Bounds bounds = component.bounds; val = transform.InverseTransformPoint(((Bounds)(ref bounds)).center); } Vector3 position = val; SphereCollider val2 = (SphereCollider)(object)((component is SphereCollider) ? component : null); float num = (Object.op_Implicit((Object)(object)val2) ? (val2.radius * 1.06f) : 0.29f); if (Object.op_Implicit((Object)(object)component) && !Object.op_Implicit((Object)(object)val2)) { Bounds bounds2 = component.bounds; float x = ((Bounds)(ref bounds2)).extents.x; Bounds bounds3 = component.bounds; num = Mathf.Max(x, ((Bounds)(ref bounds3)).extents.z) / Mathf.Max(0.01f, Mathf.Abs(transform.lossyScale.x)) * 1.05f; } num = Mathf.Clamp(num, 0.12f, 0.8f); Quaternion rotation = Quaternion.Inverse(transform.rotation) * Quaternion.LookRotation(character.GetPlayerForward(), Vector3.up); bool flag = hero.Name == "Superman" || hero.Name == "Thor" || hero.Name == "Aquaman" || hero.Name == "Wonder Woman" || hero.Name == "Doctor Strange" || hero.Name == "Scarlet Witch"; Material material = (flag ? MakeMaterial(new Color(0.9f, 0.66f, 0.46f)) : red); GameObject val3 = Shape((PrimitiveType)0, transform, position, rotation, Vector3.one * num * 2f, material); Transform transform2 = val3.transform; if (flag) { Shape((PrimitiveType)0, transform2, new Vector3(0f, 0.29f, -0.05f), Quaternion.identity, new Vector3(0.95f, 0.45f, 0.87f), (hero.Name == "Thor") ? gold : black); } if (hero.Name == "Iron Man") { Shape((PrimitiveType)0, transform2, new Vector3(0f, 0f, 0.25f), Quaternion.identity, new Vector3(0.8f, 0.86f, 0.56f), gold); } for (int i = -1; i <= 1; i += 2) { Quaternion rotation2 = Quaternion.Euler(0f, (float)(i * 20), (float)(i * -18)); Shape((PrimitiveType)0, transform2, new Vector3((float)i * 0.19f, 0.07f, 0.423f), rotation2, new Vector3(0.29f, flag ? 0.16f : 0.29f, 0.055f), black); Shape((PrimitiveType)0, transform2, new Vector3((float)i * 0.19f, 0.077f, 0.448f), rotation2, new Vector3(0.225f, flag ? 0.1f : 0.21f, 0.028f), white); if (hero.Symbol == "bat" || hero.Symbol == "claw") { Shape((PrimitiveType)1, transform2, new Vector3((float)i * 0.29f, 0.51f, -0.04f), Quaternion.Euler(0f, 0f, (float)(i * -12)), new Vector3(0.15f, 0.21f, 0.16f), red); } if (hero.Symbol == "bolt") { Line(transform2, (Vector3[])(object)new Vector3[3] { new Vector3((float)i * 0.44f, 0.1f, 0.1f), new Vector3((float)i * 0.66f, 0.21f, 0.1f), new Vector3((float)i * 0.55f, -0.04f, 0.1f) }, 0.06f, gold); } } if (hero.Symbol == "crown" || hero.Symbol == "W") { Line(transform2, (Vector3[])(object)new Vector3[5] { new Vector3(-0.4f, 0.3f, 0.32f), new Vector3(-0.23f, 0.5f, 0.32f), new Vector3(0f, 0.23f, 0.47f), new Vector3(0.23f, 0.5f, 0.32f), new Vector3(0.4f, 0.3f, 0.32f) }, 0.07f, (hero.Symbol == "W") ? gold : red); } if (hero.Symbol != "spider") { return; } for (int j = 0; j < 8; j++) { float num2 = (float)j * (float)Math.PI / 4f; Vector3[] array = (Vector3[])(object)new Vector3[25]; for (int k = 0; k < array.Length; k++) { float num3 = -1.4765486f + 2.953097f * (float)k / (float)(array.Length - 1); ref Vector3 reference = ref array[k]; reference = new Vector3(Mathf.Cos(num3) * Mathf.Sin(num2), Mathf.Sin(num3), Mathf.Cos(num3) * Mathf.Cos(num2)) * 0.505f; } Line(transform2, array, 0.008f, black); } for (int l = -2; l <= 2; l++) { float num4 = (float)l * 0.38f; Vector3[] array2 = (Vector3[])(object)new Vector3[33]; for (int m = 0; m < array2.Length; m++) { float num5 = (float)m * (float)Math.PI * 2f / (float)(array2.Length - 1); ref Vector3 reference2 = ref array2[m]; reference2 = new Vector3(Mathf.Cos(num4) * Mathf.Sin(num5), Mathf.Sin(num4), Mathf.Cos(num4) * Mathf.Cos(num5)) * 0.506f; } Line(transform2, array2, 0.008f, black); } } private void Emblem(Transform hip) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_012e: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SpiderWobbly Chest Emblem"); pieces.Add(val); val.transform.SetParent(hip, false); val.transform.localRotation = Quaternion.Inverse(hip.rotation) * Quaternion.LookRotation(character.GetPlayerForward(), Vector3.up); val.transform.localPosition = Vector3.zero; Transform transform = val.transform; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f, 0.22f, 0.25f); Shape((PrimitiveType)0, transform, val2, Quaternion.identity, new Vector3(0.09f, 0.13f, 0.024f), black); Shape((PrimitiveType)0, transform, val2 + Vector3.up * 0.08f, Quaternion.identity, new Vector3(0.06f, 0.06f, 0.025f), black); for (int i = -1; i <= 1; i += 2) { for (int j = 0; j < 4; j++) { float num = 0.07f - (float)j * 0.045f; Line(transform, (Vector3[])(object)new Vector3[3] { val2 + new Vector3((float)i * 0.02f, num, 0f), val2 + new Vector3((float)i * 0.13f, num + ((j < 2) ? 0.07f : (-0.04f)), 0.01f), val2 + new Vector3((float)i * 0.16f, num + ((j < 2) ? 0.15f : (-0.12f)), 0f) }, 0.017f, black); } } } public void RefreshHiddenRenderers() { if (!Object.op_Implicit((Object)(object)character) || !replaceBody) { return; } Renderer[] componentsInChildren = ((Component)character).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && !ours.Contains(val) && (val is SkinnedMeshRenderer || val is MeshRenderer)) { if (!hidden.ContainsKey(val)) { hidden.Add(val, val.enabled); } val.enabled = false; } } } public void Dispose() { foreach (KeyValuePair<Renderer, bool> item in hidden) { if (Object.op_Implicit((Object)(object)item.Key)) { item.Key.enabled = item.Value; } } hidden.Clear(); foreach (GameObject piece in pieces) { if (Object.op_Implicit((Object)(object)piece)) { piece.SetActive(false); Object.Destroy((Object)(object)piece); } } pieces.Clear(); foreach (Material material in materials) { if (Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)material); } } materials.Clear(); ours.Clear(); foreach (Mesh mesh in meshes) { if (Object.op_Implicit((Object)(object)mesh)) { Object.Destroy((Object)(object)mesh); } } meshes.Clear(); } private Transform DetailRoot(Transform parent, string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); pieces.Add(val); val.layer = 2; val.transform.SetParent(parent, false); val.transform.localRotation = Quaternion.Inverse(parent.rotation) * Quaternion.LookRotation(character.GetPlayerForward(), Vector3.up); return val.transform; } private void HeroEmblem(Transform hip) { //IL_002f: 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_00bc: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: 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_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_0260: 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_060a: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) Transform parent = DetailRoot(hip, "HeroWobbly Emblem"); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, 0.24f, 0.265f); Material material = MakeMaterial(HeroSession.ColorOf(hero.EnergyColor)); if (hero.Symbol == "reactor" || hero.Symbol == "ring" || hero.Symbol == "lantern") { Vector3[] array = (Vector3[])(object)new Vector3[25]; for (int i = 0; i < array.Length; i++) { float num = (float)i * (float)Math.PI / 12f; ref Vector3 reference = ref array[i]; reference = val + new Vector3(Mathf.Cos(num), Mathf.Sin(num), 0f) * 0.105f; } Line(parent, array, 0.026f, material); Shape((PrimitiveType)0, parent, val, Quaternion.identity, new Vector3(0.08f, 0.08f, 0.025f), white); } else if (hero.Symbol == "bolt") { Line(parent, (Vector3[])(object)new Vector3[4] { val + new Vector3(0.08f, 0.16f, 0f), val + new Vector3(-0.06f, 0.01f, 0f), val + new Vector3(0.05f, 0.01f, 0f), val + new Vector3(-0.07f, -0.16f, 0f) }, 0.045f, gold); } else if (hero.Symbol == "star") { Vector3[] array2 = (Vector3[])(object)new Vector3[11]; for (int j = 0; j < 11; j++) { float num2 = (float)j * (float)Math.PI / 5f + (float)Math.PI / 2f; ref Vector3 reference2 = ref array2[j]; reference2 = val + new Vector3(Mathf.Cos(num2), Mathf.Sin(num2), 0f) * ((j % 2 == 0) ? 0.14f : 0.06f); } Line(parent, array2, 0.035f, white); } else if (hero.Symbol == "bat") { Line(parent, (Vector3[])(object)new Vector3[7] { val + new Vector3(-0.2f, 0.09f, 0f), val + new Vector3(-0.11f, -0.07f, 0f), val + new Vector3(-0.06f, 0.03f, 0f), val + new Vector3(0f, -0.11f, 0f), val + new Vector3(0.06f, 0.03f, 0f), val + new Vector3(0.11f, -0.07f, 0f), val + new Vector3(0.2f, 0.09f, 0f) }, 0.055f, gold); } else if (hero.Symbol == "S") { Line(parent, (Vector3[])(object)new Vector3[6] { val + new Vector3(0.1f, 0.13f, 0f), val + new Vector3(-0.1f, 0.13f, 0f), val + new Vector3(-0.1f, 0f, 0f), val + new Vector3(0.1f, 0f, 0f), val + new Vector3(0.1f, -0.13f, 0f), val + new Vector3(-0.1f, -0.13f, 0f) }, 0.04f, gold); } else if (hero.Symbol == "W") { Line(parent, (Vector3[])(object)new Vector3[5] { val + new Vector3(-0.17f, 0.1f, 0f), val + new Vector3(-0.09f, -0.12f, 0f), val + new Vector3(0f, 0.05f, 0f), val + new Vector3(0.09f, -0.12f, 0f), val + new Vector3(0.17f, 0.1f, 0f) }, 0.04f, gold); } else { for (int k = -1; k <= 1; k++) { Line(parent, (Vector3[])(object)new Vector3[2] { val + new Vector3((float)k * 0.09f, 0.11f, 0f), val + new Vector3((float)k * 0.09f - 0.035f, -0.1f, 0f) }, 0.025f, material); } } } private void Accessories(PlayerBody body, Transform hip) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_009e: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) if (hero.Name == "Batman" || hero.Name == "Superman" || hero.Name == "Thor" || hero.Name == "Doctor Strange") { Transform val = DetailRoot(hip, "HeroWobbly Cape"); Mesh val2 = new Mesh(); meshes.Add(val2); val2.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.25f, 0.55f, -0.2f), new Vector3(0.25f, 0.55f, -0.2f), new Vector3(-0.58f, -0.65f, -0.43f), new Vector3(0.58f, -0.65f, -0.43f) }; val2.triangles = new int[12] { 0, 1, 2, 2, 1, 3, 2, 1, 0, 3, 1, 2 }; val2.RecalculateNormals(); ((Component)val).gameObject.AddComponent<MeshFilter>().sharedMesh = val2; Renderer val3 = (Renderer)(object)((Component)val).gameObject.AddComponent<MeshRenderer>(); ours.Add(val3); val3.sharedMaterial = ((hero.Name == "Batman") ? black : MakeMaterial(new Color(0.65f, 0.015f, 0.055f))); } if (hero.Name == "Captain America" && Object.op_Implicit((Object)(object)body.GetLeftHand())) { Transform transform = ((Component)body.GetLeftHand()).transform; Shape((PrimitiveType)0, transform, new Vector3(0f, 0f, 0.13f), Quaternion.identity, new Vector3(0.7f, 0.7f, 0.09f), MakeMaterial(new Color(0.7f, 0.025f, 0.07f))); Shape((PrimitiveType)0, transform, new Vector3(0f, 0f, 0.17f), Quaternion.identity, new Vector3(0.52f, 0.52f, 0.065f), white); Shape((PrimitiveType)0, transform, new Vector3(0f, 0f, 0.2f), Quaternion.identity, new Vector3(0.35f, 0.35f, 0.04f), red); } if (hero.Name == "Thor" && Object.op_Implicit((Object)(object)body.GetRightHand())) { Transform transform2 = ((Component)body.GetRightHand()).transform; Shape((PrimitiveType)2, transform2, Vector3.up * 0.1f, Quaternion.identity, new Vector3(0.06f, 0.26f, 0.06f), black); Shape((PrimitiveType)3, transform2, Vector3.up * 0.43f, Quaternion.identity, new Vector3(0.43f, 0.25f, 0.25f), white); } if (hero.Name == "Aquaman" && Object.op_Implicit((Object)(object)body.GetRightHand())) { Transform transform3 = ((Component)body.GetRightHand()).transform; Line(transform3, (Vector3[])(object)new Vector3[2] { Vector3.down * 0.4f, Vector3.up * 0.9f }, 0.04f, gold); for (int i = -1; i <= 1; i++) { Line(transform3, (Vector3[])(object)new Vector3[3] { Vector3.up * 0.5f, new Vector3((float)i * 0.18f, 0.68f, 0f), new Vector3((float)i * 0.18f, 1f, 0f) }, 0.035f, gold); } } } } internal sealed class HeroSession : IDisposable { private sealed class Effect { public LineRenderer Line; public float Until; } private readonly List<Effect> effects = new List<Effect>(); private Material effectMaterial; private readonly HashSet<int> affected = new HashSet<int>(); private readonly Plugin owner; public readonly int LocalId; private readonly int forcedPad; internal PlayerCharacter Character; internal PlayerCharacterMovement Movement; private PlayerBody Body; private Rigidbody Hip; private PlayerController controller; private PlayerControllerInputManager inputManager; private Camera view; private readonly Controls pad = new Controls(); private readonly HeroState state; private readonly object interactionHandle = new object(); private bool interactionBlocked; private bool suitWanted; private bool help; private bool ready; private bool faulted; private bool PowerLayer; private bool flying; private bool pullHeld; private float queuedJumpScale = 1f; private float dashUntil; private Vector3 dashVelocity; private float nextScan; private float nextSuitCheck; private float nextSenseScan; private float messageUntil; private float jumpAfter; private float senseUntil; private float senseReady; private float nextTrail; private float nextGuard; private string message = "Tap LB to activate your hero."; private readonly List<Rigidbody> bodies = new List<Rigidbody>(); private readonly List<CollisionDetectionMode> collisionModes = new List<CollisionDetectionMode>(); private Costume costume; private LineRenderer web; private Material webMaterial; private Transform anchorTransform; private Vector3 anchorLocal; private Vector3 anchorWorld; private Vector3 lastAnchor; private Collider anchorCollider; private Rigidbody pullBody; private float ropeLength; private float zipUntil; private float webFlashUntil; private float travelUntil; private Vector3 flashEnd; private bool swinging; private bool zipping; private bool climbing; private bool jumpQueued; private bool rescueQueued; private Vector3 safePosition; private Quaternion safeRotation; private bool hasSafePosition; private readonly Collider[] senseBuffer = (Collider[])(object)new Collider[128]; private readonly List<Transform> senseTargets = new List<Transform>(); private readonly HashSet<int> sensedIds = new HashSet<int>(); private GUIStyle titleStyle; private GUIStyle textStyle; private GUIStyle smallStyle; private bool collisionProtected; public int AssignedPad { get; private set; } private Hero Hero => Heroes.All[state.Index]; internal bool KnockoutProtection { get { if (!faulted && state.Enabled && pad.Connected && Object.op_Implicit((Object)(object)Character) && Object.op_Implicit((Object)(object)controller) && controller.IsLocal() && ((HawkNetworkBehaviour)Character).IsServer()) { return !Character.IsDead(); } return false; } } internal bool AquaticProtection { get { if (!faulted && state.Enabled && pad.Connected) { return Hero.Secondary == Ability.Swim; } return false; } } private float Speed => Mathf.Min(owner.SpeedLimit.Value, Hero.Speed); private Color Energy => ColorOf(Hero.EnergyColor); private void Activate(Ability ability, int slot) { //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) float num; switch (ability) { default: num = 0.3f; break; case Ability.Dash: num = 0.85f; break; case Ability.Lightning: case Ability.Ricochet: num = 0.8f; break; case Ability.Blink: num = 1.8f; break; case Ability.Shockwave: num = 2f; break; } float delay = num; if (!state.Consume(slot, Time.time, delay)) { return; } switch (ability) { case Ability.Zip: if (zipping) { StopTravel(); } else { StartWeb(zip: true); } return; case Ability.Pull: FirePull(); return; case Ability.Blast: Shoot(0); return; case Ability.Ricochet: Shoot(2); return; case Ability.Lightning: Shoot(3); return; case Ability.Shockwave: Shockwave(); return; case Ability.Dash: Dash(); return; case Ability.Blink: Blink(); return; case Ability.Leap: if (Movement.IsGrounded() || climbing) { jumpQueued = true; queuedJumpScale = 1.3f; } return; case Ability.Swim: if (!Movement.IsInWater()) { Notify("Water flight works in water. Use A to leap on land."); return; } break; case Ability.Flight: break; default: return; } bool flag = !flying; StopTravel(); flying = flag; if (flag) { Body.ForceLetGoEverything(); if (Movement.IsGrounded()) { Body.SetRagdollVelocity(Vector3.up * 5f); } } Notify(flying ? "FLIGHT ON: stick moves, A rises, B descends. Y to stop." : "Flight off."); } private bool IsProp(Collider c) { if (Object.op_Implicit((Object)(object)c) && !IsOwn(((Component)c).transform) && Object.op_Implicit((Object)(object)c.attachedRigidbody) && !c.attachedRigidbody.isKinematic && !Object.op_Implicit((Object)(object)((Component)c).GetComponentInParent<PlayerCharacter>()) && !Object.op_Implicit((Object)(object)((Component)c.attachedRigidbody).GetComponent<RagdollPart>())) { return c.attachedRigidbody.mass <= 1200f; } return false; } private void FirePull() { //IL_0019: 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) if (!Aim(out var hit)) { Notify("Aim at a loose physics object to pull it."); return; } flashEnd = ((RaycastHit)(ref hit)).point; webFlashUntil = Time.time + 0.25f; if (!IsProp(((RaycastHit)(ref hit)).collider)) { Notify("Pull works on loose props, not scenery or other players."); return; } pullBody = ((RaycastHit)(ref hit)).rigidbody; webFlashUntil = Time.time + 3f; Notify("Keep holding the pull button. Release to let go."); } private void Shoot(int mode) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_002a: 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_003f: 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_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) Ray val = view.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); RaycastHit nearest; Vector3 val2 = (Cast(((Ray)(ref val)).origin, ((Ray)(ref val)).direction, 65f, out nearest) ? ((RaycastHit)(ref nearest)).point : (((Ray)(ref val)).origin + ((Ray)(ref val)).direction * 65f)); Vector3 val3 = Hip.position + Vector3.up * 0.55f; Vector3 val4 = val2 - val3; Vector3 val5 = ((Vector3)(ref val4)).normalized; int num = ((mode != 2) ? 1 : 3); affected.Clear(); for (int i = 0; i < num; i++) { RaycastHit nearest2; bool flag = Cast(val3, val5, 65f / (float)num, out nearest2); Vector3 val6 = (flag ? ((RaycastHit)(ref nearest2)).point : (val3 + val5 * (65f / (float)num))); EffectLine(val3, val6, (mode == 3) ? 0.3f : 0.2f, (mode == 2) ? 0.1f : 0.065f); if (!flag) { break; } if (IsProp(((RaycastHit)(ref nearest2)).collider) && affected.Add(((Object)((RaycastHit)(ref nearest2)).rigidbody).GetInstanceID())) { ((RaycastHit)(ref nearest2)).rigidbody.AddForce(val5 * ((mode == 3) ? 15f : 11f) + Vector3.up * 3f, (ForceMode)2); } if (mode == 3) { ChainLightning(val6); } val5 = Vector3.Reflect(val5, ((RaycastHit)(ref nearest2)).normal); val3 = ((RaycastHit)(ref nearest2)).point + ((RaycastHit)(ref nearest2)).normal * 0.12f; } } private void ChainLightning(Vector3 origin) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_005d: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_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_0084: 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_008a: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapSphereNonAlloc(origin, 9f, senseBuffer, -5, (QueryTriggerInteraction)1); int num2 = 0; for (int i = 0; i < num; i++) { if (num2 >= 4) { break; } Collider val = senseBuffer[i]; if (IsProp(val) && affected.Add(((Object)val.attachedRigidbody).GetInstanceID())) { Vector3 worldCenterOfMass = val.attachedRigidbody.worldCenterOfMass; Vector3 origin2 = origin + Vector3.up * 0.15f; Vector3 val2 = worldCenterOfMass - origin; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val3 = worldCenterOfMass - origin; if (!Cast(origin2, normalized, ((Vector3)(ref val3)).magnitude - 0.2f, out var nearest) || !((Object)(object)((RaycastHit)(ref nearest)).rigidbody != (Object)(object)val.attachedRigidbody)) { EffectLine(origin, worldCenterOfMass, 0.3f, 0.045f); Rigidbody attachedRigidbody = val.attachedRigidbody; Vector3 val4 = Vector3.up * 9f; Vector3 val5 = worldCenterOfMass - origin; attachedRigidbody.AddForce(val4 + ((Vector3)(ref val5)).normalized * 7f, (ForceMode)2); num2++; } } } } private void Shockwave() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0092: 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_009c: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0144: 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) float num = ((Hero.Name == "Hulk") ? 10f : 7f); int num2 = Physics.OverlapSphereNonAlloc(Hip.position, num, senseBuffer, -5, (QueryTriggerInteraction)1); affected.Clear(); for (int i = 0; i < num2; i++) { Collider val = senseBuffer[i]; if (IsProp(val) && affected.Add(((Object)val.attachedRigidbody).GetInstanceID())) { Vector3 val2 = val.attachedRigidbody.worldCenterOfMass - Hip.position; if (!Cast(Hip.position, ((Vector3)(ref val2)).normalized, Mathf.Max(0f, ((Vector3)(ref val2)).magnitude - 0.3f), out var nearest) || !((Object)(object)((RaycastHit)(ref nearest)).rigidbody != (Object)(object)val.attachedRigidbody)) { float num3 = ((Hero.Name == "Hulk") ? 25f : 16f) * Mathf.Clamp01(1f - ((Vector3)(ref val2)).magnitude / num); val.attachedRigidbody.AddForce(((Vector3)(ref val2)).normalized * num3 + Vector3.up * num3 * 0.35f, (ForceMode)2); } } } Ring(Hip.position, Vector3.up, num * 0.65f, 0.4f); Notify(Hero.Name + " shockwave!"); } private void Guard() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0031: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00f5: 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) Vector3 val = Hip.position + Vector3.up * 0.35f; Vector3 forward = ((Component)view).transform.forward; int num = Physics.OverlapSphereNonAlloc(val + forward, 2.5f, senseBuffer, -5, (QueryTriggerInteraction)1); affected.Clear(); for (int i = 0; i < num; i++) { Collider val2 = senseBuffer[i]; if (!IsProp(val2) || !affected.Add(((Object)val2.attachedRigidbody).GetInstanceID())) { continue; } Vector3 val3 = val2.attachedRigidbody.worldCenterOfMass - val; if (!(Vector3.Dot(((Vector3)(ref val3)).normalized, forward) < 0.1f)) { float num2 = Vector3.Dot(val2.attachedRigidbody.velocity - Hip.velocity, ((Vector3)(ref val3)).normalized); if (num2 < -1f) { val2.attachedRigidbody.AddForce(((Vector3)(ref val3)).normalized * Mathf.Min(35f, 0f - num2 + 8f), (ForceMode)2); } } } Ring(val + forward * 1.15f, forward, 0.9f, 0.16f); } private void Drive(Vector3 desired, bool gravityCompensation) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_003a: 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_004b: 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_00ea: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) float num = ((Vector3)(ref desired)).magnitude * Time.fixedDeltaTime + 0.55f; if (((Vector3)(ref desired)).sqrMagnitude > 0.01f) { RaycastHit[] array = Physics.SphereCastAll(Hip.position + Vector3.up * 0.15f, 0.3f, ((Vector3)(ref desired)).normalized, num, -5, (QueryTriggerInteraction)1); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val = array2[i]; if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider) && !IsOwn(((Component)((RaycastHit)(ref val)).collider).transform) && Vector3.Dot(desired, ((RaycastHit)(ref val)).normal) < -0.1f) { desired = Vector3.ProjectOnPlane(desired, ((RaycastHit)(ref val)).normal) * 0.65f; } } } AccelerateBody(Vector3.ClampMagnitude((desired - Hip.velocity) * 12f - (gravityCompensation ? Physics.gravity : Vector3.zero), 150f)); travelUntil = Time.time + 1f; } private void Dash() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_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_002a: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_010e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(((Component)view).transform.forward, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; if (Cast(Hip.position + Vector3.up * 0.2f, normalized, 2.5f, out var _)) { Notify("Dash path blocked."); return; } StopTravel(); Body.SetRagdollVelocity(normalized * Speed + Vector3.up * Mathf.Max(3f, Hip.velocity.y)); dashVelocity = normalized * Speed + Vector3.up * 3f; dashUntil = Time.time + 0.24f; travelUntil = Time.time + 1.2f; EffectLine(Hip.position, Hip.position - normalized * 3f, 0.25f, 0.13f); } private void Blink() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0114: 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_012c: 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_0145: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) if (!Aim(out var hit) || Vector3.Distance(Hip.position, ((RaycastHit)(ref hit)).point) > 35f) { Notify("Aim at nearby clear ground (within 35 m)."); return; } if (!Cast(((RaycastHit)(ref hit)).point + Vector3.up * 1.5f, Vector3.down, 3f, out var nearest) || ((RaycastHit)(ref nearest)).normal.y < 0.7f || Object.op_Implicit((Object)(object)((RaycastHit)(ref nearest)).rigidbody)) { Notify("Blink needs solid, level ground."); return; } Vector3 val = ((RaycastHit)(ref nearest)).point + Vector3.up * 0.12f; if (Physics.CheckCapsule(val + Vector3.up * 0.4f, val + Vector3.up * 1.4f, 0.35f, -5, (QueryTriggerInteraction)1)) { Notify("Blink destination is too cramped."); return; } Vector3 position = Hip.position; Vector3 val2 = Character.GetPlayerPosition() + val - Character.GetCenterFeetPosition(); StopTravel(); Character.SetPlayerPositionAndRotation(val2, Character.GetPlayerRotation(), true); Body.SetRagdollVelocity(Vector3.zero); Ring(position, Vector3.up, 1f, 0.5f); Ring(val2, Vector3.up, 1f, 0.5f); Notify("BLINK!"); } private LineRenderer NewEffect(float duration, float width) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown if (effects.Count >= 60) { Object.Destroy((Object)(object)((Component)effects[0].Line).gameObject); effects.RemoveAt(0); } if (!Object.op_Implicit((Object)(object)effectMaterial)) { Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color"); if (!Object.op_Implicit((Object)(object)val)) { return null; } effectMaterial = new Material(val); } GameObject val2 = new GameObject("HeroWobbly P" + LocalId + " effect"); val2.transform.SetParent(((Component)owner).transform); val2.layer = 2; LineRenderer val3 = val2.AddComponent<LineRenderer>(); ((Renderer)val3).sharedMaterial = effectMaterial; Color startColor = (val3.endColor = Energy); val3.startColor = startColor; float startWidth = (val3.endWidth = width); val3.startWidth = startWidth; val3.numCapVertices = 3; val3.useWorldSpace = true; ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; effects.Add(new Effect { Line = val3, Until = Time.time + duration }); return val3; } private void EffectLine(Vector3 from, Vector3 to, float duration, float width) { //IL_001c: 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) LineRenderer val = NewEffect(duration, width); if (Object.op_Implicit((Object)(object)val)) { val.positionCount = 2; val.SetPosition(0, from); val.SetPosition(1, to); } } private void Ring(Vector3 center, Vector3 normal, float radius, float duration) { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) LineRenderer val = NewEffect(duration, 0.045f); if (Object.op_Implicit((Object)(object)val)) { val.positionCount = 33; Quaternion val2 = Quaternion.FromToRotation(Vector3.forward, normal); for (int i = 0; i <= 32; i++) { float num = (float)i * (float)Math.PI / 16f; val.SetPosition(i, center + val2 * new Vector3(Mathf.Cos(num), Mathf.Sin(num), 0f) * radius); } } } private void UpdateEffects() { for (int num = effects.Count - 1; num >= 0; num--) { if (!Object.op_Implicit((Object)(object)effects[num].Line) || Time.time > effects[num].Until) { if (Object.op_Implicit((Object)(object)effects[num].Line)) { Object.Destroy((Object)(object)((Component)effects[num].Line).gameObject); } effects.RemoveAt(num); } } } private void ClearEffects() { foreach (Effect effect in effects) { if (Object.op_Implicit((Object)(object)effect.Line)) { Object.Destroy((Object)(object)((Component)effect.Line).gameObject); } } effects.Clear(); } public void DrawHud() { //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0674: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Character) || !Object.op_Implicit((Object)(object)view)) { return; } if (titleStyle == null) { titleStyle = new GUIStyle(GUI.skin.label); titleStyle.fontSize = 19; titleStyle.fontStyle = (FontStyle)1; textStyle = new GUIStyle(GUI.skin.label); textStyle.fontSize = 14; textStyle.normal.textColor = Color.white; smallStyle = new GUIStyle(textStyle); smallStyle.fontSize = 12; smallStyle.wordWrap = true; } Rect rect = view.rect; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x * (float)Screen.width, (1f - ((Rect)(ref rect)).yMax) * (float)Screen.height, ((Rect)(ref rect)).width * (float)Screen.width, ((Rect)(ref rect)).height * (float)Screen.height); if (((Rect)(ref val)).width < 10f || ((Rect)(ref val)).height < 10f) { return; } Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUI.BeginGroup(val); try { float num = Mathf.Min(1.15f, Mathf.Min(((Rect)(ref val)).width / 560f, ((Rect)(ref val)).height / 390f)); GUI.matrix = Matrix4x4.Scale(Vector3.one * num); float num2 = Mathf.Min(418f, ((Rect)(ref val)).width / num - 24f); float num3 = (help ? 252f : 92f); GUI.color = new Color(0.025f, 0.04f, 0.08f, 0.88f); GUI.DrawTexture(new Rect(12f, 12f, num2, num3), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; titleStyle.normal.textColor = Energy; GUI.Label(new Rect(24f, 20f, num2 - 20f, 28f), "P" + (LocalId + 1) + " " + Hero.Name.ToUpperInvariant(), titleStyle); string text = ((!ready) ? "Paused / menu / vehicle" : ((!pad.Connected) ? "No assigned Xbox pad - see README" : ((!state.Enabled) ? "POWERS OFF" : (flying ? "FLYING" : (swinging ? "SWINGING" : (climbing ? "CLIMBING" : "POWERS ON")))))); GUI.Label(new Rect(24f, 48f, num2 - 20f, 23f), text + " | LB: toggle RB: hero", smallStyle); GUI.Label(new Rect(24f, 73f, num2 - 20f, 22f), "D-pad Left: " + (help ? "hide controls" : "show controls"), smallStyle); if (help) { string text2 = "RT: " + Heroes.Label(Hero.Primary) + "\nY: " + Heroes.Label(Hero.Secondary) + "\nX: " + Heroes.Label(Hero.Utility) + "\nB: " + Heroes.Label(Hero.Defense) + "\nA: super jump (flight: rise; B: descend)\nLT: reel web / slow flight\nD-pad Up: sense | Down: rescue | Right: suit"; GUI.Label(new Rect(24f, 107f, num2 - 22f, 145f), text2, textStyle); } if (Time.unscaledTime < messageUntil) { GUI.color = new Color(0.025f, 0.04f, 0.08f, 0.9f); GUI.DrawTexture(new Rect(12f, num3 + 20f, num2, 49f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.Label(new Rect(24f, num3 + 26f, num2 - 24f, 40f), message, smallStyle); } GUI.matrix = matrix; if (!ready || !PowerLayer) { return; } GUI.color = Energy; float num4 = ((Rect)(ref val)).width * 0.5f; float num5 = ((Rect)(ref val)).height * 0.5f; GUI.DrawTexture(new Rect(num4 - 6f, num5 - 1f, 12f, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num4 - 1f, num5 - 6f, 2f, 12f), (Texture)(object)Texture2D.whiteTexture); if (!(Time.time < senseUntil)) { return; } foreach (Transform senseTarget in senseTargets) { if (Object.op_Implicit((Object)(object)senseTarget)) { Vector3 val2 = view.WorldToViewportPoint(senseTarget.position); if (val2.z > 0f && val2.x > 0f && val2.x < 1f && val2.y > 0f && val2.y < 1f) { GUI.Label(new Rect(val2.x * ((Rect)(ref val)).width - 24f, (1f - val2.y) * ((Rect)(ref val)).height - 16f, 80f, 26f), "[" + Vector3.Distance(Hip.position, senseTarget.position).ToString("0") + "m]", smallStyle); } } } } finally { GUI.matrix = matrix; GUI.color = color; GUI.EndGroup(); } } internal static Color ColorOf(uint rgb) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) return new Color((float)((rgb >> 16) & 0xFF) / 255f, (float)((rgb >> 8) & 0xFF) / 255f, (float)(rgb & 0xFF) / 255f); } public HeroSession(Plugin plugin, int localId, int controllerIndex, int initialHero) { owner = plugin; LocalId = localId; forcedPad = controllerIndex; AssignedPad = -1; state = new HeroState(initialHero); suitWanted = owner.Suits.Value; } public void Update() { if (faulted) { return; } try { UpdatePowers(); } catch (Exception ex) { Fail(ex); } } private int ResolveController() { if (!Object.op_Implicit((Object)(object)controller)) { return -1; } if (forcedPad >= 0) { return forcedPad; } Player rewiredPlayer = Character.GetRewiredPlayer(); if (rewiredPlayer == null) { return -1; } foreach (Joystick joystick in rewiredPlayer.controllers.Joysticks) { XInputControllerExtension extension = ((Controller)joystick).GetExtension<XInputControllerExtension>(); if (extension != null && extension.userIndex >= 0 && extension.userIndex < 4) { return extension.userIndex; } } return -1; } private void UpdatePowers() { //IL_01d7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Character) || !Object.op_Implicit((Object)(object)controller) || (Object)(object)controller.GetPlayerCharacter() != (Object)(object)Character) { ReleaseCharacter(); if (Time.unscaledTime >= nextScan) { nextScan = Time.unscaledTime + 1f; FindCharacter(); } } int num = ResolveController(); if (num >= 0 && owner.ControllerClaimed(num, this)) { num = -1; } if (num != AssignedPad) { AssignedPad = num; pad.Feed(connected: false, 0, 0, 0, 0, 0); if (state.Enabled) { state.Disconnect(); ResetAbilities(); RefreshCostume(); } } bool connected = pad.Connected; pad.Poll(AssignedPad); if (connected && !pad.Connected) { state.Disconnect(); ResetAbilities(); RefreshCostume(); Notify("Controller disconnected. Reconnect, then tap LB."); } ready = CanPlay(); if (!ready) { PowerLayer = false; BlockInteraction(block: false); ResetAbilities(); return; } int num2 = state.ReadButtons(pad); if ((num2 & 1) != 0) { ResetAbilities(); RefreshCostume(); if (KnockoutProtection) { RagdollController ragdollController = Character.GetRagdollController(); if (Object.op_Implicit((Object)(object)ragdollController) && ragdollController.IsKnockedout()) { ragdollController.Wakeup(true); } } Notify(state.Enabled ? (Hero.Name + " powers ON!") : "Powers OFF - normal game controls."); } if ((num2 & 2) != 0) { ResetAbilities(); RefreshCostume(); if (Object.op_Implicit((Object)(object)webMaterial)) { webMaterial.color = Energy; } Notify(Hero.Name + " selected. " + (state.Enabled ? "Powers ready!" : "Tap LB to activate.")); } if (pad.DownNow(4)) { help = !help; } if (LocalId == 0 && Input.GetKeyDown((KeyCode)289)) { help = !help; } PowerLayer = state.Enabled && pad.Connected; BlockInteraction(PowerLayer); if (!PowerLayer) { StopTravel(); return; } if (pad.DownNow(8)) { suitWanted = !suitWanted; RefreshCostume(); } if (Time.unscaledTime >= nextSuitCheck) { nextSuitCheck = Time.unscaledTime + 2f; if (costume != null) { costume.RefreshHiddenRenderers(); } } pullHeld = (Hero.Primary == Ability.Pull && pad.Trigger) || (Hero.Utility == Ability.Pull && pad.Held(16384)); if (Hero.Primary == Ability.Swing) { if (pad.Trigger && !pad.PreviousTrigger) { StartWeb(zip: false); } if (!pad.Trigger) { swinging = false; } } else if (pad.Trigger && Hero.Primary != Ability.Speed && ((Hero.Primary != Ability.Pull && Hero.Primary != Ability.Dash) || !pad.PreviousTrigger)) { Activate(Hero.Primary, 0); } if (pad.DownNow(32768)) { Activate(Hero.Secondary, 1); } if (pad.DownNow(16384)) { Activate(Hero.Utility, 2); } if (pad.DownNow(4096) && !flying && Time.time >= jumpAfter && (Movement.IsGrounded() || climbing || swinging || zipping)) { jumpQueued = true; queuedJumpScale = 1f; jumpAfter = Time.time + 0.6f; } if (pad.DownNow(1)) { StartSense(); } if (pad.DownNow(2)) { rescueQueued = true; } } private bool CanPlay() { if (Object.op_Implicit((Object)(object)Character) && Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)Hip) && Object.op_Implicit((Object)(object)Movement) && Object.op_Implicit((Object)(object)Body) && Object.op_Implicit((Object)(object)view) && ((Behaviour)Character).isActiveAndEnabled && controller.IsLocal() && ((HawkNetworkBehaviour)Character).IsServer() && !Character.IsDead() && !Character.IsSleeping() && !Character.IsInBed() && !Character.IsInCutscene() && !Character.HasEnteredAction() && !controller.IsInFreeCam() && Object.op_Implicit((Object)(object)inputManager) && inputManager.IsGameplayInputEnabled() && !inputManager.IsCursorVisible() && !Movement.IsNoClipEnabled() && (!Movement.IsInWater() || Hero.Secondary == Ability.Swim) && !Hip.isKinematic && Application.isFocused) { return Time.timeScale > 0.01f; } return false; } private void FindCharacter() { //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) PlayerController[] array = Object.FindObjectsOfType<PlayerController>(); foreach (PlayerController val in array) { if (!val.IsLocal() || val.GetLocalPlayerid() != LocalId) { continue; } PlayerCharacter playerCharacter = val.GetPlayerCharacter(); if (!Object.op_Implicit((Object)(object)playerCharacter)) { continue; } if (!((HawkNetworkBehaviour)playerCharacter).IsServer()) { Notify("Load your own world: single-player or local co-op host."); break; } PlayerBody playerBody = playerCharacter.GetPlayerBody(); Rigidbody hipRigidbody = playerCharacter.GetHipRigidbody(); PlayerCharacterMovement playerCharacterMovement = playerCharacter.GetPlayerCharacterMovement(); GameplayCamera gameplayCamera = val.GetGameplayCamera(); if (!Object.op_Implicit((Object)(object)playerBody) || !Object.op_Implicit((Object)(object)hipRigidbody) || !Object.op_Implicit((Object)(object)playerCharacterMovement) || !Object.op_Implicit((Object)(object)gameplayCamera) || !Object.op_Implicit((Object)(object)gameplayCamera.GetCamera())) { continue; } controller = val; Character = playerCharacter; Body = playerBody; Hip = hipRigidbody; Movement = playerCharacterMovement; inputManager = val.GetPlayerControllerInputManager(); view = gameplayCamera.GetCamera(); foreach (RagdollPart ragdollPart in playerBody.GetRagdollParts()) { if (Object.op_Implicit((Object)(object)ragdollPart)) { Rigidbody rigidbody = ragdollPart.GetRigidbody(); if (Object.op_Implicit((Object)(object)rigidbody) && !bodies.Contains(rigidbody)) { bodies.Add(rigidbody); collisionModes.Add(rigidbody.collisionDetectionMode); } } } if (!bodies.Contains(hipRigidbody)) { bodies.Add(hipRigidbody); collisionModes.Add(hipRigidbody.collisionDetectionMode); } RefreshCostume(); Notify("Player " + (LocalId + 1) + ": tap LB for powers, RB for next hero."); owner.LogInfo("HeroWobbly attached to local player " + LocalId + "; " + bodies.Count + " ragdoll bodies."); break; } } private void BlockInteraction(bool block) { if (interactionBlocked == block) { return; } if (Object.op_Implicit((Object)(object)inputManager)) { if (block) { inputManager.DisableInteratorInput(interactionHandle); } else { inputManager.EnableInteratorInput(interactionHandle); } } interactionBlocked = block; } private void ResetAbilities() { PowerLayer = false; BlockInteraction(block: false); StopTravel(); RestoreCollision(); jumpQueued = (rescueQueued = false); pullHeld = false; queuedJumpScale = 1f; senseUntil = 0f; senseTargets.Clear(); ClearEffects(); } public void FilterInput(ref PlayerInput input) { if (ready && PowerLayer && !faulted) { input.bJump = (input.bLeftArmGrab = (input.bRightArmGrab = (input.bRagdoll = false))); if (swinging || zipping || climbing || flying || Time.time < dashUntil || (Hero.Primary == Ability.Speed && pad.Trigger) || (Hero.Defense == Ability.Glide && pad.Held(8192)) || (Time.time < travelUntil && !Movement.IsGrounded())) { input.horizontal = (input.vertical = 0f); } } } public void PhysicsTick() { if (faulted || !ready || !PowerLayer) { return; } try { TickPowers(); } catch (Exception ex) { Fail(ex); } } private void TickPowers() { //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_0246: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: 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_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: 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_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030b: 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_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing reference