using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BoneLib; using BoneLib.BoneMenu; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Bonelab; using Il2CppSLZ.Marrow.Warehouse; using Il2CppTMPro; using MelonLoader; using MelonLoader.Logging; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; using WAIT; using WAIT.Customisation; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("WAIT?!")] [assembly: AssemblyDescription("You can finally know what avatar you're looking at on the BodyLog(tm)")] [assembly: AssemblyCompany("lex's stu")] [assembly: AssemblyProduct("WAIT?!")] [assembly: AssemblyCopyright("Developed by lexthedev")] [assembly: AssemblyTrademark("lex's stu")] [assembly: AssemblyFileVersion("1.6.3")] [assembly: MelonInfo(typeof(Main), "WAIT?!", "1.6.3", "lexthedev", "probably r2modman/thunderstore")] [assembly: MelonColor(255, 102, 205, 170)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("1.6.3.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WAIT { internal class Main : MelonMod { internal const string Name = "WAIT?!"; internal const string Description = "You can finally know what avatar you're looking at on the BodyLog(tm)"; internal const string Author = "lexthedev"; internal const string Company = "lex's stu"; internal const string Version = "1.6.3"; internal const string DownloadLink = "probably r2modman/thunderstore"; internal const bool Debug = false; internal static Color32 Color = new Color32((byte)102, (byte)205, (byte)170, byte.MaxValue); private static Instance logger = new Instance("WAIT!?", ColorARGB.MediumAquamarine); private static readonly bool IsDebug = false; private static TextMeshPro avatarText; private static TMP_FontAsset selectedFont; private static PullCordDevice currentBodyLog; private static Camera mainCamera; internal static bool ModEnabled = true; internal static bool IsSelectedFont(TMP_FontAsset font) { return (Object)(object)selectedFont == (Object)(object)font; } private static void DebugLog(string msg) { if (IsDebug) { logger.Msg(msg); } } private static void DebugWarn(string warn) { if (IsDebug) { logger.Warning(warn); } } private static void DebugError(string err) { if (IsDebug) { logger.Error(err); } } public override void OnLateInitializeMelon() { ((MelonBase)this).OnLateInitializeMelon(); MethodInfo method = typeof(PullCordDevice).GetMethod("SetPreviewMesh", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo method2 = typeof(Main).GetMethod("OnSetPreviewMesh", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (method != null && method2 != null) { Hooking.CreateHook(method, method2, false); DebugLog("SetPreviewMesh hook created"); } else { DebugError("couldn't locate SetPreviewMesh or its hook: avatar names won't update"); } BonemenuHandler.Initialize(); } public override void OnLateUpdate() { //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_014f: 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_0173: Unknown result type (might be due to invalid IL or missing references) ((MelonBase)this).OnLateUpdate(); if (!ModEnabled) { if ((Object)(object)avatarText != (Object)null) { ((Component)avatarText).gameObject.SetActive(false); } } else { if ((Object)(object)avatarText == (Object)null || (Object)(object)currentBodyLog == (Object)null || (Object)(object)currentBodyLog.previewPoint == (Object)null) { return; } if ((Object)(object)currentBodyLog.previewMesh == (Object)null || (Object)(object)currentBodyLog.previewMesh.sharedMesh == (Object)null) { if (((Component)avatarText).gameObject.activeSelf) { ((Component)avatarText).gameObject.SetActive(false); } return; } if (!((Component)avatarText).gameObject.activeSelf) { ((Component)avatarText).gameObject.SetActive(true); } if ((Object)(object)mainCamera == (Object)null) { mainCamera = Camera.main; if ((Object)(object)mainCamera == (Object)null) { return; } } avatarText.transform.position = currentBodyLog.previewPoint.position + Vector3.up * 0.1f; avatarText.transform.rotation = ((Component)mainCamera).transform.rotation; } } private static void OnSetPreviewMesh(PullCordDevice __instance, int crateIndex) { if (!ModEnabled || (Object)(object)__instance == (Object)null || __instance.avatarCrateRefs == null) { return; } int num = crateIndex - 1; if (num < 0 || num >= ((Il2CppArrayBase)(object)__instance.avatarCrateRefs).Length) { DebugWarn($"refIndex {num} (from crateIndex {crateIndex}) is outside avatarCrateRefs range 0-{((Il2CppArrayBase)(object)__instance.avatarCrateRefs).Length - 1}"); return; } AvatarCrateReference val = ((Il2CppArrayBase)(object)__instance.avatarCrateRefs)[num]; if (val == null) { DebugWarn($"avatarCrateRefs[{num}] is null"); return; } AvatarCrate crate = ((CrateReferenceT)(object)val).Crate; if ((Object)(object)crate == (Object)null) { DebugWarn($"avatarCrateRefs[{num}].Crate is null"); return; } string text = ((Scannable)crate).Title; if (string.IsNullOrEmpty(text)) { text = "unknown avatar"; } currentBodyLog = __instance; if ((Object)(object)avatarText == (Object)null) { CreateAvatarText(__instance); } if ((Object)(object)avatarText == (Object)null) { DebugError("failed to create avatarText"); return; } ((TMP_Text)avatarText).text = text; ((Component)avatarText).gameObject.SetActive(true); DebugLog("displaying: " + text); } private static void CreateAvatarText(PullCordDevice bodyLog) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_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_005f: 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_00d6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)bodyLog.previewPoint == (Object)null)) { GameObject val = new GameObject("WAIT?! Avatar Name"); val.transform.SetParent((Transform)null); val.transform.position = bodyLog.previewPoint.position + Vector3.up * 0.1f; val.transform.rotation = Quaternion.identity; val.transform.localScale = Vector3.one; TextMeshPro val2 = val.AddComponent(); if ((Object)(object)selectedFont != (Object)null) { ((TMP_Text)val2).font = selectedFont; } ((TMP_Text)val2).text = "WAIT?!"; ((TMP_Text)val2).fontSize = 0.1f; ((TMP_Text)val2).alignment = (TextAlignmentOptions)514; ((TMP_Text)val2).horizontalAlignment = (HorizontalAlignmentOptions)2; ((TMP_Text)val2).verticalAlignment = (VerticalAlignmentOptions)512; ((Graphic)val2).color = Color.white; ((TMP_Text)val2).enableWordWrapping = false; ((TMP_Text)val2).overflowMode = (TextOverflowModes)0; avatarText = val2; } } internal static void SetAvatarFont(TMP_FontAsset font) { if (!((Object)(object)font == (Object)null)) { selectedFont = font; if ((Object)(object)avatarText != (Object)null) { ((TMP_Text)avatarText).font = font; } } } } } namespace WAIT.Customisation { internal static class BonemenuHandler { private static FunctionElement enabled; private static Page mainPage; private static Page fontPage; private static readonly Dictionary fonts = new Dictionary(); public static void Initialize() { FindFonts(); CreateMenu(); } private static void CreateMenu() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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) mainPage = Page.Root.CreatePage("WAIT!?", Color32.op_Implicit(Main.Color), 0, true); enabled = mainPage.CreateFunction("Enabled", Color.green, (Action)delegate { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Main.ModEnabled = !Main.ModEnabled; ((Element)enabled).ElementColor = (Main.ModEnabled ? Color.green : Color.red); }); fontPage = mainPage.CreatePage("Select Font", Color.white, 0, true); CreateFontOptions(); } private static void FindFonts() { fonts.Clear(); TMP_FontAsset[] array = Il2CppArrayBase.op_Implicit(Resources.FindObjectsOfTypeAll()); TMP_FontAsset[] array2 = array; foreach (TMP_FontAsset val in array2) { if (!((Object)(object)val == (Object)null) && !((Object)val).name.Contains("LiberationSans") && !fonts.ContainsKey(((Object)val).name)) { fonts.Add(((Object)val).name, val); } } } private static void CreateFontOptions() { //IL_000b: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) fontPage.CreateFunction("Refresh Fonts", Color.white, (Action)delegate { RefreshFontOptions(); }); foreach (KeyValuePair font in fonts) { Color val = (Main.IsSelectedFont(font.Value) ? Color.cyan : Color.white); fontPage.CreateFunction(font.Key, val, (Action)delegate { Main.SetAvatarFont(font.Value); RefreshFontOptions(); }); } } private static void RefreshFontOptions() { fontPage.RemoveAll(); FindFonts(); CreateFontOptions(); } public static void SetEnabledColor() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (enabled != null) { ((Element)enabled).ElementColor = (Main.ModEnabled ? Color.green : Color.red); } } } }