Decompiled source of KillNet v2.0.3
KillNet.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Newtonsoft.Json; using Sandbox; using Sandbox.Arm; using SettingsMenu.Components; using SettingsMenu.Models; using Steamworks; using Steamworks.Data; using TMPro; using ULTRAKILL.Enemy; using ULTRAKILL.Portal; using Unity.Collections; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.ResourceLocations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("KillNet")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.0.3.0")] [assembly: AssemblyInformationalVersion("2.0.3")] [assembly: AssemblyProduct("KillNet")] [assembly: AssemblyTitle("KillNet")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.3.0")] [module: UnverifiableCode] namespace Killcraft; internal static class BlockLight { private struct L { public Vector3 Pos; public Vector3 Dir; public Vector3 Color; public float SpotCos; public float SpotScale; public float Range; public bool Directional; public bool Indoors; public bool Outdoors; } public enum Where { Indoors, Outdoors, Both } private static readonly List<L> lights = new List<L>(); private static readonly List<Light> source = new List<Light>(); private static readonly List<Collider> outdoorZones = new List<Collider>(); private static Vector3 ambient; private static float checkAt; private static float collectAt; private static int stateHash; private static string scene = ""; private static bool logged; private static bool loggedLights; private const int LevelGeometry = 16777664; private static readonly RaycastHit[] hits = (RaycastHit[])(object)new RaycastHit[16]; private static bool darkLogged; private const float Around = 0.25f; private const float Cap = 1.15f; private const float Knee = 0.7f; private const float Desaturate = 0.3f; private const float Floor = 0.08f; public static readonly Vector3[] FaceNormal = (Vector3[])(object)new Vector3[8] { Vector3.zero, Vector3.down, Vector3.up, Vector3.forward, Vector3.back, Vector3.left, Vector3.right, Vector3.zero }; public static bool Active { get; private set; } public static int Version { get; private set; } public static void Frame() { string text = SceneHelper.CurrentScene ?? ""; if (text != scene) { scene = text; logged = false; loggedLights = false; darkLogged = false; source.Clear(); outdoorZones.Clear(); checkAt = 0f; Collect(); } if (!(Time.unscaledTime < checkAt)) { checkAt = Time.unscaledTime + 0.25f; if ((source.Count == 0 && Time.unscaledTime >= collectAt) || (source.Count > 0 && (Object)(object)source[0] == (Object)null)) { collectAt = Time.unscaledTime + 2f; Collect(); } Snapshot(); } } private static void Collect() { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Invalid comparison between Unknown and I4 //IL_0283: Unknown result type (might be due to invalid IL or missing references) source.Clear(); MonoSingleton instance = MonoSingleton.GetInstance(typeof(StaticSceneOptimizer)); StaticSceneOptimizer val = (StaticSceneOptimizer)(object)((instance is StaticSceneOptimizer) ? instance : null); bool flag = scene == "uk_construct"; if (!flag && (Object)(object)val != (Object)null && val.globalLights != null && val.globalLights.Length != 0) { Light[] globalLights = val.globalLights; foreach (Light val2 in globalLights) { if ((Object)(object)val2 != (Object)null) { source.Add(val2); } } } outdoorZones.Clear(); OutdoorsZone[] array = Object.FindObjectsOfType<OutdoorsZone>(); for (int i = 0; i < array.Length; i++) { Collider[] componentsInChildren = ((Component)array[i]).GetComponentsInChildren<Collider>(); foreach (Collider item in componentsInChildren) { outdoorZones.Add(item); } } if (logged && (source.Count <= 0 || loggedLights) && !Plugin.Diagnostics.Value) { return; } logged = true; loggedLights = source.Count > 0; int num = 0; int num2 = 0; int num3 = 0; foreach (Light item2 in source) { num += (((int)item2.type == 1) ? 1 : 0); num2 += (((item2.cullingMask & 0x1000040) != 0) ? 1 : 0); num3 += (((item2.cullingMask & 0x180) != 0) ? 1 : 0); } if (source.Count > 0) { Plugin.Log.LogInfo((object)string.Format("render: level lights: {0} directional, {1} for outdoors, {2} for indoors, {3} neither (sun: {4})", num, num2, num3, source.Count - num2 - num3, ((Object)(object)RenderSettings.sun != (Object)null) ? (((Object)RenderSettings.sun).name + " mask " + RenderSettings.sun.cullingMask.ToString("X")) : "none")); } Plugin.Log.LogInfo((object)(string.Format("render: blocks lit as ULTRAKILL lights its walls ({0} level lights{1}{2}, ", source.Count, ((Object)(object)val != (Object)null) ? "" : ", no StaticSceneOptimizer", flag ? ", the sandbox: Minecraft's light" : "") + $"{outdoorZones.Count} outdoor zones, ambient {RenderSettings.ambientLight})")); } private static void Snapshot() { //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Invalid comparison between Unknown and I4 //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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) lights.Clear(); int num = 17; foreach (Light item2 in source) { if ((Object)(object)item2 == (Object)null || !((Behaviour)item2).isActiveAndEnabled) { num = num * 31 + 1; continue; } Transform transform = ((Component)item2).transform; L item = new L { Directional = ((int)item2.type == 1), Color = new Vector3(item2.color.r, item2.color.g, item2.color.b) * item2.intensity, Indoors = ((item2.cullingMask & 0x180) != 0), Outdoors = ((item2.cullingMask & 0x1000040) != 0) }; bool flag = (int)item2.type == 0; float num2 = item2.spotAngle * (MathF.PI / 180f); item.SpotCos = (flag ? Mathf.Cos(num2 / 2f) : (-1f)); item.SpotScale = (flag ? (1f / (Mathf.Cos(num2 / 4f) - Mathf.Cos(num2 / 2f))) : 1f); item.Range = (item.Directional ? 0f : item2.range); item.Dir = -transform.forward; item.Pos = (item.Directional ? (-transform.forward) : transform.position); lights.Add(item); num = num * 31 + Mathf.RoundToInt(item.Pos.x * 4f); num = num * 31 + Mathf.RoundToInt(item.Pos.y * 4f); num = num * 31 + Mathf.RoundToInt(item.Pos.z * 4f); num = num * 31 + Mathf.RoundToInt(item.Color.x * 64f) + 7 * Mathf.RoundToInt(item.Color.y * 64f) + 13 * Mathf.RoundToInt(item.Color.z * 64f); num = num * 31 + Mathf.RoundToInt(item.Range * 8f); } Color ambientLight = RenderSettings.ambientLight; ambient = new Vector3(ambientLight.r, ambientLight.g, ambientLight.b); num = num * 31 + Mathf.RoundToInt(ambientLight.r * 255f) + 7 * Mathf.RoundToInt(ambientLight.g * 255f) + 13 * Mathf.RoundToInt(ambientLight.b * 255f); Active = lights.Count > 0; if (num != stateHash) { stateHash = num; Version++; } } public static bool Outdoors(Vector3 p) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) foreach (Collider outdoorZone in outdoorZones) { if (!((Object)(object)outdoorZone != (Object)null) || !outdoorZone.enabled) { continue; } Bounds bounds = outdoorZone.bounds; if (((Bounds)(ref bounds)).Contains(p)) { Vector3 val = outdoorZone.ClosestPoint(p) - p; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { return true; } } } return false; } public static void Near(Vector3 centre, float radius, bool outdoors, List<int> into) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Near(centre, radius, outdoors ? Where.Outdoors : Where.Indoors, into); } public static Where Place(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0020: Unknown result type (might be due to invalid IL or missing references) if (Outdoors(p)) { return Where.Outdoors; } if (Ground(p, Vector3.up, 300f) < 0) { return Where.Both; } int num = Ground(p, Vector3.down, 40f); if (num != 24 && num != 6 && num >= 0) { return Where.Indoors; } return Where.Both; } private static int Ground(Vector3 p, Vector3 dir, float range) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) int num = Physics.RaycastNonAlloc(p, dir, hits, range, 16777664, (QueryTriggerInteraction)1); float num2 = float.MaxValue; int result = -1; for (int i = 0; i < num; i++) { Collider collider = ((RaycastHit)(ref hits[i])).collider; if (!((Object)(object)collider == (Object)null) && !(((RaycastHit)(ref hits[i])).distance >= num2) && !WorldRender.IsOurs(collider)) { num2 = ((RaycastHit)(ref hits[i])).distance; result = ((Component)collider).gameObject.layer; } } return result; } public static void Dark(Vector3 centre, Where where, List<int> near, Vector3 light) { //IL_00bd: 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_00fc: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) if (darkLogged || lights.Count == 0) { return; } darkLogged = true; StringBuilder stringBuilder = new StringBuilder(); foreach (int item in near) { L l = lights[item]; stringBuilder.Append(l.Directional ? "dir" : "point").Append(l.Outdoors ? "/out" : "").Append(l.Indoors ? "/in" : "") .Append(' '); } Plugin.Log.LogInfo((object)$"render: blocks at {centre} lit dark ({light}): {where}, {near.Count} of {lights.Count} lights near ({stringBuilder}), ambient {ambient}, ground below layer {Ground(centre, Vector3.down, 40f)}, above layer {Ground(centre, Vector3.up, 300f)}"); } public static void Near(Vector3 centre, float radius, Where where, List<int> into) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_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) into.Clear(); for (int i = 0; i < lights.Count; i++) { L l = lights[i]; bool num; if (where != Where.Outdoors) { if (where != Where.Indoors) { if (l.Outdoors) { goto IL_0049; } num = !l.Indoors; } else { num = !l.Indoors; } } else { num = !l.Outdoors; } if (num) { continue; } goto IL_0049; IL_0049: if (!l.Directional) { float num2 = 2f * l.Range + radius; Vector3 val = l.Pos - centre; if (((Vector3)(ref val)).sqrMagnitude > num2 * num2) { continue; } } into.Add(i); } } public static Vector3 At(Vector3 p, Vector3 n, bool twoSided, List<int> near) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return At(p, n, twoSided, near, omni: false); } public static Vector3 Omni(Vector3 p, List<int> near) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return At(p, Vector3.up, twoSided: true, near, omni: true); } private static Vector3 At(Vector3 p, Vector3 n, bool twoSided, List<int> near, bool omni) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00f5: 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_012a: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ambient; for (int i = 0; i < near.Count; i++) { L l = lights[near[i]]; float num = 1f; Vector3 val2; if (l.Directional) { val2 = l.Pos; } else { Vector3 val3 = l.Pos - p; float num2 = Mathf.Max(((Vector3)(ref val3)).sqrMagnitude, 1E-06f); float num3 = Mathf.Max(l.Range, 1E-06f); float num4 = Mathf.Sqrt(num2); if (num4 > 2f * num3) { continue; } val2 = val3 / num4; num = 1f / (1f + num2 * 25f / (num3 * num3)); float num5 = Mathf.Clamp01((Mathf.Max(Vector3.Dot(val2, l.Dir), 0f) - l.SpotCos) * l.SpotScale); num *= num5 * Mathf.Clamp01((2f * num3 - num4) / num3); } float num6 = (omni ? 1f : Vector3.Dot(n, val2)); num6 = (omni ? 1f : (twoSided ? Mathf.Abs(num6) : Mathf.Max(num6, 0f))); val += l.Color * (num * (0.25f + 0.75f * num6)); } return val; } private static Vector3 Soften(Vector3 l) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) float num = 0.3f * l.x + 0.59f * l.y + 0.11f * l.z; l = Vector3.Lerp(l, new Vector3(num, num, num), 0.3f); float num2 = Mathf.Max(l.x, Mathf.Max(l.y, l.z)); if (num2 <= 0.7f) { return l; } float num3 = 0.45f; float num4 = 0.7f + num3 * (1f - Mathf.Exp((0f - (num2 - 0.7f)) / num3)); return l * (num4 / num2); } public static int HandLight(Vector3 camera, List<int> scratch) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0024: 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_003d: Unknown result type (might be due to invalid IL or missing references) Near(camera, 1f, Place(camera), scratch); Vector3 val = Soften(Omni(camera, scratch)); float num = Mathf.Clamp(0.3f * val.x + 0.59f * val.y + 0.11f * val.z, 0.12f, 1f); return Mathf.Clamp(Mathf.RoundToInt(60f * num / (1f + 3f * num)), 0, 15) << 4; } public static Color Colour(uint c, float blockLight, Vector3 ukLight, float shade = 1f, float tintAlpha = -1f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Max(Soften(ukLight), new Vector3(0.08f, 0.08f, 0.08f)); float num = Mathf.Min(val.x + blockLight, 1.15f) * shade; float num2 = Mathf.Min(val.y + blockLight, 1.15f) * shade; float num3 = Mathf.Min(val.z + blockLight, 1.15f) * shade; return new Color((float)(c & 0xFF) / 255f * num, (float)((c >> 8) & 0xFF) / 255f * num2, (float)((c >> 16) & 0xFF) / 255f * num3, (tintAlpha >= 0f) ? tintAlpha : ((float)(c >> 24) / 255f)); } } [HarmonyPatch(typeof(EnemyIdentifier), "UpdateModifiers")] internal static class BossScaling { private static void Postfix(EnemyIdentifier __instance) { if ((Object)(object)__instance == (Object)null) { return; } if (MinosMode.HealthFor(__instance, out var times)) { __instance.totalHealthModifier *= times; } else if (Room.Shared && !Pvp.Is(__instance)) { float num = (__instance.isBoss ? PartyRules.BossHealth : PartyRules.EnemyHealth); if (num > 0f) { __instance.totalHealthModifier *= 1f + num * (float)Room.Peers.Count; } } } } internal static class Brand { public const string ThunderstoreUrl = "https://thunderstore.io/c/ultrakill/p/RedCircuit/KillNet/"; public const string GithubUrl = "https://github.com/goonsn/KillNet"; public const string NexusUrl = "https://www.nexusmods.com/ultrakill/mods/221"; public const string DiscordUrl = "https://discord.gg/UZsPDRvnGJ"; public static bool Craft => Plugin.WithMinecraft; public static string Name { get { if (!Craft) { return "KILLNET"; } return "KILLCRAFT"; } } public static string Title { get { if (!Craft) { return "KillNet"; } return "Killcraft"; } } public static Sprite Logo { get { if (!Craft) { return Ui.NetLogo; } return Ui.Logo; } } } internal static class ColourPicker { private static Sprite wheel; public static Sprite Wheel { get { //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_002c: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)wheel != (Object)null) { return wheel; } Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; Color32[] array = (Color32[])(object)new Color32[65536]; float num = 128f; for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { float num2 = (float)j + 0.5f - num; float num3 = (float)i + 0.5f - num; float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3); float num5 = Mathf.Clamp01(num - num4); Color val2 = Color.HSVToRGB(Mathf.Repeat(Mathf.Atan2(num3, num2) / (MathF.PI * 2f), 1f), Mathf.Clamp01(num4 / num), 1f); array[i * 256 + j] = new Color32((byte)(val2.r * 255f), (byte)(val2.g * 255f), (byte)(val2.b * 255f), (byte)(num5 * 255f)); } } val.SetPixels32(array); val.Apply(); return wheel = Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f), 100f); } } public static Vector2 At(float hue, float sat) { //IL_0024: 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) return new Vector2(Mathf.Cos(hue * 2f * MathF.PI), Mathf.Sin(hue * 2f * MathF.PI)) * sat; } public static void From(Vector2 p, out float hue, out float sat) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) hue = Mathf.Repeat(Mathf.Atan2(p.y, p.x) / (MathF.PI * 2f), 1f); sat = Mathf.Clamp01(((Vector2)(ref p)).magnitude); } } internal sealed class UiPickArea : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IDragHandler, IPointerUpHandler { public Action<Vector2> Moved; public Action Released; private bool held; public void OnPointerDown(PointerEventData e) { held = true; Move(e); } public void OnDrag(PointerEventData e) { Move(e); } private void OnDisable() { if (held) { OnPointerUp(null); } } public void OnPointerUp(PointerEventData e) { if (!held) { return; } held = false; try { Released?.Invoke(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("menu: the colour wheel failed (" + ex.Message + ")")); } } private void Move(PointerEventData e) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000e: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) RectTransform val = (RectTransform)((Component)this).transform; Vector2 val2 = default(Vector2); if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(val, e.position, e.pressEventCamera, ref val2)) { return; } Rect rect = val.rect; try { Moved?.Invoke(new Vector2((val2.x - ((Rect)(ref rect)).xMin) / Mathf.Max(1f, ((Rect)(ref rect)).width), (val2.y - ((Rect)(ref rect)).yMin) / Mathf.Max(1f, ((Rect)(ref rect)).height))); } catch (Exception ex) { Plugin.Log.LogWarning((object)("menu: the colour wheel failed (" + ex.Message + ")")); } } } internal static class Coords { public const float FeetBelowRoot = 1.5f; public const double NetherX = 100000.0; public const float NetherLift = 6000f; public const int NetherLandingY = 70; public static float U => Plugin.UnitsPerBlock.Value; public static double OffsetX { get; private set; } public static double OffsetZ { get; private set; } public static bool InNether { get; private set; } private static double AreaX { get { if (!InNether) { return OffsetX; } return 100000.0 + OffsetX / 8.0; } } private static double AreaZ { get { if (!InNether) { return OffsetZ; } return OffsetZ / 8.0; } } private static float Lift { get { if (!InNether) { return 0f; } return 6000f; } } public static void SetLevel(uint levelHash) { OffsetX = (double)(int)(levelHash % 59 - 29) * 2048.0; OffsetZ = (double)(int)(levelHash / 59 % 59 - 29) * 2048.0; } public static bool IsNetherX(double x) { return x > 90000.0; } public static void SetNether(bool nether) { InNether = nether; } public static bool IsNetherUnity(Vector3 u) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return u.y > 3000f; } public static void ToMc(Vector3 u, out double x, out double y, out double z) { //IL_0012: 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_0034: Unknown result type (might be due to invalid IL or missing references) double num = 1.0 / (double)U; x = (double)u.x * num + AreaX; y = (double)(u.y - Lift) * num; z = (double)(0f - u.z) * num + AreaZ; } public static Vector3 ToUnity(double x, double y, double z) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) float u = U; return new Vector3((float)((x - AreaX) * (double)u), (float)(y * (double)u) + Lift, (float)((0.0 - (z - AreaZ)) * (double)u)); } public static Vector3 DirToUnity(float x, float y, float z) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return new Vector3(x, y, 0f - z); } public static float YawToMc(float unityYaw) { return Mathf.DeltaAngle(0f, unityYaw + 180f); } public static float YawToUnity(float mcYaw) { return mcYaw - 180f; } public static float PitchToMc(float rotationX) { return Mathf.Clamp(0f - Mathf.DeltaAngle(0f, rotationX), -90f, 90f); } } [HarmonyPatch] internal static class Cybergrind { private static int calls; private static bool seeded; private static State saved; public static bool AllowGameOver; private static int partyRunScene = -1; private static bool Shared => Room.Shared; public static bool PartyRun { get { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!Shared) { int num = partyRunScene; Scene activeScene = SceneManager.GetActiveScene(); return num == ((Scene)(ref activeScene)).handle; } return true; } } private static string PartyBestFile => Path.Combine(Paths.ConfigPath, "killcraft-party-cybergrind.txt"); private static void Seed(EndlessGrid grid, int which) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Shared && !seeded) { saved = Random.state; seeded = true; int num = (((Object)(object)grid != (Object)null) ? grid.currentWave : 0); Random.InitState(0x57984997 ^ (num * 7919) ^ (which * 104729) ^ (calls++ * 31337)); } } private static CyberRankData ReadPartyBest() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown CyberRankData val = new CyberRankData(); try { if (File.Exists(PartyBestFile)) { string[] array = File.ReadAllLines(PartyBestFile); for (int i = 0; i < array.Length && i < 6; i++) { string[] array2 = array[i].Split(' '); if (array2.Length >= 4) { CultureInfo invariantCulture = CultureInfo.InvariantCulture; val.preciseWavesByDifficulty[i] = float.Parse(array2[0], invariantCulture); val.kills[i] = int.Parse(array2[1], invariantCulture); val.style[i] = int.Parse(array2[2], invariantCulture); val.time[i] = float.Parse(array2[3], invariantCulture); } } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("cybergrind: couldn't read the party's best (" + ex.Message + ")")); } return val; } [HarmonyPatch(typeof(GameProgressSaver), "GetBestCyber")] [HarmonyPrefix] private static bool GetBest(ref CyberRankData __result) { if (!PartyRun) { return true; } __result = ReadPartyBest(); return false; } [HarmonyPatch(typeof(GameProgressSaver), "SetBestCyber")] [HarmonyPrefix] private static bool SetBest(FinalCyberRank fcr) { if (!PartyRun) { return true; } try { CyberRankData val = ReadPartyBest(); int num = Mathf.Clamp(MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0), 0, 5); val.preciseWavesByDifficulty[num] = fcr.savedWaves; val.kills[num] = fcr.savedKills; val.style[num] = fcr.savedStyle; val.time[num] = fcr.savedTime; CultureInfo invariantCulture = CultureInfo.InvariantCulture; string[] array = new string[6]; for (int i = 0; i < 6; i++) { array[i] = string.Format(invariantCulture, "{0} {1} {2} {3}", val.preciseWavesByDifficulty[i], val.kills[i], val.style[i], val.time[i]); } File.WriteAllLines(PartyBestFile, array); Plugin.Log.LogInfo((object)$"cybergrind: new party best ({fcr.savedWaves:0.##} waves); the solo best is kept as it was"); } catch (Exception ex) { Plugin.Log.LogWarning((object)("cybergrind: couldn't save the party's best (" + ex.Message + ")")); } return false; } [HarmonyPatch(typeof(LeaderboardController), "SubmitCyberGrindScore")] [HarmonyPrefix] private static bool Submit() { if (!PartyRun) { return true; } Plugin.Log.LogInfo((object)"cybergrind: a party's run, not sent to Steam's leaderboard"); return false; } [HarmonyPatch(typeof(FinalCyberRank), "GameOver")] [HarmonyPostfix] private static void Results(FinalCyberRank __instance) { try { if (PartyRun && (Object)(object)__instance.bestWaveText != (Object)null) { TMP_Text bestWaveText = __instance.bestWaveText; bestWaveText.text += "\n<color=#DB5447><size=16>PARTY BEST</size></color>"; } } catch { } } private static void Unseed() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (seeded) { seeded = false; Random.state = saved; } } [HarmonyPatch(typeof(EndlessGrid), "OnTriggerEnter")] [HarmonyPrefix] private static void Starting(EndlessGrid __instance, Collider other) { //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) try { if (!Shared || (Object)(object)other == (Object)null || !((Component)other).CompareTag("Player")) { return; } calls = 0; Scene activeScene = SceneManager.GetActiveScene(); partyRunScene = ((Scene)(ref activeScene)).handle; ArenaPattern[] value = Traverse.Create((object)__instance).Property("CurrentPatternPool", (object[])null).GetValue<ArenaPattern[]>(); if (value != null && value.Length >= 2) { Array.Sort(value, (ArenaPattern a, ArenaPattern b) => string.CompareOrdinal(((Object)(object)a != (Object)null) ? ((Object)a).name : "", ((Object)(object)b != (Object)null) ? ((Object)b).name : "")); Random random = new Random(20260108); for (int num = 0; num < value.Length; num++) { int num2 = random.Next(num, value.Length); ArenaPattern val = value[num]; value[num] = value[num2]; value[num2] = val; } Plugin.Log.LogInfo((object)$"cybergrind: the patterns in the party's order ({value.Length})"); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("cybergrind: couldn't order the patterns (" + ex.Message + ")")); } } [HarmonyPatch(typeof(EndlessGrid), "NextWave")] [HarmonyPrefix] private static void NextWaveBefore(EndlessGrid __instance) { calls = 0; if (Shared) { EnemySync.NewWave(); } Seed(__instance, 1); } [HarmonyPatch(typeof(EndlessGrid), "NextWave")] [HarmonyFinalizer] private static Exception NextWaveAfter(Exception __exception) { Unseed(); Spectate.WaveCleared(); return __exception; } [HarmonyPatch(typeof(EndlessGrid), "ShuffleDecks")] [HarmonyPrefix] private static void ShuffleBefore(EndlessGrid __instance) { Seed(__instance, 2); } [HarmonyPatch(typeof(EndlessGrid), "ShuffleDecks")] [HarmonyFinalizer] private static Exception ShuffleAfter(Exception __exception) { Unseed(); return __exception; } [HarmonyPatch(typeof(EndlessGrid), "GetEnemies")] [HarmonyPrefix] private static void EnemiesBefore(EndlessGrid __instance) { Seed(__instance, 3); } [HarmonyPatch(typeof(EndlessGrid), "GetEnemies")] [HarmonyFinalizer] private static Exception EnemiesAfter(Exception __exception) { Unseed(); return __exception; } [HarmonyPatch(typeof(EndlessGrid), "GetNextEnemy")] [HarmonyPrefix] private static void NextEnemyBefore(EndlessGrid __instance) { Seed(__instance, 4); } [HarmonyPatch(typeof(EndlessGrid), "GetNextEnemy")] [HarmonyFinalizer] private static Exception NextEnemyAfter(Exception __exception) { Unseed(); return __exception; } [HarmonyPatch(typeof(FinalCyberRank), "GameOver")] [HarmonyPrefix] private static bool GameOverBefore() { if (!AllowGameOver) { return !Spectate.CyberWaiting(); } return true; } public static void GameOver() { try { NewMovement instance = MonoSingleton<NewMovement>.Instance; FinalCyberRank val = (((Object)(object)instance != (Object)null) ? ((Component)instance).GetComponentInChildren<FinalCyberRank>(true) : null); if ((Object)(object)val == (Object)null) { val = Object.FindObjectOfType<FinalCyberRank>(true); } AllowGameOver = true; if (val != null) { val.GameOver(); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("cybergrind: couldn't end the run (" + ex.Message + ")")); } finally { AllowGameOver = false; } } } internal static class DamageNumbers { private sealed class Number { public object Target; public Vector3 At; public float Amount; public float Born; public float Last; public bool Head; public bool Kill; } private struct Before { public float Health; public bool Dead; } private const float Life = 0.9f; private const float Merge = 0.2f; private const float ToShown = 10f; private static readonly List<Number> numbers = new List<Number>(); private static GUIStyle style; private static bool show; public static void Enemy(object target, Vector3 at, float damage, bool head, bool kill) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Add(target, at, damage * 10f, head, kill); } public static void Add(object target, Vector3 at, float amount, bool head, bool kill) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if (!show || amount <= 0.05f) { return; } float unscaledTime = Time.unscaledTime; foreach (Number number in numbers) { if (number.Target != null && object.Equals(number.Target, target) && unscaledTime - number.Last < 0.2f) { number.Amount += amount; number.Last = unscaledTime; number.Head |= head; number.Kill |= kill; return; } } if (numbers.Count > 40) { numbers.RemoveAt(0); } numbers.Add(new Number { Target = target, At = at, Amount = amount, Born = unscaledTime, Last = unscaledTime, Head = head, Kill = kill }); } public static void Frame(bool on) { show = on; if (!on) { numbers.Clear(); } } public static void Gui() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) if (!show || numbers.Count == 0 || (int)Event.current.type != 7) { return; } MonoSingleton instance = MonoSingleton.GetInstance(typeof(CameraController)); CameraController val = (CameraController)(object)((instance is CameraController) ? instance : null); Camera val2 = (((Object)(object)val != (Object)null) ? val.cam : Camera.main); if ((Object)(object)val2 == (Object)null) { return; } if (style == null) { style = new GUIStyle(GUI.skin.label) { fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; } float unscaledTime = Time.unscaledTime; Rect val4 = default(Rect); for (int num = numbers.Count - 1; num >= 0; num--) { Number number = numbers[num]; float num2 = unscaledTime - number.Last; if (num2 > 0.9f) { numbers.RemoveAt(num); } else { Vector3 val3 = val2.WorldToScreenPoint(number.At); if (!(val3.z <= 0f)) { float num3 = unscaledTime - number.Born; float num4 = 1f - Mathf.Clamp01((num2 - 0.45f) / 0.45f); float num5 = 1f + Mathf.Max(0f, 0.12f - num2) * 3f; float num6 = (float)Screen.height * (0.022f + Mathf.Clamp01(number.Amount / 60f) * 0.014f) * (number.Kill ? 1.3f : 1f) * num5; style.fontSize = Mathf.Max(8, Mathf.RoundToInt(num6)); float x = val3.x; float num7 = (float)Screen.height - val3.y - num3 * (float)Screen.height * 0.06f; string text = Mathf.Max(1, Mathf.RoundToInt(number.Amount)).ToString(); ((Rect)(ref val4))..ctor(x - 120f, num7 - 30f, 240f, 60f); style.normal.textColor = new Color(0f, 0f, 0f, 0.85f * num4); GUI.Label(new Rect(((Rect)(ref val4)).x + 2f, ((Rect)(ref val4)).y + 2f, ((Rect)(ref val4)).width, ((Rect)(ref val4)).height), text, style); Color textColor = (Color)(number.Kill ? new Color(1f, 0.2f, 0.15f) : (number.Head ? new Color(1f, 0.85f, 0.2f) : Color.white)); textColor.a = num4; style.normal.textColor = textColor; GUI.Label(val4, text, style); } } } } [HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")] [HarmonyPrefix] private static void DamageBefore(EnemyIdentifier __instance, out Before __state) { __state = new Before { Health = (((Object)(object)__instance != (Object)null) ? __instance.health : 0f), Dead = ((Object)(object)__instance == (Object)null || __instance.dead) }; } [HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")] [HarmonyPostfix] private static void DamageAfter(EnemyIdentifier __instance, GameObject target, Vector3 hitPoint, GameObject sourceWeapon, Before __state) { //IL_005d: 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) if (show && !((Object)(object)__instance == (Object)null) && !__state.Dead && !EnemySync.OthersHit && !Pvp.Is(__instance) && ByPlayer(__instance.hitter, sourceWeapon)) { try { __instance.ForceGetHealth(); } catch { } float num = __state.Health - __instance.health; if (num > 0.001f) { Enemy(__instance, Where(__instance, target, hitPoint), num, (Object)(object)target != (Object)null && target.CompareTag("Head"), __instance.dead || __instance.health <= 0f); } } } public static void Sent(EnemyIdentifier eid, GameObject target, Vector3 hitPoint, float multiplier, float crit) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (show && !((Object)(object)eid == (Object)null) && ByPlayer(eid.hitter, null)) { bool flag = (Object)(object)target != (Object)null && target.CompareTag("Head"); Enemy(eid, Where(eid, target, hitPoint), multiplier * (1f + (flag ? Mathf.Max(crit, 0f) : 0f)) * eid.totalDamageTakenMultiplier, flag, kill: false); } } private static bool ByPlayer(string hitter, GameObject sourceWeapon) { if (!Pvp.IsWeapon(hitter ?? "")) { if ((Object)(object)sourceWeapon != (Object)null) { return hitter != "enemy"; } return false; } return true; } private static Vector3 Where(EnemyIdentifier eid, GameObject target, Vector3 hitPoint) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_001e: Unknown result type (might be due to invalid IL or missing references) if (hitPoint != Vector3.zero) { return hitPoint; } if (!((Object)(object)target != (Object)null)) { return ((Component)eid).transform.position; } return target.transform.position; } } [DefaultExecutionOrder(30000)] internal sealed class Host : MonoBehaviour { private McState mc; private bool haveMc; private bool mcWasAlive; private uint lastMcPid; private int epoch; private uint teleportSeq = (uint)((Environment.TickCount & 0x7FFFFFF) | 1); private uint worldId; private string lastScene; private bool teleportPending = true; private const double OtherLevelBlocks = 1500.0; private bool needResync; private Vector3 lastSetRoot; private bool haveLastSet; private float settle; private long qpcFrequency; private bool inGame; private bool mcInWorld; private bool screenOpen; private bool puppet; private bool arriving; private bool ultrakillTakes; private float mcYaw; private float lastUnityYaw; private bool yawInitialized; private NewMovement controlled; private bool savedKinematic; private RigidbodyInterpolation savedInterpolation; private GUIStyle style; private static Texture2D white; internal static Host Current; private float stepTimer; private float stepLog; private float inWorldFor; private float leaveNetherTimer; private float leftInNetherFor; private float respawnedFor; private bool diedInNether; private bool haveLevelPos; private double levelX; private double levelY; private double levelZ; private bool haveWaypoint; private bool everPuppet; private const float TeleportUnits = 8f; private bool mcFrozen; internal static bool FreezeWanted; private bool mcMuted; private double wpX; private double wpY; private double wpZ; private double wpFromX; private double wpFromY; private double wpFromZ; private Vector3 lastEye; private Vector3 lastFeet; private bool thirdPerson; private bool pausedNow; private const int CameraBlockers = 83886528; private Collider floorCollider; private float floorTop; private float floorLift; private bool launching; private float launchSince; private float crossedAt = -100f; private bool ultrakillDrives; private bool ukTargetSet; private bool netherFree; private float farLogAt = -100f; private double ukX; private double ukY; private double ukZ; private float ukSentAt; private uint ukSeq; private bool mcDisabled; private bool toggleRefused; private bool mcBanned; private float toggleNotice; private Key toggleKey; private bool asyncDown; private float lastTogglePress = -100f; private bool loggedAsyncToggle; private static bool? ranInBackground; private static T Find<T>() where T : MonoSingleton<T> { MonoSingleton instance = MonoSingleton.GetInstance(typeof(T)); T val = (T)(object)((instance is T) ? instance : null); if (!((Object)(object)val != (Object)null)) { return default(T); } return val; } private static uint Fnv(string s) { uint num = 2166136261u; string text = s ?? ""; foreach (char c in text) { num = (num ^ c) * 16777619; } if (num != 0) { return num; } return 1u; } private void Update() { Perf.Begin(); try { UpdateFrame(); } finally { Perf.End(late: false); } } private void UpdateFrame() { //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_088d: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_0935: Unknown result type (might be due to invalid IL or missing references) //IL_093a: Unknown result type (might be due to invalid IL or missing references) //IL_0944: Unknown result type (might be due to invalid IL or missing references) //IL_0949: Unknown result type (might be due to invalid IL or missing references) //IL_094e: Unknown result type (might be due to invalid IL or missing references) //IL_0966: Unknown result type (might be due to invalid IL or missing references) //IL_0974: Unknown result type (might be due to invalid IL or missing references) //IL_097c: Unknown result type (might be due to invalid IL or missing references) //IL_097e: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Unknown result type (might be due to invalid IL or missing references) //IL_07b9: Unknown result type (might be due to invalid IL or missing references) //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_07c8: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07d6: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: Unknown result type (might be due to invalid IL or missing references) //IL_07f2: Unknown result type (might be due to invalid IL or missing references) //IL_07fd: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_0a1f: Unknown result type (might be due to invalid IL or missing references) //IL_0a25: Unknown result type (might be due to invalid IL or missing references) //IL_0a2a: Unknown result type (might be due to invalid IL or missing references) //IL_0a2f: Unknown result type (might be due to invalid IL or missing references) //IL_0a50: Unknown result type (might be due to invalid IL or missing references) //IL_0a56: Unknown result type (might be due to invalid IL or missing references) //IL_0a5b: Unknown result type (might be due to invalid IL or missing references) //IL_0a60: Unknown result type (might be due to invalid IL or missing references) //IL_0bb2: Unknown result type (might be due to invalid IL or missing references) //IL_0bb7: Unknown result type (might be due to invalid IL or missing references) //IL_0bc1: Unknown result type (might be due to invalid IL or missing references) //IL_0bc6: Unknown result type (might be due to invalid IL or missing references) //IL_0dec: Unknown result type (might be due to invalid IL or missing references) //IL_0df1: Unknown result type (might be due to invalid IL or missing references) //IL_0f89: Unknown result type (might be due to invalid IL or missing references) //IL_0f8e: Unknown result type (might be due to invalid IL or missing references) //IL_0f90: Unknown result type (might be due to invalid IL or missing references) //IL_0f9e: Unknown result type (might be due to invalid IL or missing references) //IL_0fa3: Unknown result type (might be due to invalid IL or missing references) //IL_0fa7: Unknown result type (might be due to invalid IL or missing references) //IL_0fbd: Unknown result type (might be due to invalid IL or missing references) //IL_0fc4: Unknown result type (might be due to invalid IL or missing references) //IL_1188: Unknown result type (might be due to invalid IL or missing references) //IL_118d: Unknown result type (might be due to invalid IL or missing references) //IL_1197: Unknown result type (might be due to invalid IL or missing references) //IL_119c: Unknown result type (might be due to invalid IL or missing references) //IL_11a1: Unknown result type (might be due to invalid IL or missing references) //IL_11aa: Unknown result type (might be due to invalid IL or missing references) //IL_11b8: Unknown result type (might be due to invalid IL or missing references) //IL_11c6: Unknown result type (might be due to invalid IL or missing references) //IL_11d1: Unknown result type (might be due to invalid IL or missing references) //IL_11d3: Unknown result type (might be due to invalid IL or missing references) //IL_13f3: Unknown result type (might be due to invalid IL or missing references) //IL_1401: Unknown result type (might be due to invalid IL or missing references) //IL_1915: Unknown result type (might be due to invalid IL or missing references) //IL_18ed: Unknown result type (might be due to invalid IL or missing references) Current = this; if (!Link.Ready) { return; } long num = Perf.Now(); Link.Heartbeat(); Perf.Add("Link.Heartbeat", num); bool flag = Link.McAlive(); McState m = default(McState); if (flag && Link.ReadMcState(ref m)) { mc = m; haveMc = true; } else if (!flag) { haveMc = false; } uint num2 = Link.McPid(); bool flag2 = flag && num2 != 0 && num2 != lastMcPid; if (flag) { lastMcPid = num2; } if (flag && (!mcWasAlive || flag2)) { Plugin.Log.LogInfo((object)$"Minecraft connected (pid {num2})"); Launcher.State = Launcher.Status.Running; if (flag2) { Link.ResetOverlay(); } epoch++; Collision.Reset(epoch); Combat.Reset(); teleportPending = true; settle = 0.5f; if (flag2) { mcFrozen = false; mcMuted = false; McCommand.Clear(); } } else if (!flag && mcWasAlive) { Plugin.Log.LogWarning((object)"Minecraft stopped answering"); } mcWasAlive = flag; bool flag3 = haveMc && (mc.Flags & 1) != 0; inWorldFor = (flag3 ? (inWorldFor + Time.unscaledDeltaTime) : 0f); mcInWorld = flag3 && inWorldFor > 0.5f; screenOpen = haveMc && (mc.Flags & 2) != 0; mcBanned = haveMc && (!ServerList.MinecraftAllowed || MinosMode.Active); if (mcBanned && !mcDisabled) { mcDisabled = true; everPuppet = false; Plugin.Log.LogInfo((object)"Minecraft turned off: this party is played without Minecraft"); ChatLines.Add("This party is played without Minecraft: Minecraft's off until you leave it"); } NewMovement val = Find<NewMovement>(); OptionsManager val2 = Find<OptionsManager>(); CameraController val3 = (((Object)(object)val != (Object)null) ? val.cc : null); bool flag4 = (Object)(object)val2 != (Object)null && val2.mainMenu; bool flag5 = SceneHelper.PendingScene != null; inGame = (Object)(object)val != (Object)null && (Object)(object)val3 != (Object)null && !flag4 && ((Component)val).gameObject.activeInHierarchy; bool flag6 = (pausedNow = (Object)(object)val2 != (Object)null && val2.paused); _ = Keyboard.current; bool flag7 = ToggleKey(); if (flag7 && (!inGame || flag6 || (Patches.OwnsPlayer && Patches.McScreenOpen))) { Plugin.Log.LogInfo((object)$"{Plugin.ToggleKey.Value} pressed but ignored: in a level {inGame}, paused {flag6}, a Minecraft screen open {Patches.OwnsPlayer && Patches.McScreenOpen}"); } if (flag7 && inGame && !flag6 && mcBanned) { ChatLines.Add("This party is played without Minecraft"); flag7 = false; } if (flag7 && inGame && !flag6 && (!Patches.OwnsPlayer || !Patches.McScreenOpen)) { toggleNotice = 3f; toggleRefused = Coords.InNether && !mcDisabled && !Physics.Raycast(((Component)val).transform.position, Vector3.down, 24f * Coords.U, 256, (QueryTriggerInteraction)1); if (!toggleRefused) { mcDisabled = !mcDisabled; Plugin.Log.LogInfo((object)(mcDisabled ? "Minecraft turned off: ULTRAKILL has V1" : "Minecraft turned back on")); if (mcDisabled) { everPuppet = false; } else { needResync = true; } } } toggleNotice -= Time.unscaledDeltaTime; string currentScene = SceneHelper.CurrentScene; if (inGame && currentScene != lastScene) { lastScene = currentScene; everPuppet = false; worldId = Fnv(currentScene); Coords.SetLevel(worldId); WorldRender.Reposition(); WorldRender.LevelLoaded(); Nether.LevelChanged(); SmileOs.LevelChanged(); HeldItems.LevelChanged(); RemotePlayers.LevelChanged(); UkThirdPerson.LevelChanged(); Pvp.LevelChanged(); EnemySync.LevelChanged(); WorldSync.LevelChanged(); LevelEvents.LevelChanged(); Shots.LevelChanged(); SandboxSync.LevelChanged(); Plugin.Log.LogInfo((object)$"level {currentScene} (world {worldId:X8}, Minecraft area offset {Coords.OffsetX}, {Coords.OffsetZ})"); if (haveMc && mcInWorld && (Coords.InNether || (Time.unscaledTime - Combat.DimensionAt < 2f && Combat.DimensionNether))) { Plugin.Log.LogInfo((object)"a new level with Minecraft's player in the Nether: sending it back"); Destruction.LeaveNether(); leaveNetherTimer = 5f; } epoch++; Collision.ForgetMeshes(); Collision.Reset(epoch); Combat.Reset(); teleportPending = true; haveLastSet = false; settle = 0.5f; } bool flag8 = false; bool flag9 = haveMc && (mc.Flags & 0x20) != 0; if (Coords.InNether && flag9) { diedInNether = true; respawnedFor = 0f; Coords.SetNether(nether: false); WorldRender.Reposition(); Plugin.Log.LogInfo((object)"Minecraft's player died in the Nether: it respawns in the level"); } if (diedInNether) { bool flag10 = haveMc && mcInWorld && !flag9 && !Coords.IsNetherX(mc.X); respawnedFor = (flag10 ? (respawnedFor + Time.unscaledDeltaTime) : 0f); if (respawnedFor > 0.5f || !inGame) { diedInNether = false; } } bool flag11 = Time.unscaledTime - Combat.DimensionAt < 2f; bool flag12 = haveMc && Coords.IsNetherX(mc.X); if (haveMc && mcInWorld && !diedInNether && flag12 != Coords.InNether && (!flag11 || Combat.DimensionNether == flag12)) { Coords.SetNether(!Coords.InNether); WorldRender.Reposition(); flag8 = true; if (Coords.InNether) { Nether.Landed(Coords.ToUnity(mc.X, mc.Y, mc.Z)); } Plugin.Log.LogInfo((object)(Coords.InNether ? $"Minecraft's player went to the Nether ({mc.X:0}, {mc.Y:0}, {mc.Z:0})" : $"Minecraft's player is back from the Nether ({mc.X:0}, {mc.Y:0}, {mc.Z:0})")); if (mcDisabled && inGame && !val.dead && Coords.IsNetherUnity(((Component)val).transform.position) != Coords.InNether) { Vector3 position = Coords.ToUnity(mc.X, mc.Y, mc.Z) + Vector3.up * 1.5f; ((Component)val).transform.position = position; val.rb.position = position; val.rb.velocity = Vector3.zero; lastSetRoot = position; } } if (haveMc && mcInWorld && !flag9 && !Coords.InNether && !diedInNether && !Coords.IsNetherX(mc.X) && (!flag11 || !Combat.DimensionNether)) { levelX = mc.X; levelY = mc.Y; levelZ = mc.Z; haveLevelPos = true; } bool flag13 = inGame && Coords.IsNetherUnity(((Component)val).transform.position); bool flag14 = inGame && haveMc && mcInWorld && Coords.InNether && !flag13 && !puppet && !flag8; if (inGame && haveMc && mcInWorld && !Coords.InNether && flag13 && !puppet && !flag8 && !val.dead) { Vector3 position2 = Coords.ToUnity(mc.X, mc.Y, mc.Z) + Vector3.up * 1.5f; Plugin.Log.LogInfo((object)"V1 was still in the Nether: it goes to Minecraft's player"); ((Component)val).transform.position = position2; val.rb.position = position2; lastSetRoot = position2; haveLastSet = true; } leaveNetherTimer -= Time.unscaledDeltaTime; leftInNetherFor = (flag14 ? (leftInNetherFor + Time.unscaledDeltaTime) : 0f); if (leftInNetherFor > 1.5f && !flag5 && val.activated && !val.dead && leaveNetherTimer <= 0f) { leaveNetherTimer = 5f; Plugin.Log.LogInfo((object)"V1 is in the level but Minecraft's player is in the Nether: sending it back through its portal"); Destruction.LeaveNether(); } if (inGame && haveLastSet) { Vector3 val4 = ((Component)val).transform.position - lastSetRoot; if (((Vector3)(ref val4)).sqrMagnitude > 64f) { ManualLogSource log = Plugin.Log; val4 = ((Component)val).transform.position - lastSetRoot; log.LogInfo((object)$"ULTRAKILL moved the player {((Vector3)(ref val4)).magnitude:0.0} units; resyncing Minecraft"); teleportPending = true; haveLastSet = false; } } if (!inGame || flag5) { haveLastSet = false; } if (needResync && inGame && !flag5 && !val.dead) { needResync = false; teleportPending = true; } if (teleportPending && inGame && !flag5 && (!flag || Collision.ClearConsumed) && !Coords.InNether) { teleportSeq++; teleportPending = false; } bool flag15 = (Object)(object)val != (Object)null && (Object)(object)val.gc != (Object)null && val.gc.onGround; if ((Object)(object)val == (Object)null || !val.activated || val.dead) { everPuppet = false; } ultrakillTakes = inGame && (mcDisabled || !val.activated || (!everPuppet && !flag15)); double x = 0.0; double y = 0.0; double z = 0.0; if (inGame) { Coords.ToMc(((Component)val).transform.position - Vector3.up * 1.5f, out x, out y, out z); } bool flag16 = haveMc && mcInWorld && inGame && (Math.Abs(mc.X - x) > 8.0 || Math.Abs(mc.Y - y) > 8.0 || Math.Abs(mc.Z - z) > 8.0); bool flag17 = ((!Coords.InNether) ? ((puppet || (flag8 && !ultrakillTakes)) && !teleportPending && mc.TeleportAck == teleportSeq) : (!flag14 && !ultrakillTakes)); bool flag18 = !Coords.InNether && !flag8 && (Math.Abs(mc.X - x) > 1500.0 || Math.Abs(mc.Z - z) > 1500.0); if (flag16 && flag17 && flag18 && !val.dead && !flag9 && !ultrakillDrives) { Plugin.Log.LogInfo((object)$"Minecraft's player was moved to ({mc.X:0.0}, {mc.Y:0.0}, {mc.Z:0.0}), another level's part of the world: put back at V1"); teleportPending = true; flag17 = false; } if (flag16 && flag17 && !val.dead && !flag9 && !ultrakillDrives) { Plugin.Log.LogInfo((object)$"Minecraft's player moved itself to ({mc.X:0.0}, {mc.Y:0.0}, {mc.Z:0.0}): V1 follows"); flag16 = false; } if (flag8) { crossedAt = Time.unscaledTime; } bool flag19 = !Coords.InNether || (Time.unscaledTime - crossedAt > 2f && Physics.Raycast(((Component)val).transform.position, Vector3.down, 24f * Coords.U, 256, (QueryTriggerInteraction)1)); bool flag20 = inGame && !flag5 && !flag8 && !mcDisabled && !val.dead && !flag9 && flag19 && Time.unscaledTime - Combat.LastSignal < 2f && Time.unscaledTime - Combat.LastStop > 3f; bool flag21 = Time.unscaledTime - Combat.LastStop < 0.5f; bool flag22 = haveMc && Math.Abs(mc.X - x) < 1.5 && Math.Abs(mc.Y - y) < 2.5 && Math.Abs(mc.Z - z) < 1.5; netherFree = mcDisabled && Coords.InNether == flag13 && inGame && !flag5 && haveMc && mcInWorld && !val.dead && !flag9 && !(flag21 && flag22) && Time.unscaledTime - crossedAt > 2f; if (netherFree) { teleportPending = false; } Vector3 top; if (ultrakillDrives || netherFree) { if ((Object)(object)val.playerCollider != (Object)null && ((Collider)val.playerCollider).enabled) { Vector3 position3 = ((Component)val).transform.position; float x2 = position3.x; Bounds bounds = ((Collider)val.playerCollider).bounds; Coords.ToMc(new Vector3(x2, ((Bounds)(ref bounds)).min.y + 0.02f * Coords.U, position3.z), out x, out y, out z); } bool flag23 = ultrakillDrives && ukTargetSet && teleportSeq == ukSeq && mc.TeleportAck == teleportSeq && (Math.Abs(mc.X - ukX) > 4.0 || Math.Abs(mc.Y - ukY) > 4.0 || Math.Abs(mc.Z - ukZ) > 4.0); if (flag23 && !Coords.InNether && (Math.Abs(mc.X - ukX) > 1500.0 || Math.Abs(mc.Z - ukZ) > 1500.0)) { Plugin.Log.LogInfo((object)$"Minecraft's player was moved to ({mc.X:0.0}, {mc.Y:0.0}, {mc.Z:0.0}), another level's part of the world: put back at V1"); teleportPending = true; flag23 = false; } if (flag23) { Plugin.Log.LogInfo((object)$"Minecraft's player moved itself to ({mc.X:0.0}, {mc.Y:0.0}, {mc.Z:0.0}): V1 follows"); Vector3 position4 = Coords.ToUnity(mc.X, mc.Y, mc.Z) + Vector3.up * 1.5f; ((Component)val).transform.position = position4; val.rb.position = position4; val.rb.velocity = Vector3.zero; lastSetRoot = position4; x = mc.X; y = mc.Y; z = mc.Z; ukTargetSet = false; } else if (Coords.IsNetherX(x) != Coords.InNether || (Coords.InNether && (Math.Abs(x - mc.X) > 200.0 || Math.Abs(y - mc.Y) > 200.0 || Math.Abs(z - mc.Z) > 200.0))) { if (Time.unscaledTime - farLogAt > 5f) { farLogAt = Time.unscaledTime; Plugin.Log.LogInfo((object)$"V1 is far from Minecraft's player ({x:0}, {y:0}, {z:0}): it isn't moved there"); } } else if (!teleportPending && mc.TeleportAck == teleportSeq && Time.unscaledTime - ukSentAt >= 0.05f && (!ukTargetSet || Math.Abs(x - ukX) > 0.01 || Math.Abs(y - ukY) > 0.01 || Math.Abs(z - ukZ) > 0.01)) { teleportSeq++; ukX = x; ukY = y; ukZ = z; ukTargetSet = true; ukSeq = teleportSeq; ukSentAt = Time.unscaledTime; } flag16 = false; } else if (puppet && !flag16 && !teleportPending && mc.TeleportAck == teleportSeq && !flag9 && !Coords.InNether && RisingFloor(Coords.ToUnity(mc.X, mc.Y, mc.Z), out top)) { Coords.ToMc(top, out x, out y, out z); teleportSeq++; } StepTowards(flag16, inGame && !flag5 && !ultrakillTakes && !val.dead && !Coords.InNether, x, y, z); arriving = haveMc && mcInWorld && inGame && !flag5 && (mc.TeleportAck != teleportSeq || flag16) && !ultrakillTakes; puppet = haveMc && mcInWorld && inGame && !flag5 && (mc.TeleportAck == teleportSeq || (ultrakillDrives && ukTargetSet)) && !flag16 && !val.dead && !ultrakillTakes; bool flag24 = (puppet || arriving) && inGame && !val.dead; if (flag24 != ((Object)(object)controlled != (Object)null) || (flag24 && (Object)(object)controlled != (Object)(object)val)) { if (!flag24 && (Object)(object)controlled != (Object)null) { Plugin.Log.LogInfo((object)(string.Format("handing V1 back: inGame {0}, loading {1}, Minecraft {2}, in world {3}, ", inGame, flag5, haveMc ? "up" : "down", mcInWorld) + $"dead {(Object)(object)val != (Object)null && val.dead}, ULTRAKILL cutscene {ultrakillTakes}")); } SetControl(flag24 ? val : null); } everPuppet |= puppet; if (launching && (val.dead || !inGame || flag5 || !flag19 || Time.unscaledTime - launchSince > 10f || (Time.unscaledTime - launchSince > 0.3f && (Object)(object)val.gc != (Object)null && val.gc.onGround))) { launching = false; } SetUltrakillDrives((Object)(object)controlled != (Object)null && puppet && (flag20 || launching)); if (puppet && !val.dead && (Object)(object)val.deathSequence != (Object)null && ((Component)val.deathSequence).gameObject.activeSelf) { Plugin.Log.LogInfo((object)"ULTRAKILL's death screen was still up on a living V1; closing it"); ((Component)val.deathSequence).gameObject.SetActive(false); } Patches.OwnsPlayer = (Object)(object)controlled != (Object)null; long num3 = Perf.Now(); Lockout.Frame((Object)(object)controlled != (Object)null, ultrakillDrives && !screenOpen); Perf.Add("Lockout.Frame", num3); long num4 = Perf.Now(); HeldItems.Frame((Object)(object)controlled != (Object)null, ((Object)(object)val != (Object)null) ? val.cc : null); Perf.Add("HeldItems.Frame", num4); long num5 = Perf.Now(); HurtZones.Frame(val, (Object)(object)controlled != (Object)null && (Object)(object)val != (Object)null && (Object)(object)val.rb != (Object)null && val.rb.isKinematic && inGame && !flag5); Perf.Add("HurtZones.Frame", num5); FreezeMinecraft((flag6 && inGame) || mcBanned); Patches.McScreenOpen = screenOpen && !McCommand.Busy; InputForward.UltrakillMoves = ultrakillDrives && !screenOpen; long num6 = Perf.Now(); InputForward.Frame((Object)(object)controlled != (Object)null && puppet && !flag6 && !McCommand.Busy && !Typing.Active, screenOpen, Screen.width, Screen.height); Perf.Add("InputForward.Frame", num6); long num7 = Perf.Now(); HudHider.Frame((Object)(object)controlled != (Object)null || MinosMode.IAmMinos, val); Perf.Add("HudHider.Frame", num7); long num8 = Perf.Now(); MobHits.Frame(mcDisabled && inGame && !flag5 && haveMc && mcInWorld && !val.dead, haveMc ? Coords.ToUnity(mc.X, mc.Y, mc.Z) : Vector3.zero); Perf.Add("MobHits.Frame", num8); long num9 = Perf.Now(); Combat.Frame(flag && inGame && mcInWorld && !mcDisabled, inGame && haveMc && mcInWorld, netherFree, val); Perf.Add("Combat.Frame", num9); KillNet.Receive(delegate(int from, byte type, BinaryReader r) { if ((!Replay.Playing || !Replay.LevelType(type)) && ((type != 100 && type != 101) || from == -1) && ((type != 203 && type != 201) || from == -2)) { Dispatch(from, type, r); } }); DamageNumbers.Frame((mcDisabled || !haveMc) && inGame && !flag6); long num10 = Perf.Now(); UkThirdPerson.Frame(mcDisabled || !haveMc, inGame, flag6, val3); Perf.Add("UkThirdPerson.Frame", num10); long num11 = Perf.Now(); ShaderPack.Frame(inGame, flag6, Patches.McScreenOpen || McCommand.Busy); Perf.Add("ShaderPack.Frame", num11); bool flag25 = inGame; Versus.Frame(inGame && !flag5); long num12 = Perf.Now(); Room.Frame(worldId, flag25, mcDisabled || !haveMc, Coords.InNether); Perf.Add("Room.Frame", num12); long num13 = Perf.Now(); RemotePlayers.Frame(val, ((Object)(object)val != (Object)null) ? val.cc : null, flag25, mcDisabled || !haveMc); Perf.Add("RemotePlayers.Frame", num13); long num14 = Perf.Now(); MinosMode.Frame(val, flag25, flag6); Perf.Add("MinosMode.Frame", num14); long num15 = Perf.Now(); EnemySync.Frame(); Perf.Add("EnemySync.Frame", num15); long num16 = Perf.Now(); SandboxSync.Frame(flag25 && !flag5); Perf.Add("SandboxSync.Frame", num16); PlayerCollision.Frame(val, flag25 && !flag5 && !flag6, mcDisabled || !haveMc); OutOfMap.Frame(val, flag25 && !flag5 && !flag6, mcDisabled || !haveMc); long num17 = Perf.Now(); WorldSync.Frame(RemotePlayers.Positions()); Perf.Add("WorldSync.Frame", num17); long num18 = Perf.Now(); Shots.Frame(); Perf.Add("Shots.Frame", num18); Pvp.Frame(); long num19 = Perf.Now(); Typing.Frame(); ServerList.Frame(); DiscordRpc.Frame(inGame && !flag5); Profiles.Frame(val, inGame && !flag5, flag6); PartyChat.Frame(); ModeChoice.Frame(flag4, flag5); PartyMenu.Frame(inGame, flag6, flag4, flag5); PartyWake.Frame(); LoadingScreen.Frame(); OptionsTab.Frame(); Replays.Frame(flag4 && !flag5); KillcraftPanel.Frame(inGame, flag6, flag4, flag5); PartyHud.Frame(inGame && !flag5, flag6); Spectate.Frame(inGame && !flag5, flag6); Replay.Frame(inGame, flag5, flag6, val); ReplayPlayer.Frame(inGame, flag5, flag6); PvpSetting.Frame(); ChatBox.Frame(inGame && !flag5, flag6, mcDisabled || !haveMc); Skins.OwnFrame(inGame && !flag5); PartyRules.Frame(); LevelVote.Frame(); Score.Frame(val, inGame && !flag5); PartyStyle.Frame(inGame && !flag5); KeepRunning(); Pings.Frame(val, inGame && !flag5, flag6); Perf.Add("Party", num19); long num20 = Perf.Now(); Voice.Frame(Patches.McScreenOpen || McCommand.Busy || Typing.Active); Perf.Add("Voice", num20); long num21 = Perf.Now(); McEvent e; while (Link.PopEvent(out e)) { Combat.Handle(in e, val); } Perf.Add("Minecraft's events", num21); long num22 = Perf.Now(); WorldRender.Drain(); Perf.Add("WorldRender.Drain", num22); long num23 = Perf.Now(); WorldRender.Relight(); Perf.Add("WorldRender.Relight", num23); SkyState s = new SkyState { Flags = (uint)((inGame ? 1 : 0) | (flag6 ? 2 : 0) | ((flag5 || (!diedInNether && ((ultrakillTakes && !mcDisabled) || ((Object)(object)val != (Object)null && val.dead) || (inGame && (!haveMc || !mcInWorld))))) ? 4 : 0)), WorldId = worldId, Epoch = (uint)epoch, TeleportSeq = teleportSeq, ViewportW = (uint)Mathf.Min(Screen.width, 3840), ViewportH = (uint)Mathf.Min(Screen.height, 2160), GameHour = 12f }; if (inGame) { s.X = x; s.Y = y; s.Z = z; if (haveWaypoint) { s.X = wpX; s.Y = wpY; s.Z = wpZ; } bool flag26 = teleportPending || haveWaypoint || mc.TeleportAck != teleportSeq || flag16; bool flag27 = (ultrakillDrives || netherFree) && mc.TeleportAck != teleportSeq; if ((Coords.InNether || diedInNether || flag13) && haveLevelPos && !flag27) { s.X = levelX; s.Y = levelY; s.Z = levelZ; } else if (haveMc && mcInWorld && !flag9 && (puppet || (mcDisabled && flag21)) && !flag26 && !flag27) { s.X = 100000.0 + Math.Floor(mc.X / 8.0) + 0.5; s.Y = 70.0; s.Z = Math.Floor(mc.Z / 8.0) + 0.5; } if (!yawInitialized) { mcYaw = Coords.YawToMc(val3.rotationY); yawInitialized = true; } else { mcYaw += Mathf.DeltaAngle(lastUnityYaw, val3.rotationY); } lastUnityYaw = val3.rotationY; s.Yaw = mcYaw; s.Pitch = Coords.PitchToMc(val3.rotationX); } Link.WriteSkyState(in s); settle -= Time.unscaledDeltaTime; if (haveMc && inGame && !flag5 && settle <= 0f) { if (puppet) { Collision.Update(mc.X, mc.Y, mc.Z); } else { Collision.Update(x, y, z); } } } private void NextStep(double tx, double ty, double tz, out double x, out double y, out double z) { bool flag = Math.Abs(mc.X - tx) > 0.5; bool flag2 = Math.Abs(mc.Y - ty) > 0.5; bool flag3 = Math.Abs(mc.Z - tz) > 0.5; int num = (flag ? 1 : 0) + (flag2 ? 1 : 0) + (flag3 ? 1 : 0); x = tx; y = ty; z = tz; double num2 = (Math.Abs(mc.X - tx) + 1.0) * (Math.Abs(mc.Y - ty) + 2.0) * (Math.Abs(mc.Z - tz) + 1.0); if (num > 1 && !(num2 < 200000.0)) { if (flag) { y = mc.Y; } z = mc.Z; } } private void FreezeMinecraft(bool freeze) { if (freeze != mcFrozen && haveMc && mcInWorld) { mcFrozen = freeze; Plugin.Log.LogInfo((object)(freeze ? "Minecraft frozen (paused)" : "Minecraft running again")); } FreezeWanted = mcFrozen; bool flag = mcFrozen || (mcDisabled && inGame); if (flag != mcMuted && haveMc) { mcMuted = flag; McAudio.SetMuted(Link.McPid(), flag); } McCommand.Frame(haveMc && mcInWorld, screenOpen); } private void StepTowards(bool away, bool canStep, double tx, double ty, double tz) { if (!away) { haveWaypoint = false; stepTimer = 0f; stepLog = 0f; return; } bool flag = Math.Abs(mc.X - wpX) < 1.0 && Math.Abs(mc.Y - wpY) < 1.0 && Math.Abs(mc.Z - wpZ) < 1.0; bool flag2 = Math.Abs(mc.X - wpFromX) > 4.0 || Math.Abs(mc.Y - wpFromY) > 4.0 || Math.Abs(mc.Z - wpFromZ) > 4.0; if (!haveWaypoint || !canStep || (flag2 && !flag)) { NextStep(tx, ty, tz, out wpX, out wpY, out wpZ); wpFromX = mc.X; wpFromY = mc.Y; wpFromZ = mc.Z; haveWaypoint = true; stepTimer = 0f; flag = Math.Abs(mc.X - wpX) < 1.0 && Math.Abs(mc.Y - wpY) < 1.0 && Math.Abs(mc.Z - wpZ) < 1.0; } bool flag3 = mc.TeleportAck == teleportSeq || mc.TeleportAck == teleportSeq - 1; stepLog += Time.unscaledDeltaTime; if (stepLog > 3f) { stepLog = 0f; Plugin.Log.LogInfo((object)($"Minecraft's player is still far from V1: at ({mc.X:0.0}, {mc.Y:0.0}, {mc.Z:0.0}), waypoint ({wpX:0.0}, {wpY:0.0}, {wpZ:0.0}); " + $"can step {canStep}, teleport pending {teleportPending}, ack {mc.TeleportAck}/{teleportSeq}")); } if (!canStep || teleportPending) { stepTimer = 0f; return; } stepTimer += Time.unscaledDeltaTime; if ((flag && flag3 && stepTimer >= 0.4f) || stepTimer >= 3f) { NextStep(tx, ty, tz, out wpX, out wpY, out wpZ); wpFromX = mc.X; wpFromY = mc.Y; wpFromZ = mc.Z; stepTimer = 0f; teleportSeq++; Plugin.Log.LogInfo((object)$"Minecraft's player is far from V1 (at {mc.X:0}, {mc.Y:0}, {mc.Z:0}): next waypoint ({wpX:0}, {wpY:0}, {wpZ:0})"); } } internal void ThirdPerson() { //IL_0065: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00aa: 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_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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_00ca: 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_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_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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: 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_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) CameraController val = (((Object)(object)controlled != (Object)null) ? controlled.cc : null); bool num = (Object)(object)val != (Object)null && haveMc && mcInWorld && inGame && !pausedNow && mc.CameraMode != 0; Vector3 feet = ((!((Object)(object)controlled != (Object)null)) ? Vector3.zero : ((puppet && !ultrakillDrives) ? lastFeet : (((Component)controlled).transform.position - Vector3.up * 1.5f))); WorldRender.PlaceAvatar(num, feet); if (!num) { if (thirdPerson && (Object)(object)val != (Object)null) { ((Component)val).transform.localPosition = val.defaultPos; } thirdPerson = false; return; } thirdPerson = true; Vector3 val2; if (!puppet || ultrakillDrives) { Matrix4x4 localToWorldMatrix = ((Component)val).transform.parent.localToWorldMatrix; val2 = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint3x4(val.defaultPos); } else { val2 = lastEye; } Vector3 val3 = val2; float num2 = ((mc.CameraDistance > 0.1f) ? mc.CameraDistance : 4f) * Coords.U; Quaternion val4 = ((Component)val).transform.parent.rotation * Quaternion.AngleAxis(0f - val.rotationX, Vector3.right); Vector3 val5 = val4 * Vector3.forward; Vector3 val6 = ((mc.CameraMode == 2) ? val5 : (-val5)); RaycastHit val7 = default(RaycastHit); if (Physics.SphereCast(val3, 0.2f * Coords.U, val6, ref val7, num2, 83886528, (QueryTriggerInteraction)1)) { num2 = Mathf.Max(0f, ((RaycastHit)(ref val7)).distance - 0.05f * Coords.U); } ((Component)val).transform.position = val3 + val6 * num2; ((Component)val).transform.rotation = ((mc.CameraMode == 2) ? Quaternion.LookRotation(-val5, val4 * Vector3.up) : val4); } private bool RisingFloor(Vector3 feet, out Vector3 top) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) top = feet; float u = Coords.U; Collider val = null; RaycastHit val2 = default(RaycastHit); float num = float.MaxValue; RaycastHit[] array = Physics.RaycastAll(feet + Vector3.up * (1.6f * u), Vector3.down, 1.65f * u, 83886528, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (((RaycastHit)(ref val3)).distance < num && !WorldRender.IsOurs(((RaycastHit)(ref val3)).collider)) { num = ((RaycastHit)(ref val3)).distance; val = ((RaycastHit)(ref val3)).collider; val2 = val3; } } if ((Object)(object)val == (Object)null) { floorCollider = null; return false; } Bounds bounds = val.bounds; float y = ((Bounds)(ref bounds)).max.y; bool num2 = (Object)(object)val == (Object)(object)floorCollider && y > floorTop + 0.001f; floorCollider = val; floorTop = y; floorLift -= Time.unscaledDeltaTime; if (!num2 || ((RaycastHit)(ref val2)).point.y < feet.y + 0.03f * u || floorLift > 0f) { return false; } floorLift = 0.1f; top = new Vector3(feet.x, ((RaycastHit)(ref val2)).point.y + 0.01f * u, feet.z); return true; } internal void StartLaunch() { if (!((Object)(object)controlled == (Object)null) && puppet) { launching = true; launchSince = Time.unscaledTime; if (!ultrakillDrives) { Plugin.Log.LogInfo((object)"launched: ULTRAKILL's physics move V1 until it lands"); SetUltrakillDrives(on: true); } } } private void SetUltrakillDrives(bool on) { //IL_0054: 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) if (on != ultrakillDrives) { ultrakillDrives = on; ukTargetSet = false; Patches.UltrakillMoves = on; Link.PushInput(6, 0); if ((Object)(object)controlled != (Object)null && (Object)(object)controlled.rb != (Object)null) { controlled.rb.velocity = Vector3.zero; controlled.rb.isKinematic = !on; controlled.rb.interpolation = (RigidbodyInterpolation)(on ? ((int)savedInterpolation) : 0); } Plugin.Log.LogInfo((object)(on ? "ULTRAKILL's movement moves V1 (Potion of ULTRAKILL or a launch)" : "Minecraft moves V1 again")); } } private void SetControl(NewMovement nm) { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (ultrakillDrives) { ultrakillDrives = false; ukTargetSet = false; Patches.UltrakillMoves = false; } GunControl val = Find<GunControl>(); FistControl val2 = Find<FistControl>(); if ((Object)(object)controlled != (Object)null) { Plugin.Log.LogInfo((object)"ULTRAKILL has the player back"); if ((Object)(object)controlled.rb != (Object)null) { controlled.rb.isKinematic = savedKinematic; controlled.rb.interpolation = savedInterpolation; } try { if (val != null) { val.YesWeapon(); } if (val2 != null) { val2.YesFist(); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("restoring weapons: " + ex.Message)); } needResync = true; haveLastSet = false; } controlled = nm; if (!((Object)(object)nm != (Object)null)) { return; } Plugin.Log.LogInfo((object)"Minecraft drives the player"); nm.rb.velocity = Vector3.zero; savedKinematic = nm.rb.isKinematic; savedInterpolation = nm.rb.interpolation; nm.rb.interpolation = (RigidbodyInterpolation)0; nm.rb.isKinematic = true; nm.sliding = false; try { if (val != null) { val.NoWeapon(); } if (val2 != null) { val2.NoFist(); } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("hiding weapons: " + ex2.Message)); } } private void LateUpdate() { Perf.Begin(); try { LateFrame(); } finally { Perf.End(late: true); } } private void LateFrame() { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) if (Link.Ready) { if (Plugin.Diagnostics.Value && Keyboard.current != null && ((ButtonControl)Keyboard.current.f7Key).wasPressedThisFrame) { WorldRender.DebugCycle(); } long num = Perf.Now(); Overlay.Frame(haveMc && mcInWorld && (Object)(object)controlled != (Object)null && !mcFrozen && !McCommand.Busy); Perf.Add("Overlay.Frame", num); long num2 = Perf.Now(); WorldRender.Frame(haveMc && mcInWorld && inGame && !mcBanned); Perf.Add("WorldRender.Frame", num2); MoveV1(); NewMovement val = Find<NewMovement>(); bool num3 = inGame && Coords.InNether && (Object)(object)val != (Object)null && Coords.IsNetherUnity(((Component)val).transform.position); long num4 = Perf.Now(); Nether.Frame(num3, ((Object)(object)val != (Object)null) ? val.cc : null); Perf.Add("Nether.Frame", num4); long num5 = Perf.Now(); NetherWorld.Frame(num3 && (puppet || netherFree) && !mcFrozen && !val.dead, ((Object)(object)val != (Object)null) ? ((Component)val).transform.position : Vector3.zero); Perf.Add("NetherWorld.Frame", num5); ThirdPerson(); long num6 = Perf.Now(); UkThirdPerson.Place(); Spectate.Place(); ReplayPlayer.Place(); MinosControl.Place(); Perf.Add("UkThirdPerson.Place", num6); long num7 = Perf.Now(); Skins.OwnArms(); Perf.Add("Skins.OwnArms", num7); long num8 = Perf.Now(); ShaderPack.LateFrame(); Perf.Add("ShaderPack.LateFrame", num8); long num9 = Perf.Now(); HeldItems.Pose(((Object)(object)val != (Object)null) ? val.cc : null); Perf.Add("HeldItems.Pose", num9); long num10 = Perf.Now(); EnemySync.LateFrame(); Perf.Add("EnemySync.LateFrame", num10); long num11 = Perf.Now(); RemotePlayers.LateFrame(); Perf.Add("RemotePlayers.LateFrame", num11); Hats.LateFrame(inGame); long num12 = Perf.Now(); SmileOs.Frame(inGame && haveMc && mcInWorld); Perf.Add("SmileOs.Frame", num12); } } private void MoveV1() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d7: 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) if (!((Object)(object)controlled == (Object)null) && !((Object)(object)controlled.cc == (Object)null)) { if (ultrakillDrives) { lastSetRoot = ((Component)controlled).transform.position; } else if (puppet) { Interpolate(out var x, out var y, out var z, out var eye); lastFeet = Coords.ToUnity(x, y, z); Vector3 position = lastFeet + Vector3.up * 1.5f; ((Component)controlled).transform.position = position; controlled.rb.position = position; ((Component)controlled.cc).transform.position = (lastEye = Coords.ToUnity(x, y + eye, z)); lastSetRoot = position; } else { lastSetRoot = ((Component)controlled).transform.position; } haveLastSet = true; } } private void Interpolate(out double x, out double y, out double z, out double eye) { bool flag = Math.Abs(mc.CurX - mc.X) > 4.0 || Math.Abs(mc.CurY - mc.Y) > 4.0 || Math.Abs(mc.CurZ - mc.Z) > 4.0; if (mc.TickQpc != 0L && mc.TickMs > 0f && !flag) { if (qpcFrequency == 0L) { Native.QueryPerformanceFrequency(out qpcFrequency); } Native.QueryPerformanceCounter(out var value); double num = (double)(mc.TickMs * (float)qpcFrequency) / 1000.0; double num2 = Math.Max(0.0, Math.Min(1.0, (double)(value - mc.TickQpc) / num)); if (Math.Abs(mc.CurX - mc.PrevX) > 4.0 || Math.Abs(mc.CurY - mc.PrevY) > 4.0 || Math.Abs(mc.CurZ - mc.PrevZ) > 4.0) { num2 = 1.0; } x = mc.PrevX + (mc.CurX - mc.PrevX) * num2; y = mc.PrevY + (mc.CurY - mc.PrevY) * num2; z = mc.PrevZ + (mc.CurZ - mc.PrevZ) * num2; eye = (double)mc.TickEyeO + (double)(mc.TickEye - mc.TickEyeO) * num2; } else { x = mc.X; y = mc.Y; z = mc.Z; eye = ((mc.EyeHeight > 0f) ? mc.EyeHeight : 1.62f); } } private bool ToggleKey() { //IL_0001: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Invalid comparison between Unknown and I4 //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Invalid comparison between Unknown and I4 //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00da: 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_0147: Unknown result type (might be due to invalid IL or missing references) if ((int)toggleKey == 0 && (!Enum.TryParse<Key>(Plugin.ToggleKey.Value, ignoreCase: true, out toggleKey) || (int)toggleKey == 0)) { toggleKey = (Key)102; } bool flag = false; IEnumerable<InputDevice> enumerable2; if (!Typing.Active) { IEnumerable<InputDevice> enumerable = (IEnumerable<InputDevice>)(object)InputSystem.devices; enumerable2 = enumerable; } else { IEnumerable<InputDevice> enumerable = (IEnumerable<InputDevice>)(object)new InputDevice[0]; enumerable2 = enumerable; } foreach (InputDevice item in enumerable2) { Keyboard val = (Keyboard)(object)((item is Keyboard) ? item : null); if (val != null && ((InputDevice)val).enabled) { KeyControl val2 = val[toggleKey]; if (val2 != null && ((ButtonControl)val2).wasPressedThisFrame) { flag = true; break; } } } int num = (((int)toggleKey < 94 || (int)toggleKey > 105) ? (((int)toggleKey >= 15 && (int)toggleKey <= 40) ? (65 + (toggleKey - 15)) : 0) : (112 + (toggleKey - 94))); if (num != 0) { bool flag2 = Application.isFocused && (Native.GetAsyncKeyState(num) & 0x8000) != 0; if (flag2 && !asyncDown && !flag && Time.unscaledTime - lastTogglePress > 0.3f) { flag = true; if (!loggedAsyncToggle) { loggedAsyncToggle = true; Plugin.Log.LogInfo((object)$"{toggleKey}: Windows has it pressed, but ULTRAKILL's input never saw it (keyboard software?); taken from Windows"); } } asyncDown = flag2; } if (flag) { if (Time.unscaledTime - lastTogglePress < 0.3f) { return false; } lastTogglePress = Time.unscaledTime; } return flag; } private string StatusText() { if (toggleNotice > 0f && toggleRefused) { return "Killcraft: Minecraft can only be turned off in the Nether while standing on ground"; } if (toggleNotice > 0f) { if (!mcDisabled) { return "Killcraft: Minecraft back on"; } return "Killcraft: Minecraft off, plain ULTRAKILL (" + Plugin.ToggleKey.Value + " turns it back on)"; } if (mcDisabled) { return null; } if (!Link.Ready) { return "Killcraft: couldn't create the shared memory (see BepInEx/LogOutput.log)"; } if (!mcWasAlive && (ModeChoice.Pending || (!Plugin.WithMinecraft && Launcher.State == Launcher.Status.Off))) { return null; } if (!mcWasAlive) { return Launcher.State switch { Launcher.Status.SignIn => "Killcraft: sign in to your Microsoft account in the Prism Launcher window (first time only), then Minecraft starts by itself", Launcher.Status.Starting => "Killcraft: starting Minecraft... (the first launch downloads Minecraft and Java and takes a few minutes)", Launcher.Status.NoLauncher => "Killcraft: no Minecraft to start: put SkyCraft-Minecraft.zip in BepInEx/plugins/Killcraft", Launcher.Status.Failed => "Killcraft: starting Minecraft failed (see BepInEx/LogOutput.log)", _ => "Killcraft: waiting for Minecraft (the SkyCraft instance in Prism Launcher)", }; } if (!inGame) { return null; } if (!mcInWorld) { return "Killcraft: Minecraft is opening its world..."; } if (arriving && !ultrakillDrives) { return $"Killcraft: sending the level to Minecraft ({Collision.SentRegions} regions)..."; } return null; } private void OnGUI() { //IL_0067: 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_00aa: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) DamageNumbers.Gui(); Voice.Gui(); RemotePlayers.Gui(); string text = StatusText(); if (text != null) { if (style == null) { style = new GUIStyle(GUI.skin.label) { fontSize = 18, wordWrap = true }; } Rect val = default(Rect); ((Rect)(ref val))..ctor(12f, 12f, (float)(Screen.width - 24), 60f); GUI.color = Color.black; GUI.Label(new Rect(((Rect)(ref v