Decompiled source of Everest v1.4.0
BepInEx/plugins/Everest.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks.CompilerServices; using Everest.Accessories; using Everest.Api; using Everest.Core; using Everest.Jobs; using Everest.UI; using Everest.Utilities; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Photon.Pun; using Photon.Realtime; using Steamworks; using TMPro; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; using Unity.Jobs; using Unity.Jobs.LowLevel.Unsafe; using Unity.Mathematics; using UnityEngine; using UnityEngine.LowLevel; using UnityEngine.Networking; using UnityEngine.Pool; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Steven \ud83c\udf80")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.4.0.0")] [assembly: AssemblyInformationalVersion("1.4.0+826419b63f0002ad0a145350f0b542d62e6a43cf")] [assembly: AssemblyProduct("Everest")] [assembly: AssemblyTitle("Everest")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace Everest { [BepInPlugin("com.steven.peak.everest", "Everest", "1.4.0")] public class EverestPlugin : BaseUnityPlugin { [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <Awake>d__1 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public EverestPlugin <>4__this; private Stopwatch <stopwatch>5__2; private Awaiter <>u__1; private void MoveNext() { //IL_011c: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; EverestPlugin everestPlugin = <>4__this; try { UniTask val2; Awaiter val; switch (num) { default: Instance = everestPlugin; <stopwatch>5__2 = new Stopwatch(); <stopwatch>5__2.Start(); ConfigHandler.Initialize(); if (ConfigHandler.Enabled) { if (ConfigHandler.AllowUploads) { new Harmony("com.steven.peak.everest").PatchAll(); } else { LogInfo("Uploads are disabled in the configuration. Patching skipped."); } JsonConvert.DefaultSettings = () => new JsonSerializerSettings { Converters = new List<JsonConverter> { (JsonConverter)(object)new Vector3Converter(), (JsonConverter)(object)new QuaternionConverter() }, ReferenceLoopHandling = (ReferenceLoopHandling)1 }; if (!PlayerLoopHelper.IsInjectedUniTaskPlayerLoop()) { PlayerLoopSystem currentPlayerLoop = PlayerLoop.GetCurrentPlayerLoop(); PlayerLoopHelper.Initialize(ref currentPlayerLoop, (InjectPlayerLoopTimings)65535); } SceneManager.activeSceneChanged += everestPlugin.OnActiveSceneChanged; if (ConfigHandler.ShowToasts) { new GameObject("Everest UI Manager").AddComponent<ToastController>(); } val2 = SkeletonManager.LoadSkeletonPrefabAsync(); val = ((UniTask)(ref val2)).GetAwaiter(); if (!((Awaiter)(ref val)).IsCompleted) { num = (<>1__state = 0); <>u__1 = val; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <Awake>d__1>(ref val, ref this); return; } goto IL_0138; } LogInfo("Everest is disabled in the configuration. Exiting..."); goto end_IL_000e; case 0: val = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_0138; case 1: val = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_0199; case 2: { val = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); break; } IL_0138: ((Awaiter)(ref val)).GetResult(); val2 = AccessoryManager.Initialize(); val = ((UniTask)(ref val2)).GetAwaiter(); if (!((Awaiter)(ref val)).IsCompleted) { num = (<>1__state = 1); <>u__1 = val; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <Awake>d__1>(ref val, ref this); return; } goto IL_0199; IL_0199: ((Awaiter)(ref val)).GetResult(); val2 = TombstoneHandler.Initialize(); val = ((UniTask)(ref val2)).GetAwaiter(); if (!((Awaiter)(ref val)).IsCompleted) { num = (<>1__state = 2); <>u__1 = val; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <Awake>d__1>(ref val, ref this); return; } break; } ((Awaiter)(ref val)).GetResult(); int num2 = NativeInterop.InitializeNativePlugin(); LogInfo($"Native Plugin initialized in mode: {num2}"); <stopwatch>5__2.Stop(); LogInfo($"Everest Initialized in {(float)<stopwatch>5__2.ElapsedMilliseconds / 1000f} seconds."); end_IL_000e:; } catch (Exception exception) { <>1__state = -2; <stopwatch>5__2 = null; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; <stopwatch>5__2 = null; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <GetServerStatus>d__3 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskVoidMethodBuilder <>t__builder; public EverestPlugin <>4__this; private Awaiter<ServerStatusResponse> <>u__1; private void MoveNext() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; EverestPlugin everestPlugin = <>4__this; try { Awaiter<ServerStatusResponse> val; if (num != 0) { val = EverestClient.RetrieveServerStatusAsync(((BaseUnityPlugin)everestPlugin).Info.Metadata.Version.ToString()).GetAwaiter(); if (!val.IsCompleted) { num = (<>1__state = 0); <>u__1 = val; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter<ServerStatusResponse>, <GetServerStatus>d__3>(ref val, ref this); return; } } else { val = <>u__1; <>u__1 = default(Awaiter<ServerStatusResponse>); num = (<>1__state = -1); } ServerStatusResponse result = val.GetResult(); LogInfo("Everest Server Status: " + (result?.status ?? "offline")); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Everest Server Status: " + (result?.status ?? "offline")); if (!string.IsNullOrEmpty(result?.messageOfTheDay)) { LogInfo("Message of the Day: " + result.messageOfTheDay); stringBuilder.AppendLine(result.messageOfTheDay); } if (!string.IsNullOrEmpty(result?.updateInfo)) { LogInfo("Update available: " + result.updateInfo); stringBuilder.AppendLine(result.updateInfo); } Color color = ((!(result.status == "online")) ? Color.red : (string.IsNullOrEmpty(result.updateInfo) ? Color.green : Color.yellow)); ToastController.Instance.Toast(stringBuilder.ToString(), color, 7f, 3f); } catch (Exception exception) { <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } public static EverestPlugin Instance; [AsyncStateMachine(typeof(<Awake>d__1))] private UniTask Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) <Awake>d__1 <Awake>d__ = default(<Awake>d__1); <Awake>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); <Awake>d__.<>4__this = this; <Awake>d__.<>1__state = -1; ((AsyncUniTaskMethodBuilder)(ref <Awake>d__.<>t__builder)).Start<<Awake>d__1>(ref <Awake>d__); return ((AsyncUniTaskMethodBuilder)(ref <Awake>d__.<>t__builder)).Task; } private void OnActiveSceneChanged(Scene oldScene, Scene newScene) { //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_0060: 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) if (((Scene)(ref newScene)).name.ToLower() == "airport") { UniTaskVoid serverStatus = GetServerStatus(); ((UniTaskVoid)(ref serverStatus)).Forget(); } if (((Scene)(ref newScene)).name.ToLower().StartsWith("level_") || ((Scene)(ref newScene)).name == "WilIsland") { LogInfo("Game scene loaded. Spawning Skeleton Manager..."); new GameObject("Skeleton Manager").AddComponent<SkeletonManager>(); if (ConfigHandler.ShowSkeletonNametags) { LogInfo("Spawning Skeleton UI Controller..."); new GameObject("Skeleton UI Controller").AddComponent<SkeletonUIController>(); } } } [AsyncStateMachine(typeof(<GetServerStatus>d__3))] private UniTaskVoid GetServerStatus() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) <GetServerStatus>d__3 <GetServerStatus>d__ = default(<GetServerStatus>d__3); <GetServerStatus>d__.<>t__builder = AsyncUniTaskVoidMethodBuilder.Create(); <GetServerStatus>d__.<>4__this = this; <GetServerStatus>d__.<>1__state = -1; ((AsyncUniTaskVoidMethodBuilder)(ref <GetServerStatus>d__.<>t__builder)).Start<<GetServerStatus>d__3>(ref <GetServerStatus>d__); return ((AsyncUniTaskVoidMethodBuilder)(ref <GetServerStatus>d__.<>t__builder)).Task; } internal static void LogDebug(string message) { Instance.Log(message, (LogLevel)32); } internal static void LogInfo(string message) { Instance.Log(message, (LogLevel)16); } internal static void LogWarning(string message) { Instance.Log(message, (LogLevel)4); } internal static void LogError(string message) { Instance.Log(message, (LogLevel)2); } internal static void LogError(Exception ex) { Instance.Log(ex.Message + "\n" + ex.StackTrace, (LogLevel)2); } private void Log(string message, LogLevel logLevel) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.Log(logLevel, (object)message); } } } namespace Everest.Utilities { public class FontUtility { [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <GetFont>d__1 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder<TMP_FontAsset> <>t__builder; private Awaiter <>u__1; private void MoveNext() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TMP_FontAsset font; try { Awaiter val; if (num == 0) { val = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_00be; } if (!Object.op_Implicit((Object)(object)_font)) { goto IL_00c5; } font = _font; goto end_IL_0007; IL_00be: ((Awaiter)(ref val)).GetResult(); goto IL_00c5; IL_00c5: while (true) { if ((Object)(object)_font == (Object)null) { if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.heroDayText != (Object)null) { _font = ((TMP_Text)GUIManager.instance.heroDayText).font; continue; } UniTask val2 = UniTask.Delay(100, false, (PlayerLoopTiming)8, default(CancellationToken), false); val = ((UniTask)(ref val2)).GetAwaiter(); if (!((Awaiter)(ref val)).IsCompleted) { num = (<>1__state = 0); <>u__1 = val; <>t__builder.AwaitUnsafeOnCompleted<Awaiter, <GetFont>d__1>(ref val, ref this); return; } goto IL_00be; } font = _font; break; } end_IL_0007:; } catch (Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(font); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } private static TMP_FontAsset _font; [AsyncStateMachine(typeof(<GetFont>d__1))] public static UniTask<TMP_FontAsset> GetFont() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) <GetFont>d__1 <GetFont>d__ = default(<GetFont>d__1); <GetFont>d__.<>t__builder = AsyncUniTaskMethodBuilder<TMP_FontAsset>.Create(); <GetFont>d__.<>1__state = -1; <GetFont>d__.<>t__builder.Start<<GetFont>d__1>(ref <GetFont>d__); return <GetFont>d__.<>t__builder.Task; } } internal static class NativeInterop { private const string DLL_NAME = "Everest_Native"; [DllImport("Everest_Native", CallingConvention = CallingConvention.Cdecl)] internal static extern int InitializeNativePlugin(); [DllImport("Everest_Native", CallingConvention = CallingConvention.Cdecl)] internal unsafe static extern void ExecuteCullingJob(void* data, int begin, int end); [DllImport("Everest_Native", CallingConvention = CallingConvention.Cdecl)] internal unsafe static extern void ExecuteNametagJob(void* data, int begin, int end); } internal class QuaternionConverter : JsonConverter<Quaternion> { public override Quaternion ReadJson(JsonReader reader, Type objectType, Quaternion existingValue, bool hasExistingValue, JsonSerializer serializer) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(serializer.Deserialize<Vector3>(reader)); } public override void WriteJson(JsonWriter writer, Quaternion value, JsonSerializer serializer) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) serializer.Serialize(writer, (object)((Quaternion)(ref value)).eulerAngles); } } public enum SkeletonBodypart { Hip, Hip_L, Leg_L, Knee_L, Foot_L, Hip_R, Leg_R, Knee_R, Foot_R, Mid, Torso, Head, Arm_L, Elbow_L, Hand_L, Arm_R, Elbow_R, Hand_R } public class SkeletonTransformHelper { private static readonly Vector3 _scoutLocalPosition = Vector3.zero; private static readonly Quaternion _scoutLocalRotation = Quaternion.Euler(0f, -1.707547E-06f, 0f); private static readonly Vector3 _scoutLocalScale = Vector3.one * 0.3307868f; private static readonly Vector3 _armatureLocalPosition = Vector3.zero; private static readonly Quaternion _armatureLocalRotation = Quaternion.Euler(-90f, 0f, 0f); private static Matrix4x4 scoutMatrix = Matrix4x4.TRS(_scoutLocalPosition, _scoutLocalRotation, _scoutLocalScale); private static Matrix4x4 armatureMatrix = Matrix4x4.TRS(_armatureLocalPosition, _armatureLocalRotation, Vector3.one); private static Matrix4x4 childMatrix = scoutMatrix * armatureMatrix; public static Vector3 GetHipWorldPosition(Vector3 parentWorldPosition, Vector3 parentWorldRotation, Vector3 hipLocalPosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) Matrix4x4 val = Matrix4x4.TRS(parentWorldPosition, Quaternion.Euler(parentWorldRotation), Vector3.one) * childMatrix; return ((Matrix4x4)(ref val)).MultiplyPoint3x4(hipLocalPosition); } } public class Vector3Converter : JsonConverter<Vector3> { public override bool CanRead => true; public override bool CanWrite => true; public override Vector3 ReadJson(JsonReader reader, Type objectType, Vector3 existingValue, bool hasExistingValue, JsonSerializer serializer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_00ac: 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) if ((int)reader.TokenType != 1) { throw new JsonException(); } Vector3 zero = Vector3.zero; while (reader.Read()) { if ((int)reader.TokenType == 13) { return zero; } switch (reader.Value as string) { case "x": zero.x = (float)reader.ReadAsDouble().Value; break; case "y": zero.y = (float)reader.ReadAsDouble().Value; break; case "z": zero.z = (float)reader.ReadAsDouble().Value; break; } } throw new JsonException(); } public override void WriteJson(JsonWriter writer, Vector3 value, JsonSerializer serializer) { //IL_0012: 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_0040: Unknown result type (might be due to invalid IL or missing references) writer.WriteStartObject(); writer.WritePropertyName("x"); writer.WriteValue(value.x); writer.WritePropertyName("y"); writer.WriteValue(value.y); writer.WritePropertyName("z"); writer.WriteValue(value.z); writer.WriteEndObject(); } } } namespace Everest.UI { public class SkeletonNametag : MonoBehaviour { public Skeleton TargetSkeleton; public Vector2 CurrentPosition; public float CurrentScale; private TextMeshProUGUI _text; private string _nickname; private DateTime _timestamp; private float _timeSinceLastUpdate; private StringBuilder _stringBuilder = new StringBuilder(); public CanvasGroup CanvasGroup { get; private set; } public void Initialize(string nickname, DateTime timestamp) { _nickname = nickname; _timestamp = timestamp; ((Object)((Component)this).gameObject).name = _nickname; UpdateText(); _timeSinceLastUpdate = 0f; } private void Awake() { CanvasGroup = ((Component)this).GetComponent<CanvasGroup>(); _text = ((Component)this).GetComponent<TextMeshProUGUI>(); } private void Update() { if (ConfigHandler.ShowTimeSinceDeath) { if (_timeSinceLastUpdate >= 1f) { UpdateText(); _timeSinceLastUpdate = 0f; } else { _timeSinceLastUpdate += Time.deltaTime; } } } private void UpdateText() { _stringBuilder.Clear(); _stringBuilder.AppendLine(_nickname); if (ConfigHandler.ShowTimeSinceDeath) { _stringBuilder.Append("Died " + CreateFormattedTime(_timestamp) + " ago"); } ((TMP_Text)_text).text = _stringBuilder.ToString(); } private string CreateFormattedTime(DateTime timestamp) { TimeSpan timeSpan = DateTime.UtcNow - timestamp; if (timeSpan.TotalHours >= 1.0) { return $"{(int)timeSpan.TotalHours}h {timeSpan.Minutes}m {(ConfigHandler.ShowSecondsAlways ? $"{timeSpan.Seconds}s" : string.Empty)}"; } if (timeSpan.TotalMinutes >= 1.0) { return $"{timeSpan.Minutes}m {timeSpan.Seconds}s"; } return $"{timeSpan.Seconds} seconds"; } public void Toggle(bool enable) { if (enable) { ((Behaviour)this).enabled = true; return; } ((Behaviour)this).enabled = false; CanvasGroup.alpha = 0f; } } internal class SkeletonUIController : MonoBehaviour { [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <Awake>d__12 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskVoidMethodBuilder <>t__builder; public SkeletonUIController <>4__this; private Awaiter <>u__1; private unsafe void MoveNext() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SkeletonUIController skeletonUIController = <>4__this; try { Awaiter val2; if (num != 0) { EverestPlugin.LogInfo("Initializing Skeleton UI Controller..."); skeletonUIController._playerCamera = Camera.main; skeletonUIController._playerCameraTransform = ((Component)skeletonUIController._playerCamera).transform; skeletonUIController._gpuProjectionMatrix = GL.GetGPUProjectionMatrix(skeletonUIController._playerCamera.projectionMatrix, false); UniTask val = skeletonUIController.PrepareTemplateNametag(); val2 = ((UniTask)(ref val)).GetAwaiter(); if (!((Awaiter)(ref val2)).IsCompleted) { num = (<>1__state = 0); <>u__1 = val2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <Awake>d__12>(ref val2, ref this); return; } } else { val2 = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); } ((Awaiter)(ref val2)).GetResult(); skeletonUIController._nametagPool = new ObjectPool<SkeletonNametag>((Func<SkeletonNametag>)skeletonUIController.CreateTextObject, (Action<SkeletonNametag>)delegate(SkeletonNametag obj) { obj.Toggle(enable: true); }, (Action<SkeletonNametag>)delegate(SkeletonNametag obj) { obj.Toggle(enable: false); }, (Action<SkeletonNametag>)delegate(SkeletonNametag obj) { Object.Destroy((Object)(object)obj); }, false, 5, 20); skeletonUIController._skeletonPositions = new NativeArray<float3>(ConfigHandler.MaxVisibleSkeletons, (Allocator)4, (NativeArrayOptions)0); skeletonUIController._jobResults = new NativeArray<NametagResult>(ConfigHandler.MaxVisibleSkeletons, (Allocator)4, (NativeArrayOptions)0); skeletonUIController._job = new NametagJobNative { SkeletonPositions = (float3*)NativeArrayUnsafeUtility.GetUnsafeReadOnlyPtr<float3>(skeletonUIController._skeletonPositions), Results = (NametagResult*)NativeArrayUnsafeUtility.GetUnsafePtr<NametagResult>(skeletonUIController._jobResults), ScreenWidth = Screen.width, ScreenHeight = Screen.height, MaxDistanceSquared = Mathf.Pow(ConfigHandler.MaxDistanceForVisibleNametag, 2f), MinDistanceSquared = Mathf.Pow(ConfigHandler.MinDistanceForVisibleNametag, 2f), MaxViewAngleCosine = Mathf.Cos(ConfigHandler.MaxAngleForVisibleNametag * (MathF.PI / 180f)), TextVerticalOffset = skeletonUIController._textVerticalOffset, MinTextScale = ConfigHandler.MinNametagSize, MaxTextScale = ConfigHandler.MaxNametagSize }; EverestPlugin.LogInfo("Skeleton UI Controller Initialized!"); } catch (Exception exception) { <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <PrepareTemplateNametag>d__19 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public SkeletonUIController <>4__this; private GameObject <templateObject>5__2; private TextMeshProUGUI <textComponent>5__3; private TextMeshProUGUI <>7__wrap3; private Awaiter<TMP_FontAsset> <>u__1; private void MoveNext() { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SkeletonUIController skeletonUIController = <>4__this; try { Awaiter<TMP_FontAsset> val; if (num != 0) { Canvas obj = ((Component)skeletonUIController).gameObject.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; ((Component)obj).gameObject.AddComponent<CanvasScaler>(); <templateObject>5__2 = new GameObject("Template"); <templateObject>5__2.transform.SetParent(((Component)skeletonUIController).transform, false); <textComponent>5__3 = <templateObject>5__2.AddComponent<TextMeshProUGUI>(); ((TMP_Text)<textComponent>5__3).fontSize = 24f; ((TMP_Text)<textComponent>5__3).alignment = (TextAlignmentOptions)514; ((Graphic)<textComponent>5__3).color = ConfigHandler.NametagColor; ((TMP_Text)<textComponent>5__3).textWrappingMode = (TextWrappingModes)0; <>7__wrap3 = <textComponent>5__3; val = FontUtility.GetFont().GetAwaiter(); if (!val.IsCompleted) { num = (<>1__state = 0); <>u__1 = val; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter<TMP_FontAsset>, <PrepareTemplateNametag>d__19>(ref val, ref this); return; } } else { val = <>u__1; <>u__1 = default(Awaiter<TMP_FontAsset>); num = (<>1__state = -1); } TMP_FontAsset result = val.GetResult(); ((TMP_Text)<>7__wrap3).font = result; <>7__wrap3 = null; ((TMP_Text)<textComponent>5__3).outlineColor = Color32.op_Implicit(ConfigHandler.NametagOutlineColor); ((TMP_Text)<textComponent>5__3).outlineWidth = ConfigHandler.NametagOutlineWidth; <templateObject>5__2.AddComponent<CanvasGroup>(); RectTransform component = <templateObject>5__2.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.zero; component.pivot = new Vector2(0.5f, 0f); component.sizeDelta = new Vector2(200f, 100f); skeletonUIController._nametagTemplate = <templateObject>5__2.AddComponent<SkeletonNametag>(); skeletonUIController._nametagTemplate.Toggle(enable: false); } catch (Exception exception) { <>1__state = -2; <templateObject>5__2 = null; <textComponent>5__3 = null; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; <templateObject>5__2 = null; <textComponent>5__3 = null; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } private Camera _playerCamera; private Transform _playerCameraTransform; private Vector3 _positionLastFrame; private Quaternion _rotationLastFrame; private Matrix4x4 _gpuProjectionMatrix; private float _textVerticalOffset = 0.6f; private SkeletonNametag _nametagTemplate; private ObjectPool<SkeletonNametag> _nametagPool; private List<SkeletonNametag> _activeNametags = new List<SkeletonNametag>(); private NativeArray<float3> _skeletonPositions; private NativeArray<NametagResult> _jobResults; private NametagJobNative _job; [AsyncStateMachine(typeof(<Awake>d__12))] private UniTaskVoid Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) <Awake>d__12 <Awake>d__ = default(<Awake>d__12); <Awake>d__.<>t__builder = AsyncUniTaskVoidMethodBuilder.Create(); <Awake>d__.<>4__this = this; <Awake>d__.<>1__state = -1; ((AsyncUniTaskVoidMethodBuilder)(ref <Awake>d__.<>t__builder)).Start<<Awake>d__12>(ref <Awake>d__); return ((AsyncUniTaskVoidMethodBuilder)(ref <Awake>d__.<>t__builder)).Task; } private void Start() { Skeleton.OnSkeletonSpawned += OnSkeletonSpawned; Skeleton.OnSkeletonDespawned += OnSkeletonDespawned; } private void OnDestroy() { Skeleton.OnSkeletonSpawned -= OnSkeletonSpawned; Skeleton.OnSkeletonDespawned -= OnSkeletonDespawned; _skeletonPositions.Dispose(); _jobResults.Dispose(); } private unsafe void LateUpdate() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); Quaternion val2 = default(Quaternion); _playerCameraTransform.GetPositionAndRotation(ref val, ref val2); if (val == _positionLastFrame && val2 == _rotationLastFrame) { return; } _positionLastFrame = val; _rotationLastFrame = val2; int count = Skeleton.Count; if (count == 0) { return; } Matrix4x4 viewProjectionMatrix = _gpuProjectionMatrix * _playerCamera.worldToCameraMatrix; _job.ViewProjectionMatrix = viewProjectionMatrix; _job.CameraPosition = float3.op_Implicit(val); _job.CameraForward = float3.op_Implicit(val2 * Vector3.forward); NativeInterop.ExecuteNametagJob(UnsafeUtility.AddressOf<NametagJobNative>(ref _job), 0, count); NametagResult* unsafePtr = (NametagResult*)NativeArrayUnsafeUtility.GetUnsafePtr<NametagResult>(_jobResults); Vector2 val3 = default(Vector2); for (int i = 0; i < count; i++) { NametagResult nametagResult = unsafePtr[i]; if (nametagResult.IsVisible == 0) { continue; } Skeleton skeleton = Skeleton.AllActiveSkeletons[i]; skeleton.LastRenderedFrame = Time.frameCount; if ((Object)(object)skeleton.ActiveNametag == (Object)null) { skeleton.ActiveNametag = _nametagPool.Get(); skeleton.ActiveNametag.Initialize(skeleton.Nickname, skeleton.Timestamp); skeleton.ActiveNametag.TargetSkeleton = skeleton; _activeNametags.Add(skeleton.ActiveNametag); } skeleton.ActiveNametag.CanvasGroup.alpha = nametagResult.Alpha; if (!(nametagResult.Alpha <= 0.01f)) { ((Vector2)(ref val3))..ctor(nametagResult.ScreenX, nametagResult.ScreenY); Vector2 val4 = skeleton.ActiveNametag.CurrentPosition - val3; if (((Vector2)(ref val4)).sqrMagnitude > 0.01f) { skeleton.ActiveNametag.CurrentPosition = val3; ((Component)skeleton.ActiveNametag).transform.position = Vector2.op_Implicit(val3); } if (Mathf.Abs(skeleton.ActiveNametag.CurrentScale - nametagResult.Scale) > 0.01f) { skeleton.ActiveNametag.CurrentScale = nametagResult.Scale; ((Component)skeleton.ActiveNametag).transform.localScale = Vector3.one * nametagResult.Scale; } } } CleanupPool(); } private void OnSkeletonSpawned(Skeleton newSkeleton) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) _skeletonPositions[newSkeleton.ArrayIndex] = float3.op_Implicit(newSkeleton.HeadBonePosition); } private void OnSkeletonDespawned(Skeleton oldSkeleton) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) int count = Skeleton.Count; _skeletonPositions[oldSkeleton.ArrayIndex] = _skeletonPositions[count]; } private void CleanupPool() { for (int num = _activeNametags.Count - 1; num >= 0; num--) { SkeletonNametag skeletonNametag = _activeNametags[num]; if ((Object)(object)skeletonNametag.TargetSkeleton == (Object)null || skeletonNametag.TargetSkeleton.LastRenderedFrame != Time.frameCount) { if ((Object)(object)skeletonNametag.TargetSkeleton != (Object)null) { skeletonNametag.TargetSkeleton.ActiveNametag = null; } _nametagPool.Release(skeletonNametag); int index = _activeNametags.Count - 1; _activeNametags[num] = _activeNametags[index]; _activeNametags.RemoveAt(index); } } } [AsyncStateMachine(typeof(<PrepareTemplateNametag>d__19))] private UniTask PrepareTemplateNametag() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) <PrepareTemplateNametag>d__19 <PrepareTemplateNametag>d__ = default(<PrepareTemplateNametag>d__19); <PrepareTemplateNametag>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); <PrepareTemplateNametag>d__.<>4__this = this; <PrepareTemplateNametag>d__.<>1__state = -1; ((AsyncUniTaskMethodBuilder)(ref <PrepareTemplateNametag>d__.<>t__builder)).Start<<PrepareTemplateNametag>d__19>(ref <PrepareTemplateNametag>d__); return ((AsyncUniTaskMethodBuilder)(ref <PrepareTemplateNametag>d__.<>t__builder)).Task; } private SkeletonNametag CreateTextObject() { SkeletonNametag skeletonNametag = Object.Instantiate<SkeletonNametag>(_nametagTemplate, ((Component)this).transform); skeletonNametag.Toggle(enable: true); return skeletonNametag; } } public class ToastController : MonoBehaviour { [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <ClearToast>d__6 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public ToastController <>4__this; public float duration; public CancellationToken cancellationToken; public float fadeTime; private float <timeElapsed>5__2; private Awaiter <>u__1; private void MoveNext() { //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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ToastController toastController = <>4__this; try { Awaiter val; if (num == 0) { val = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_0097; } if (num == 1) { val = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_015c; } UniTask val2; if (!((Object)(object)toastController.textMesh == (Object)null)) { val2 = UniTask.Delay((int)(duration * 1000f), false, (PlayerLoopTiming)8, cancellationToken, false); val = ((UniTask)(ref val2)).GetAwaiter(); if (!((Awaiter)(ref val)).IsCompleted) { num = (<>1__state = 0); <>u__1 = val; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <ClearToast>d__6>(ref val, ref this); return; } goto IL_0097; } goto end_IL_000e; IL_0163: if (<timeElapsed>5__2 < fadeTime) { <timeElapsed>5__2 += Time.deltaTime; float num2 = Mathf.Clamp01(<timeElapsed>5__2 / fadeTime); ((TMP_Text)toastController.textMesh).alpha = Mathf.Lerp(1f, 0f, num2); val2 = UniTask.NextFrame(cancellationToken, false); val = ((UniTask)(ref val2)).GetAwaiter(); if (!((Awaiter)(ref val)).IsCompleted) { num = (<>1__state = 1); <>u__1 = val; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <ClearToast>d__6>(ref val, ref this); return; } goto IL_015c; } goto end_IL_000e; IL_0097: ((Awaiter)(ref val)).GetResult(); if (!cancellationToken.IsCancellationRequested) { <timeElapsed>5__2 = 0f; goto IL_0163; } goto end_IL_000e; IL_015c: ((Awaiter)(ref val)).GetResult(); goto IL_0163; end_IL_000e:; } catch (Exception exception) { <>1__state = -2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <FindFontEventually>d__7 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskVoidMethodBuilder <>t__builder; public ToastController <>4__this; private TextMeshProUGUI <>7__wrap1; private Awaiter<TMP_FontAsset> <>u__1; private void MoveNext() { //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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ToastController toastController = <>4__this; try { Awaiter<TMP_FontAsset> val; if (num != 0) { <>7__wrap1 = toastController.textMesh; val = FontUtility.GetFont().GetAwaiter(); if (!val.IsCompleted) { num = (<>1__state = 0); <>u__1 = val; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter<TMP_FontAsset>, <FindFontEventually>d__7>(ref val, ref this); return; } } else { val = <>u__1; <>u__1 = default(Awaiter<TMP_FontAsset>); num = (<>1__state = -1); } TMP_FontAsset result = val.GetResult(); ((TMP_Text)<>7__wrap1).font = result; <>7__wrap1 = null; } catch (Exception exception) { <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } public static ToastController Instance; private TextMeshProUGUI textMesh; private CancellationTokenSource cancellationTokenSource; private void Awake() { Instance = this; Object.DontDestroyOnLoad((Object)(object)this); } private void Start() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0077: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) EverestPlugin.LogInfo("Initializing Toast Controller..."); Canvas val = new GameObject("canvas").AddComponent<Canvas>(); ((Component)val).transform.SetParent(((Component)this).transform); val.renderMode = (RenderMode)0; val.sortingOrder = 32767; ((Component)val).gameObject.AddComponent<CanvasScaler>(); GameObject val2 = new GameObject("text"); val2.transform.SetParent(((Component)val).transform, false); RectTransform obj = val2.AddComponent<RectTransform>(); obj.sizeDelta = new Vector2(1000f, 100f); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(0f, 1f); obj.pivot = new Vector2(0f, 1f); obj.anchoredPosition = new Vector2(5f, -20f); textMesh = val2.AddComponent<TextMeshProUGUI>(); ((TMP_Text)textMesh).fontSize = 26f; ((TMP_Text)textMesh).fontSizeMin = 26f; ((TMP_Text)textMesh).fontSizeMax = 26f; EverestPlugin.LogInfo("Toast Controller Initialized!"); UniTaskVoid val3 = FindFontEventually(); ((UniTaskVoid)(ref val3)).Forget(); } public void Toast(string text, Color color, float duration = 2f, float fadeTime = 1f) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) cancellationTokenSource?.Cancel(); cancellationTokenSource?.Dispose(); if (!((Object)(object)textMesh == (Object)null)) { ((TMP_Text)textMesh).text = text; ((Graphic)textMesh).color = color; ((TMP_Text)textMesh).alpha = 1f; cancellationTokenSource = new CancellationTokenSource(); UniTaskExtensions.Forget(ClearToast(duration, fadeTime, cancellationTokenSource.Token)); } } [AsyncStateMachine(typeof(<ClearToast>d__6))] private UniTask ClearToast(float duration, float fadeTime = 1f, CancellationToken cancellationToken = default(CancellationToken)) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) <ClearToast>d__6 <ClearToast>d__ = default(<ClearToast>d__6); <ClearToast>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); <ClearToast>d__.<>4__this = this; <ClearToast>d__.duration = duration; <ClearToast>d__.fadeTime = fadeTime; <ClearToast>d__.cancellationToken = cancellationToken; <ClearToast>d__.<>1__state = -1; ((AsyncUniTaskMethodBuilder)(ref <ClearToast>d__.<>t__builder)).Start<<ClearToast>d__6>(ref <ClearToast>d__); return ((AsyncUniTaskMethodBuilder)(ref <ClearToast>d__.<>t__builder)).Task; } [AsyncStateMachine(typeof(<FindFontEventually>d__7))] private UniTaskVoid FindFontEventually() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) <FindFontEventually>d__7 <FindFontEventually>d__ = default(<FindFontEventually>d__7); <FindFontEventually>d__.<>t__builder = AsyncUniTaskVoidMethodBuilder.Create(); <FindFontEventually>d__.<>4__this = this; <FindFontEventually>d__.<>1__state = -1; ((AsyncUniTaskVoidMethodBuilder)(ref <FindFontEventually>d__.<>t__builder)).Start<<FindFontEventually>d__7>(ref <FindFontEventually>d__); return ((AsyncUniTaskVoidMethodBuilder)(ref <FindFontEventually>d__.<>t__builder)).Task; } } } namespace Everest.Patches { [HarmonyPatch(typeof(Character), "RPCA_Die")] public class CharacterDeathPatch { private static void Prefix(Character __instance) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance != (Object)(object)Character.localCharacter)) { EverestPlugin.LogInfo("Whoops, you died!"); string steamId = GetSteamId(); string authTicket = GetAuthTicket(); int mapId = GetMapId(); int mapSegment = GetMapSegment(); bool isNearCampfire = CheckForCampfire(__instance); bool isNearCrashSite = CheckForBingBong(__instance); Vector3 position = ((Component)__instance).transform.position; Quaternion rotation = ((Component)__instance).transform.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; (Vector3[] localPositions, Vector3[] localRotations) tuple = GenerateLocalTransformData(__instance); Vector3[] item = tuple.localPositions; Vector3[] item2 = tuple.localRotations; UniTaskVoid val = EverestClient.SubmitDeathAsync(new SubmissionRequest { SteamId = steamId, AuthSessionTicket = authTicket, MapId = mapId, MapSegment = mapSegment, IsNearCampfire = isNearCampfire, IsNearCrashSite = isNearCrashSite, GlobalPosition = position, GlobalRotation = eulerAngles, BoneLocalPositions = item, BoneLocalRotations = item2 }); ((UniTaskVoid)(ref val)).Forget(); } } private static string GetSteamId() { //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) return ((object)SteamUser.GetSteamID()/*cast due to .constrained prefix*/).ToString(); } private static int GetMapId() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) return GameHandler.GetService<NextLevelService>().Data.Value.CurrentLevelIndex; } private static int GetMapSegment() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected I4, but got Unknown return (int)Singleton<MapHandler>.Instance.GetCurrentSegment(); } private static string GetAuthTicket() { return SteamAuthTicketService.GetSteamAuthTicket().Item1; } private static bool CheckForCampfire(Character character) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) foreach (Campfire item in from x in Object.FindObjectsByType<Campfire>((FindObjectsSortMode)0) where (int)x.advanceToSegment > 0 select x) { if (Vector3.Distance(character.Center, ((Component)item).transform.position) < item.moraleBoostRadius) { return true; } } return false; } private static bool CheckForBingBong(Character character) { //IL_003b: 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) SingleItemSpawner val = (from SingleItemSpawner in Object.FindObjectsByType<SingleItemSpawner>((FindObjectsSortMode)0) where ((Object)SingleItemSpawner.prefab).name == "BingBong" select SingleItemSpawner).FirstOrDefault(); if (!Object.op_Implicit((Object)(object)val)) { return false; } return Vector3.Distance(character.Center, ((Component)val).transform.position) < 50f; } private static (Vector3[] localPositions, Vector3[] localRotations) GenerateLocalTransformData(Character character) { if ((Object)(object)character == (Object)null) { return (localPositions: null, localRotations: null); } List<Transform> source = (from x in ((Component)((Component)character).transform).GetComponentsInChildren<Transform>() where Enum.GetNames(typeof(SkeletonBodypart)).Contains(((Object)x).name) select x).ToList(); Vector3[] item = source.Select((Transform bone) => bone.localPosition).ToArray(); Vector3[] item2 = source.Select(delegate(Transform bone) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) Quaternion localRotation = bone.localRotation; return ((Quaternion)(ref localRotation)).eulerAngles; }).ToArray(); return (localPositions: item, localRotations: item2); } } } namespace Everest.Jobs { public struct CullingJobNative { public float3 CameraPosition; public float SquaredDrawDistance; public unsafe float* SkeletonPositionsX; public unsafe float* SkeletonPositionsY; public unsafe float* SkeletonPositionsZ; public unsafe DistanceCullingResult* Results; } public static class CullingJobProducer { private delegate void ExecuteJobFunction(ref CullingJobNative data, IntPtr additionalPtr, IntPtr bufferRangePatchData, ref JobRanges ranges, int jobIndex); public static readonly IntPtr JobReflectionData = JobsUtility.CreateJobReflectionData(typeof(CullingJobNative), (object)new ExecuteJobFunction(Execute), (object)null, (object)null); private unsafe static void Execute(ref CullingJobNative job, IntPtr additionalPtr, IntPtr bufferRangePatchData, ref JobRanges ranges, int jobIndex) { int begin = default(int); int end = default(int); while (JobsUtility.GetWorkStealingRange(ref ranges, jobIndex, ref begin, ref end)) { NativeInterop.ExecuteCullingJob(UnsafeUtility.AddressOf<CullingJobNative>(ref job), begin, end); } } } public struct DistanceCullingResult : IComparable<DistanceCullingResult> { public int index; public float distance; public DistanceCullingResult(int index, float distance) { this.index = index; this.distance = distance; } public int CompareTo(DistanceCullingResult other) { return distance.CompareTo(other.distance); } } public static class JobExtensions { public unsafe static JobHandle ScheduleNative(this CullingJobNative jobData, int arrayLength, int batchSize, JobHandle dependency = default(JobHandle)) { //IL_000e: 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) JobScheduleParameters val = default(JobScheduleParameters); ((JobScheduleParameters)(ref val))..ctor(UnsafeUtility.AddressOf<CullingJobNative>(ref jobData), CullingJobProducer.JobReflectionData, dependency, (ScheduleMode)1); return JobsUtility.ScheduleParallelFor(ref val, arrayLength, batchSize); } } public struct NametagJobNative { public unsafe float3* SkeletonPositions; public unsafe NametagResult* Results; public Matrix4x4 ViewProjectionMatrix; public float3 CameraPosition; public float3 CameraForward; public float ScreenWidth; public float ScreenHeight; public float MaxDistanceSquared; public float MinDistanceSquared; public float MaxViewAngleCosine; public float TextVerticalOffset; public float MinTextScale; public float MaxTextScale; } public struct NametagResult { public float ScreenX; public float ScreenY; public float Alpha; public float Scale; public int IsVisible; } } namespace Everest.Core { public static class ConfigHandler { private static ConfigFile config; private static ConfigEntry<bool> enabled; private static ConfigEntry<int> maxSkeletons; private static ConfigEntry<bool> allowUploads; private static ConfigEntry<bool> hideFloaters; private static ConfigEntry<bool> excludeNearCrashSite; private static ConfigEntry<bool> excludeNearCampfires; private static ConfigEntry<bool> showToasts; private static ConfigEntry<int> skeletonDrawDistance; private static ConfigEntry<float> cullingUpdateFrequency; private static ConfigEntry<int> maxVisibleSkeletons; private static ConfigEntry<float> cullingDistanceThreshold; private static ConfigEntry<bool> showSkeletonNametags; private static ConfigEntry<bool> showTimeSinceDeath; private static ConfigEntry<bool> showSecondsAlways; private static ConfigEntry<float> maxDistanceForVisibleNametag; private static ConfigEntry<float> minDistanceForVisibleNametag; private static ConfigEntry<float> maxAngleForVisibleNametag; private static ConfigEntry<float> maxNametagSize; private static ConfigEntry<float> minNametagSize; private static ConfigEntry<Color> nametagColor; private static ConfigEntry<float> nametagOutlineWidth; private static ConfigEntry<Color> nametagOutlineColor; public static bool Enabled => enabled.Value; public static int MaxSkeletons => maxSkeletons.Value; public static bool AllowUploads => allowUploads.Value; public static bool HideFloaters => hideFloaters.Value; public static bool ExcludeNearCrashSite => excludeNearCrashSite.Value; public static bool ExcludeNearCampfires => excludeNearCampfires.Value; public static bool ShowToasts => showToasts.Value; public static int SkeletonDrawDistance => skeletonDrawDistance.Value; public static float CullingUpdateFrequency => cullingUpdateFrequency.Value; public static int MaxVisibleSkeletons => maxVisibleSkeletons.Value; public static float CullingDistanceThreshold => cullingDistanceThreshold.Value; public static bool ShowSkeletonNametags => showSkeletonNametags.Value; public static bool ShowTimeSinceDeath => showTimeSinceDeath.Value; public static bool ShowSecondsAlways => showSecondsAlways.Value; public static float MaxDistanceForVisibleNametag => maxDistanceForVisibleNametag.Value; public static float MinDistanceForVisibleNametag => minDistanceForVisibleNametag.Value; public static float MaxAngleForVisibleNametag => maxAngleForVisibleNametag.Value; public static float MaxNametagSize => maxNametagSize.Value; public static float MinNametagSize => minNametagSize.Value; public static Color NametagColor => nametagColor.Value; public static float NametagOutlineWidth => nametagOutlineWidth.Value; public static Color NametagOutlineColor => nametagOutlineColor.Value; public static void Initialize() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) config = new ConfigFile(Path.Combine(Paths.ConfigPath, "Everest.cfg"), true); enabled = config.Bind<bool>("General", "Enabled", true, "Enable or disable the Everest plugin."); maxSkeletons = config.Bind<int>("General", "MaxSkeletons", 100, "Number of skeletons to spawn."); allowUploads = config.Bind<bool>("General", "AllowUploads", true, "Allow uploading your own skeletons."); hideFloaters = config.Bind<bool>("General", "HideFloaters", true, "Attempt to hide skeletons that are floating in the air without a valid ground position."); excludeNearCrashSite = config.Bind<bool>("General", "ExcludeNearCrashSite", false, "Exclude skeletons that are near the crash site."); excludeNearCampfires = config.Bind<bool>("General", "ExcludeNearCampfires", false, "Exclude skeletons that are near campfires."); skeletonDrawDistance = config.Bind<int>("Performance", "SkeletonDrawDistance", 150, "Maximum distance (in units) at which skeletons are drawn."); cullingUpdateFrequency = config.Bind<float>("Performance", "CullingUpdateFrequency", 1f, "Frequency (in seconds) at which the culling system updates. Lower values may improve responsiveness decrease performance."); maxVisibleSkeletons = config.Bind<int>("Performance", "MaxVisibleSkeletons", 100, "Maximum number of skeletons that can be visible at once."); cullingDistanceThreshold = config.Bind<float>("Performance", "CullingDistanceThreshold", 1f, "Minimum distance to move between culling updates. Lower values may improve responsiveness decrease performance."); showToasts = config.Bind<bool>("UI", "ShowToasts", true, "Enable or disable toast notifications in the UI."); showSkeletonNametags = config.Bind<bool>("UI", "ShowSkeletonNametags", true, "Enable or disable skeleton nametags."); showTimeSinceDeath = config.Bind<bool>("UI", "ShowTimeSinceDeath", true, "Enable or disable showing the time since death in skeleton nametags."); showSecondsAlways = config.Bind<bool>("UI", "ShowSecondsAlways", false, "Always show seconds in the time since death, even for recent deaths."); maxDistanceForVisibleNametag = config.Bind<float>("UI", "MaxDistanceForVisibleNametag", 8f, "Maximum distance at which skeleton nametags are visible."); minDistanceForVisibleNametag = config.Bind<float>("UI", "MinDistanceForVisibleNametag", 3f, "Minimum distance at which skeleton nametags are visible."); maxAngleForVisibleNametag = config.Bind<float>("UI", "MaxAngleForVisibleNametag", 25f, "Maximum angle (in degrees) from the camera at which skeleton nametags are visible."); maxNametagSize = config.Bind<float>("UI", "MaxNametagSize", 2.5f, "Maximum size of skeleton nametags."); minNametagSize = config.Bind<float>("UI", "MinNametagSize", 1.2f, "Minimum size of skeleton nametags."); nametagColor = config.Bind<Color>("UI", "NametagColor", Color.white, "Color of skeleton nametags."); nametagOutlineWidth = config.Bind<float>("UI", "NametagOutlineWidth", 0.05f, "Width of the outline around skeleton nametags."); nametagOutlineColor = config.Bind<Color>("UI", "NametagOutlineColor", Color.black, "Color of the outline around skeleton nametags."); EverestPlugin.LogInfo("Configuration loaded successfully."); EverestPlugin.LogInfo($"Enabled: {Enabled}"); if (Enabled) { EverestPlugin.LogInfo($"Max Skeletons: {MaxSkeletons}"); EverestPlugin.LogInfo($"Allow Uploads: {AllowUploads}"); EverestPlugin.LogInfo($"Hide Floaters: {HideFloaters}"); EverestPlugin.LogInfo($"Exclude Near Crash Site: {ExcludeNearCrashSite}"); EverestPlugin.LogInfo($"Exclude Near Campfires: {ExcludeNearCampfires}"); EverestPlugin.LogInfo($"Skeleton Draw Distance: {SkeletonDrawDistance}"); EverestPlugin.LogInfo($"Culling Update Frequency: {CullingUpdateFrequency} seconds"); EverestPlugin.LogInfo($"Max Visible Skeletons: {MaxVisibleSkeletons}"); EverestPlugin.LogInfo($"Culling Distance Threshold: {CullingDistanceThreshold}"); EverestPlugin.LogInfo($"Show Toasts: {ShowToasts}"); EverestPlugin.LogInfo($"Show Skeleton Nametags: {ShowSkeletonNametags}"); if (ShowSkeletonNametags) { EverestPlugin.LogInfo($"Show Time Since Death: {ShowTimeSinceDeath}"); EverestPlugin.LogInfo($"Show Seconds Always: {ShowSecondsAlways}"); EverestPlugin.LogInfo($"Max Distance For Visible Nametag: {MaxDistanceForVisibleNametag}"); EverestPlugin.LogInfo($"Min Distance For Visible Nametag: {MinDistanceForVisibleNametag}"); EverestPlugin.LogInfo($"Max Angle For Visible Nametag: {MaxAngleForVisibleNametag}"); EverestPlugin.LogInfo($"Max Nametag Size: {MaxNametagSize}"); EverestPlugin.LogInfo($"Min Nametag Size: {MinNametagSize}"); EverestPlugin.LogInfo($"Nametag Color: {NametagColor}"); EverestPlugin.LogInfo($"Nametag Outline Width: {NametagOutlineWidth}"); EverestPlugin.LogInfo($"Nametag Outline Color: {NametagOutlineColor}"); } } } } public class Skeleton : MonoBehaviour { public static int Count; public Vector3 HeadBonePosition = Vector3.zero; public int ArrayIndex; public SkeletonNametag ActiveNametag; public int LastRenderedFrame; private List<SkeletonAccessory> _accessories = new List<SkeletonAccessory>(); public static Skeleton[] AllActiveSkeletons { get; private set; } = new Skeleton[ConfigHandler.MaxVisibleSkeletons]; public Transform HeadBone => Bones[11]; public string Nickname { get; private set; } public DateTime Timestamp { get; private set; } public Transform[] Bones { get; private set; } public static event Action<Skeleton> OnSkeletonSpawned; public static event Action<Skeleton> OnSkeletonDespawned; private void Awake() { Bones = (from x in ((Component)((Component)this).transform).GetComponentsInChildren<Transform>() where Enum.GetNames(typeof(SkeletonBodypart)).Contains(((Object)x).name) select x).ToArray(); } private void OnEnable() { ArrayIndex = Count; AllActiveSkeletons[Count] = this; Count++; } private void OnDisable() { RemoveAccessories(); Count--; int count = Count; Skeleton skeleton = AllActiveSkeletons[count]; skeleton.ArrayIndex = ArrayIndex; AllActiveSkeletons[ArrayIndex] = skeleton; Skeleton.OnSkeletonDespawned?.Invoke(this); } public void Initialize(SkeletonData data) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_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) Nickname = data.nickname; ((Object)((Component)this).gameObject).name = Nickname; Timestamp = data.timestamp; TryAddAccessory(data.steam_id); for (int i = 0; i < Bones.Length; i++) { Bones[i].SetLocalPositionAndRotation(data.bone_local_positions[i], data.bone_local_rotations[i]); } ((Component)this).transform.SetPositionAndRotation(data.global_position, Quaternion.Euler(data.global_rotation)); HeadBonePosition = HeadBone.position; Skeleton.OnSkeletonSpawned?.Invoke(this); } private void TryAddAccessory(string steamId) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(steamId) && AccessoryManager.TryGetAccessoryForSteamId(steamId, out var accessory)) { ((Component)accessory).transform.SetParent(TransformExtensions.FindChildRecursive(((Component)this).transform, accessory.bone)); ((Component)accessory).transform.SetLocalPositionAndRotation(accessory.localPosition, accessory.localRotation); ((Component)accessory).transform.localScale = Vector3.one; _accessories.Add(accessory); } } public void RemoveAccessories() { foreach (SkeletonAccessory accessory in _accessories) { if ((Object)(object)accessory != (Object)null) { Object.Destroy((Object)(object)((Component)accessory).gameObject); } } _accessories.Clear(); } } public class SkeletonManager : MonoBehaviourPun { private struct CullableSkeleton { public Skeleton Instance; public SkeletonData Data; public CullableSkeleton(SkeletonData data) { Instance = null; Data = data; } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <GetSkeletonDataAsync>d__27 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder<SkeletonData[]> <>t__builder; public SkeletonManager <>4__this; private Awaiter<SkeletonData[]> <>u__1; private void MoveNext() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SkeletonManager skeletonManager = <>4__this; SkeletonData[] result; try { Awaiter<SkeletonData[]> val; SkeletonData[] array; if (num != 0) { if (num != 1) { array = new SkeletonData[0]; if (PhotonNetwork.IsMasterClient) { val = skeletonManager.RetrieveSkeletonDatasAsHostAsync().GetAwaiter(); if (!val.IsCompleted) { num = (<>1__state = 0); <>u__1 = val; <>t__builder.AwaitUnsafeOnCompleted<Awaiter<SkeletonData[]>, <GetSkeletonDataAsync>d__27>(ref val, ref this); return; } goto IL_0081; } val = skeletonManager.RetrieveSkeletonDatasAsClientAsync().GetAwaiter(); if (!val.IsCompleted) { num = (<>1__state = 1); <>u__1 = val; <>t__builder.AwaitUnsafeOnCompleted<Awaiter<SkeletonData[]>, <GetSkeletonDataAsync>d__27>(ref val, ref this); return; } } else { val = <>u__1; <>u__1 = default(Awaiter<SkeletonData[]>); num = (<>1__state = -1); } array = val.GetResult(); goto IL_00eb; } val = <>u__1; <>u__1 = default(Awaiter<SkeletonData[]>); num = (<>1__state = -1); goto IL_0081; IL_0081: array = val.GetResult(); goto IL_00eb; IL_00eb: result = array; } catch (Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <HandleDistanceCullingAsync>d__23 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskVoidMethodBuilder <>t__builder; public SkeletonManager <>4__this; private JobHandle <sortingJobHandle>5__2; private Awaiter <>u__1; private void MoveNext() { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_007a: 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_0084: 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_0092: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SkeletonManager skeletonManager = <>4__this; try { Awaiter val; if (num == 0) { val = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_00f4; } skeletonManager._isCulling = true; Vector3 position = skeletonManager._playerCamera.position; if (!(Vector3.Distance(float3.op_Implicit(skeletonManager._cullingJob.CameraPosition), position) < ConfigHandler.CullingDistanceThreshold)) { skeletonManager._cullingJob.CameraPosition = float3.op_Implicit(position); JobHandle val2 = skeletonManager._cullingJob.ScheduleNative(skeletonManager._totalSkeletonCount, 256); <sortingJobHandle>5__2 = NativeSortExtension.SortJob<DistanceCullingResult>(skeletonManager._cullingResults).Schedule(val2); val = UnityAsyncExtensions.GetAwaiter(<sortingJobHandle>5__2); if (!((Awaiter)(ref val)).IsCompleted) { num = (<>1__state = 0); <>u__1 = val; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <HandleDistanceCullingAsync>d__23>(ref val, ref this); return; } goto IL_00f4; } skeletonManager._isCulling = false; goto end_IL_000e; IL_00f4: ((Awaiter)(ref val)).GetResult(); if (!((MonoBehaviour)skeletonManager).destroyCancellationToken.IsCancellationRequested) { ((JobHandle)(ref <sortingJobHandle>5__2)).Complete(); int num2 = 0; for (int i = 0; i < ConfigHandler.MaxVisibleSkeletons && skeletonManager._cullingResults[i].distance != float.MaxValue; i++) { skeletonManager._objectsInRange.Add(skeletonManager._cullingResults[i].index); num2++; } skeletonManager.ProcessCullingResults(); skeletonManager._objectsInRange.Clear(); skeletonManager._isCulling = false; } end_IL_000e:; } catch (Exception exception) { <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <LoadSkeletonPrefabAsync>d__25 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; private ResourceRequestAwaiter <>u__1; private void MoveNext() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) int num = <>1__state; try { ResourceRequestAwaiter val; if (num != 0) { EverestPlugin.LogInfo("Loading skeleton prefab..."); val = UnityAsyncExtensions.GetAwaiter(Resources.LoadAsync<GameObject>("Skeleton")); if (!((ResourceRequestAwaiter)(ref val)).IsCompleted) { num = (<>1__state = 0); <>u__1 = val; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ResourceRequestAwaiter, <LoadSkeletonPrefabAsync>d__25>(ref val, ref this); return; } } else { val = <>u__1; <>u__1 = default(ResourceRequestAwaiter); num = (<>1__state = -1); } Object result = ((ResourceRequestAwaiter)(ref val)).GetResult(); GameObject val2 = (GameObject)(object)((result is GameObject) ? result : null); if ((Object)(object)val2 == (Object)null) { EverestPlugin.LogError("Skeleton prefab not found in Resources."); } else { _skeletonPrefab = Object.Instantiate<GameObject>(val2).AddComponent<Skeleton>(); Object.DontDestroyOnLoad((Object)(object)_skeletonPrefab); SFX_PlayOneShot[] componentsInChildren = ((Component)_skeletonPrefab).GetComponentsInChildren<SFX_PlayOneShot>(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } ((Component)_skeletonPrefab).gameObject.SetActive(false); EverestPlugin.LogInfo($"Skeleton prefab loaded: {(Object)(object)_skeletonPrefab != (Object)null}"); } } catch (Exception exception) { <>1__state = -2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <RetrieveSkeletonDatasAsClientAsync>d__29 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder<SkeletonData[]> <>t__builder; public SkeletonManager <>4__this; private int <attempts>5__2; private Awaiter <>u__1; private Awaiter<SkeletonData[]> <>u__2; private Awaiter<ServerResponse> <>u__3; private void MoveNext() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SkeletonManager skeletonManager = <>4__this; SkeletonData[] result; try { Awaiter val3; Awaiter<SkeletonData[]> val2; Awaiter<ServerResponse> val; switch (num) { default: EverestPlugin.LogInfo("Retrieving skeleton data as client..."); <attempts>5__2 = 0; goto IL_00cf; case 0: val3 = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_00c8; case 1: val2 = <>u__2; <>u__2 = default(Awaiter<SkeletonData[]>); num = (<>1__state = -1); goto IL_015c; case 2: { val = <>u__3; <>u__3 = default(Awaiter<ServerResponse>); num = (<>1__state = -1); break; } IL_00cf: if (<attempts>5__2++ < 20) { if (!((Dictionary<object, object>)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"serverResponseIdentifier", out object value)) { UniTask val4 = UniTask.Delay(50, false, (PlayerLoopTiming)8, default(CancellationToken), false); val3 = ((UniTask)(ref val4)).GetAwaiter(); if (!((Awaiter)(ref val3)).IsCompleted) { num = (<>1__state = 0); <>u__1 = val3; <>t__builder.AwaitUnsafeOnCompleted<Awaiter, <RetrieveSkeletonDatasAsClientAsync>d__29>(ref val3, ref this); return; } goto IL_00c8; } skeletonManager._serverResponseIdentifier = value as string; } if (string.IsNullOrEmpty(skeletonManager._serverResponseIdentifier)) { EverestPlugin.LogWarning("Failed to retrieve server response identifier from host after multiple attempts."); val2 = skeletonManager.RetrieveSkeletonDatasAsHostAsync().GetAwaiter(); if (!val2.IsCompleted) { num = (<>1__state = 1); <>u__2 = val2; <>t__builder.AwaitUnsafeOnCompleted<Awaiter<SkeletonData[]>, <RetrieveSkeletonDatasAsClientAsync>d__29>(ref val2, ref this); return; } goto IL_015c; } EverestPlugin.LogInfo("Received identifier UUID from host: " + skeletonManager._serverResponseIdentifier); val = EverestClient.RetrieveAsync(skeletonManager._serverResponseIdentifier).GetAwaiter(); if (!val.IsCompleted) { num = (<>1__state = 2); <>u__3 = val; <>t__builder.AwaitUnsafeOnCompleted<Awaiter<ServerResponse>, <RetrieveSkeletonDatasAsClientAsync>d__29>(ref val, ref this); return; } break; IL_00c8: ((Awaiter)(ref val3)).GetResult(); goto IL_00cf; IL_015c: result = val2.GetResult(); goto end_IL_000e; } result = val.GetResult().data; end_IL_000e:; } catch (Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <RetrieveSkeletonDatasAsHostAsync>d__28 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder<SkeletonData[]> <>t__builder; public SkeletonManager <>4__this; private Awaiter<ServerResponse> <>u__1; private void MoveNext() { //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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SkeletonManager skeletonManager = <>4__this; SkeletonData[] result2; try { Awaiter<ServerResponse> val; if (num != 0) { EverestPlugin.LogInfo("Retrieving skeleton data as host..."); val = EverestClient.RetrieveAsync(GameHandler.GetService<NextLevelService>().Data.Value.CurrentLevelIndex).GetAwaiter(); if (!val.IsCompleted) { num = (<>1__state = 0); <>u__1 = val; <>t__builder.AwaitUnsafeOnCompleted<Awaiter<ServerResponse>, <RetrieveSkeletonDatasAsHostAsync>d__28>(ref val, ref this); return; } } else { val = <>u__1; <>u__1 = default(Awaiter<ServerResponse>); num = (<>1__state = -1); } ServerResponse result = val.GetResult(); if (result == null || result.data == null) { EverestPlugin.LogWarning("No skeleton data found for this map."); ToastController.Instance.Toast("No skeletons :(", Color.red, 5f, 3f); result2 = Array.Empty<SkeletonData>(); } else { skeletonManager.SyncServerResponseIdentifier(result.identifier); result2 = result.data; } } catch (Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(re