Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Yang BoxInfo v1.0.0
plugins/BoxInfo.dll
Decompiled an hour ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BoxInfo")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.4.4.0")] [assembly: AssemblyInformationalVersion("2.4.4")] [assembly: AssemblyProduct("BoxInfo")] [assembly: AssemblyTitle("BoxInfo")] [assembly: AssemblyVersion("2.4.4.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 BoxInfo { internal class Notifications : MonoBehaviour { private class Note { public string Header; public string Title; public string Body; public int Rarity; public bool Progress; } private class Card { public Note Note; public RectTransform Panel; public CanvasGroup Group; public TextMeshProUGUI Header; public TextMeshProUGUI Title; public TextMeshProUGUI Body; public float ShownAt; public float HoldFor; public float Height; public float Y = float.NaN; } internal static ConfigEntry<bool> On; internal static ConfigEntry<float> Seconds; internal static ConfigEntry<float> Scale; internal static ConfigEntry<float> RightGap; internal static ConfigEntry<float> BottomGap; internal static ConfigEntry<KeyCode> TestKey; internal static ConfigEntry<bool> SoundOn; internal static ConfigEntry<float> Volume; internal static ConfigEntry<bool> GameVolume; internal static ConfigEntry<bool> ProgressOn; internal static ConfigEntry<float> ProgressSeconds; private static readonly List<Note> Waiting = new List<Note>(); private static Notifications instance; private readonly List<Card> cards = new List<Card>(); private readonly Stack<Card> spare = new Stack<Card>(); private const int MaxOnScreen = 5; private const float InTime = 0.35f; private const float OutTime = 0.6f; private const float Spacing = 8f; private GameObject root; private TMP_FontAsset font; internal static string SoundsFolder; internal static readonly string[] ClipNames = new string[7] { "cosmetic shop screen cosmetic reward common", "cosmetic shop screen cosmetic reward uncommon", "cosmetic shop screen cosmetic reward rare", "cosmetic shop screen cosmetic reward ultrarare", "tricycle glitch in01", "tricycle glitch in02", "tricycle glitch in03" }; private static readonly AudioClip[] Clips = (AudioClip[])(object)new AudioClip[ClipNames.Length]; private float lastProgressSound = -99f; private static bool soundsLoaded; private AudioSource source; internal static void Bind(ConfigFile cfg) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown On = cfg.Bind<bool>("Notifications", "Enabled", true, "Show a pop-up in the bottom right when you earn a badge or master an ability."); Seconds = cfg.Bind<float>("Notifications", "Seconds On Screen", 6f, new ConfigDescription("How long each pop-up stays (longer text stays a bit longer).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 20f), Array.Empty<object>())); Scale = cfg.Bind<float>("Notifications", "Size", 1f, new ConfigDescription("Size of the pop-up.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>())); RightGap = cfg.Bind<float>("Notifications", "Gap From Right", 143f, new ConfigDescription("Pixels from the right edge (at 1080p).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1500f), Array.Empty<object>())); BottomGap = cfg.Bind<float>("Notifications", "Gap From Bottom", 58f, new ConfigDescription("Pixels from the bottom edge (at 1080p).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 900f), Array.Empty<object>())); TestKey = cfg.Bind<KeyCode>("Notifications", "Test Key", (KeyCode)0, "Press to show a sample pop-up (to check size and position). None = off."); SoundOn = cfg.Bind<bool>("Notifications", "Play Sound", true, "Play a sound with each pop-up: the reward sound for the rarity when you unlock something, a glitch sound for progress."); Volume = cfg.Bind<float>("Notifications", "Sound Volume", 0.8f, new ConfigDescription("Volume of that sound.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); GameVolume = cfg.Bind<bool>("Notifications", "Follow Game Sound Volume", false, "On = the reward sound goes through the game's sound volume slider. Off = always plays at Sound Volume."); ProgressOn = cfg.Bind<bool>("Notifications", "Show Progress", true, "Also pop up when you get closer to a badge or an ability's mastery (\"Badge progress / Hunter / 12/25\"), with a short glitch sound."); ProgressSeconds = cfg.Bind<float>("Notifications", "Progress Seconds On Screen", 3f, new ConfigDescription("How long progress pop-ups stay.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>())); } internal static void Show(string headerText, string titleText, string bodyText, int rarity, bool progress = false) { if (!On.Value || string.IsNullOrEmpty(titleText) || (progress && !ProgressOn.Value)) { return; } Note note = new Note { Header = headerText, Title = titleText, Body = bodyText, Rarity = rarity, Progress = progress }; if (progress) { Card card = instance?.cards.Find((Card c) => c.Note.Progress && c.Note.Title == titleText); if (card != null) { instance.Refresh(card, note); return; } Note note2 = Waiting.Find((Note w) => w.Progress && w.Title == titleText); if (note2 != null) { note2.Body = bodyText; note2.Header = headerText; return; } } else { Waiting.RemoveAll((Note w) => w.Progress && w.Title == titleText); if ((Object)(object)instance != (Object)null) { foreach (Card card2 in instance.cards) { if (card2.Note.Progress && card2.Note.Title == titleText) { card2.HoldFor = 0f; } } } } if (Waiting.Count < 12) { Waiting.Add(note); } } private void Awake() { instance = this; } private void Start() { LoadSounds(); } private void Update() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) try { if ((int)TestKey.Value != 0 && Input.GetKeyDown(TestKey.Value)) { Show("Badge unlocked", "Monster Mauler", "Kill every type of monster in the game. Unlocks the 'Apex' ability.", 3); } } catch { } while (Waiting.Count > 0 && cards.Count((Card c) => !Leaving(c)) < 5) { Note n = Waiting[0]; Waiting.RemoveAt(0); try { Begin(n); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Notification failed: " + ex.Message)); } } if (cards.Count > 0) { Animate(); } } private static bool Leaving(Card c) { return Time.unscaledTime - c.ShownAt > 0.35f + c.HoldFor; } private void Build() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) root = new GameObject("BoxInfo Notifications"); Object.DontDestroyOnLoad((Object)(object)root); Canvas obj = root.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 1000; CanvasScaler obj2 = root.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.matchWidthOrHeight = 1f; } private Card NewCard() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_0190: Unknown result type (might be due to invalid IL or missing references) if (spare.Count > 0) { Card card = spare.Pop(); ((Component)card.Panel).gameObject.SetActive(true); card.Y = float.NaN; return card; } Card card2 = new Card(); GameObject val = new GameObject("Notification", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(root.transform, false); card2.Panel = (RectTransform)val.transform; RectTransform panel = card2.Panel; RectTransform panel2 = card2.Panel; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(1f, 0f); panel2.anchorMax = val2; panel.anchorMin = val2; card2.Panel.pivot = new Vector2(1f, 0f); Image obj = val.AddComponent<Image>(); ((Graphic)obj).color = new Color(0f, 0f, 0f, 0.62f); ((Graphic)obj).raycastTarget = false; card2.Group = val.AddComponent<CanvasGroup>(); card2.Group.blocksRaycasts = false; card2.Group.interactable = false; card2.Header = Text(card2.Panel, "Header", 28f, new Color(0.95f, 0.95f, 0.95f)); card2.Title = Text(card2.Panel, "Title", 52f, Color.white); ((TMP_Text)card2.Title).fontStyle = (FontStyles)16; card2.Body = Text(card2.Panel, "Body", 22f, new Color(0.9f, 0.9f, 0.9f)); return card2; } private static TextMeshProUGUI Text(RectTransform parent, string name, float size, Color color) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0035: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_008f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)parent, false); TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj).fontSize = size; ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; ((TMP_Text)obj).alignment = (TextAlignmentOptions)257; ((TMP_Text)obj).enableWordWrapping = true; ((TMP_Text)obj).overflowMode = (TextOverflowModes)0; RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0f, 1f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0f, 1f); return obj; } private void FindFont() { if ((Object)(object)font == (Object)null) { font = Ui.Font; } } private void Begin(Note n) { if ((Object)(object)root == (Object)null) { Build(); } FindFont(); Card card = NewCard(); card.Note = n; if ((Object)(object)font != (Object)null) { TextMeshProUGUI header = card.Header; TextMeshProUGUI title = card.Title; TMP_FontAsset val = (((TMP_Text)card.Body).font = font); TMP_FontAsset val3 = (((TMP_Text)title).font = val); ((TMP_Text)header).font = val3; } Layout(card); ((Transform)card.Panel).SetAsLastSibling(); cards.Insert(0, card); if (n.Progress) { PlayProgressSound(); } else { PlaySound(n.Rarity); } card.ShownAt = Time.unscaledTime; card.HoldFor = (n.Progress ? ProgressSeconds.Value : (Seconds.Value + Mathf.Clamp((float)((TMP_Text)card.Body).text.Length / 30f, 0f, 6f))); } private void Refresh(Card c, Note n) { c.Note = n; Layout(c); PlayProgressSound(); if (Time.unscaledTime - c.ShownAt > 0.35f) { c.ShownAt = Time.unscaledTime - 0.35f; } c.HoldFor = ProgressSeconds.Value; } private void Layout(Card c) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) Note note = c.Note; float value = Scale.Value; ((TMP_Text)c.Header).text = note.Header ?? ""; ((TMP_Text)c.Title).text = note.Title; ((Graphic)c.Title).color = RarityColor(note.Rarity); ((TMP_Text)c.Body).text = note.Body ?? ""; ((TMP_Text)c.Header).fontSize = 28f * value; ((TMP_Text)c.Title).fontSize = 52f * value; ((TMP_Text)c.Body).fontSize = 22f * value; float num = 10f * value; float num2 = 6f * value; float num3 = 640f * value; float num4 = Mathf.Max(((TMP_Text)c.Header).GetPreferredValues(((TMP_Text)c.Header).text).x, ((TMP_Text)c.Title).GetPreferredValues(((TMP_Text)c.Title).text).x); if (((TMP_Text)c.Body).text.Length > 0) { num4 = Mathf.Max(num4, Mathf.Min(((TMP_Text)c.Body).GetPreferredValues(((TMP_Text)c.Body).text).x, num3)); } num4 = Mathf.Ceil(num4) + 2f; float y = ((TMP_Text)c.Header).GetPreferredValues(((TMP_Text)c.Header).text, num4, 0f).y; float y2 = ((TMP_Text)c.Title).GetPreferredValues(((TMP_Text)c.Title).text, num4, 0f).y; float num5 = ((((TMP_Text)c.Body).text.Length > 0) ? ((TMP_Text)c.Body).GetPreferredValues(((TMP_Text)c.Body).text, num4, 0f).y : 0f); float num6 = 0f - num2; Place(c.Header, num, num6, num4, y); num6 -= y - 4f * value; Place(c.Title, num, num6, num4, y2); num6 -= y2; Place(c.Body, num, num6, num4, num5); num6 -= num5; c.Height = 0f - num6 + num2; c.Panel.sizeDelta = new Vector2(num4 + num * 2f, c.Height); } private static void Place(TextMeshProUGUI t, float x, float y, float w, float h) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) RectTransform val = (RectTransform)((TMP_Text)t).transform; val.anchoredPosition = new Vector2(x, y); val.sizeDelta = new Vector2(w, h); } private void Animate() { //IL_0156: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; float num = 1f - Mathf.Exp(-12f * Time.unscaledDeltaTime); float num2 = BottomGap.Value; for (int i = 0; i < cards.Count; i++) { Card card = cards[i]; float num3 = unscaledTime - card.ShownAt; if (num3 >= 0.35f + card.HoldFor + 0.6f) { ((Component)card.Panel).gameObject.SetActive(false); spare.Push(card); cards.RemoveAt(i--); continue; } float num4 = 0f; float num5 = 1f; if (num3 < 0.35f) { float num6 = 1f - Mathf.Pow(1f - num3 / 0.35f, 3f); num4 = (1f - num6) * 120f; num5 = num6; } else if (num3 > 0.35f + card.HoldFor) { num5 = 1f - (num3 - 0.35f - card.HoldFor) / 0.6f; } float num7 = num2; card.Y = (float.IsNaN(card.Y) ? num7 : Mathf.Lerp(card.Y, num7, num)); card.Panel.anchoredPosition = new Vector2(0f - RightGap.Value + num4, card.Y); card.Group.alpha = num5; num2 += (card.Height + 8f * Scale.Value) * Mathf.Clamp01(num5 * 1.5f); } } internal void LoadSounds() { if (!soundsLoaded) { soundsLoaded = true; ((MonoBehaviour)this).StartCoroutine(LoadSoundsRoutine()); } } private IEnumerator LoadSoundsRoutine() { if (string.IsNullOrEmpty(SoundsFolder) || !Directory.Exists(SoundsFolder)) { Plugin.Log.LogWarning((object)("No sounds folder at " + SoundsFolder + "; pop-ups will be silent.")); yield break; } for (int i = 0; i < ClipNames.Length; i++) { string path = null; AudioType type = (AudioType)20; (string, AudioType)[] array = new(string, AudioType)[3] { (".wav", (AudioType)20), (".ogg", (AudioType)14), (".mp3", (AudioType)13) }; for (int j = 0; j < array.Length; j++) { (string, AudioType) tuple = array[j]; string item = tuple.Item1; AudioType item2 = tuple.Item2; string text = Path.Combine(SoundsFolder, ClipNames[i] + item); if (File.Exists(text)) { path = text; type = item2; break; } } if (path == null) { Plugin.Log.LogWarning((object)("Missing sound: " + Path.Combine(SoundsFolder, ClipNames[i]) + ".wav")); continue; } AudioClip clip = null; UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip(new Uri(path).AbsoluteUri, type); try { yield return req.SendWebRequest(); if ((int)req.result == 1) { try { clip = DownloadHandlerAudioClip.GetContent(req); } catch { clip = null; } } else { Plugin.Log.LogDebug((object)("Unity couldn't decode " + path + ": " + req.error)); } } finally { ((IDisposable)req)?.Dispose(); } if (((Object)(object)clip == (Object)null || clip.length <= 0f) && (int)type == 20) { try { clip = Wav.Load(path, ClipNames[i]); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Couldn't read " + path + ": " + ex.Message)); } } if ((Object)(object)clip == (Object)null || clip.length <= 0f) { Plugin.Log.LogWarning((object)("Couldn't load " + path + ".")); continue; } ((Object)clip).name = ClipNames[i]; Clips[i] = clip; Plugin.Log.LogInfo((object)$"Reward sound '{ClipNames[i]}': {clip.length:0.00}s, {clip.channels} ch, {clip.frequency} Hz, loudness {Peak(clip):0.00}."); } } private static float Peak(AudioClip clip) { try { float[] array = new float[Mathf.Min(clip.samples * clip.channels, 2000000)]; clip.GetData(array, 0); float num = 0f; float[] array2 = array; foreach (float num2 in array2) { num = Mathf.Max(num, Mathf.Abs(num2)); } return num; } catch { return -1f; } } private void PlayProgressSound() { if (Time.unscaledTime - lastProgressSound < 0.3f) { return; } lastProgressSound = Time.unscaledTime; List<int> list = new List<int>(); for (int i = 4; i < 7; i++) { if ((Object)(object)Clips[i] != (Object)null) { list.Add(i); } } if (list.Count > 0) { PlayClip(list[Random.Range(0, list.Count)]); } } private void PlaySound(int rarity) { if (rarity >= 0 && rarity <= 3) { PlayClip(rarity); } } private void PlayClip(int index) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown if (!SoundOn.Value || index < 0 || index >= Clips.Length) { return; } try { LoadSounds(); AudioClip val = Clips[index]; if ((Object)(object)val == (Object)null) { Plugin.Log.LogDebug((object)"Reward sound not loaded (yet)."); return; } if ((Object)(object)source == (Object)null) { GameObject val2 = new GameObject("BoxInfo Audio"); Object.DontDestroyOnLoad((Object)(object)val2); source = val2.AddComponent<AudioSource>(); source.playOnAwake = false; source.spatialBlend = 0f; source.priority = 0; source.bypassEffects = true; source.bypassListenerEffects = true; source.bypassReverbZones = true; source.ignoreListenerPause = true; source.ignoreListenerVolume = false; } if (GameVolume.Value && (Object)(object)source.outputAudioMixerGroup == (Object)null) { try { AudioManager value = Traverse.Create(typeof(AudioManager)).Field("instance").GetValue<AudioManager>(); AudioMixerGroup val3 = (((Object)(object)value != (Object)null) ? Traverse.Create((object)value).Field("SoundMasterGroup").GetValue<AudioMixerGroup>() : null); if ((Object)(object)val3 != (Object)null) { source.outputAudioMixerGroup = val3; } } catch { } } else if (!GameVolume.Value) { source.outputAudioMixerGroup = null; } source.volume = 1f; source.PlayOneShot(val, Volume.Value); Plugin.Log.LogDebug((object)("Played reward sound " + ((Object)val).name + ".")); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Reward sound failed: " + ex.Message)); } } internal static Color RarityColor(int r) { //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) return (Color)(r switch { 0 => new Color(0.42f, 0.9f, 0.45f), 1 => new Color(0.36f, 0.68f, 1f), 2 => new Color(0.76f, 0.45f, 1f), 3 => new Color(1f, 0.6f, 0.08f), _ => Color.white, }); } } [BepInPlugin("salamander.BoxInfo", "BoxInfo", "2.4.4")] public class Plugin : BaseUnityPlugin { private class WallBox { public PhysGrabObject Pgo; public int View; public string Kind; public string Id; public string Title; public string Body; public int Rarity = -1; public int State = -1; public Vector3 Top; public Vector3 Center; public Vector3 TopLocal; public Vector3 LocalMin; public Vector3 LocalMax; public bool HasLocal; public bool Visible; public bool NameVisible; public float NameAlpha; public TextMeshProUGUI Label; public float LongestWord; public float NameHalfPx; public float Dist; } public const string Guid = "salamander.BoxInfo"; public const string ModName = "BoxInfo"; public const string Version = "2.4.4"; private const string WallTag = "LobbyCommands.BadgeWall"; private const byte EvHello = 165; private const byte EvAsk = 166; private const byte EvAnswer = 167; private const byte EvNotify = 168; private const byte EvToast = 169; private const byte EvPrompt = 170; private const byte EvReply = 171; private const byte EvAllAsk = 172; private const byte EvAll = 173; private const byte EvTrackAsk = 174; private const byte EvTrack = 175; private const byte EvUse = 176; internal static ManualLogSource Log; private ConfigEntry<bool> showPanel; private ConfigEntry<KeyCode> toggleKey; private ConfigEntry<KeyCode> yesKey; private ConfigEntry<KeyCode> noKey; private ConfigEntry<int> fontSize; private ConfigEntry<float> maxDistance; private ConfigEntry<float> panelWidth; private ConfigEntry<float> bottomGap; private PhysGrabObject lookedAt; private int lookedView = -1; private string title; private string body; private string status; private int rarity = -1; private float checkAt; private float askAt; private float helloAt; private bool hooked; private static MethodInfo localStatus; private static MethodInfo localInfo; private static MethodInfo takeLocal; private static MethodInfo localReply; private static MethodInfo localAll; private static MethodInfo localTrack; private static MethodInfo localUse; private string toast; private string question; private float toastUntil; private float questionUntil; private float pollAt; private static bool lcChecked; private UiCard lookCard; private UiCard questionCard; private UiCard toastCard; private ConfigEntry<KeyCode> useKey; private ConfigEntry<KeyCode> trackKey; private ConfigEntry<bool> markersOn; private ConfigEntry<bool> namesOn; private ConfigEntry<float> markerDistance; private ConfigEntry<float> markerSize; private ConfigEntry<float> trackerX; private ConfigEntry<float> trackerY; private ConfigEntry<float> nameDistance; private ConfigEntry<float> nameSize; private ConfigEntry<string> tracked; private readonly Dictionary<PhysGrabObject, WallBox> boxes = new Dictionary<PhysGrabObject, WallBox>(); private readonly Dictionary<PhysGrabObject, string> StatusCache = new Dictionary<PhysGrabObject, string>(); private WallBox lookedBox; private string lastRoom; private int lastMaster = -1; private float scanAt; private float statesAt; private float visibleAt; private float trackAt; private float trackAnswerAt = -99f; private string trackTitle; private string trackProgress; private string trackHow; private int trackRarity = -1; private Texture2D checkTex; private Texture2D starTex; private Texture2D ringTex; private int lastBoxCount = -1; private int lastStateCount = -1; private int lastVisibleCount = -1; private float markerLogAt; private int nameFrame = -1; private readonly Stack<TextMeshProUGUI> spareLabels = new Stack<TextMeshProUGUI>(); private UiCard trackCard; private void Awake() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; showPanel = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Show the info panel when looking at a badge or ability wall box."); toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Toggle Key", (KeyCode)290, "Turns the panel on/off."); yesKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Yes Key", (KeyCode)121, "Answers YES to an on-screen question (\"Would you like to equip...?\"). Typing yes in chat works too."); noKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "No Key", (KeyCode)110, "Answers NO to an on-screen question."); maxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Max Distance", 6f, new ConfigDescription("How far away a box can be (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>())); fontSize = ((BaseUnityPlugin)this).Config.Bind<int>("Look", "Font Size", 18, new ConfigDescription("Text size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 40), Array.Empty<object>())); panelWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Look", "Panel Width", 0.5f, new ConfigDescription("Width as a share of the screen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 0.95f), Array.Empty<object>())); bottomGap = ((BaseUnityPlugin)this).Config.Bind<float>("Look", "Gap From Bottom", 0.06f, new ConfigDescription("Space between the panel and the bottom of the screen, as a share of the screen height.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.6f), Array.Empty<object>())); Notifications.Bind(((BaseUnityPlugin)this).Config); Notifications.SoundsFolder = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? "", "sounds"); ((Component)this).gameObject.AddComponent<Notifications>(); BindWalls(); SceneManager.activeSceneChanged += delegate { helloAt = 0f; lookedAt = null; ClearWalls(); }; Log.LogInfo((object)string.Format("{0} {1} loaded. Look at a badge or ability wall box to see what it is ({2} toggles).", "BoxInfo", "2.4.4", toggleKey.Value)); } private void Update() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) Network(); PollLocal(); AnswerKeys(); try { WallsTick(); } catch (Exception ex) { Log.LogDebug((object)("Walls: " + ex.Message)); } try { if (Input.GetKeyDown(toggleKey.Value)) { showPanel.Value = !showPanel.Value; } } catch { } if (!showPanel.Value) { lookedAt = null; } else if (!(Time.unscaledTime < checkAt)) { checkAt = Time.unscaledTime + 0.1f; try { Look(); } catch (Exception ex2) { lookedAt = null; Log.LogDebug((object)("Look failed: " + ex2.Message)); } } } private void Network() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown try { if (!hooked && PhotonNetwork.NetworkingClient != null) { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; hooked = true; } if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { lastRoom = null; return; } Room currentRoom = PhotonNetwork.CurrentRoom; string text = ((currentRoom != null) ? currentRoom.Name : null); int num = ((PhotonNetwork.MasterClient != null) ? PhotonNetwork.MasterClient.ActorNumber : (-1)); if (text != lastRoom || num != lastMaster) { lastRoom = text; lastMaster = num; helloAt = 0f; statesAt = Time.unscaledTime + 1f; } if (Time.unscaledTime >= helloAt) { helloAt = Time.unscaledTime + 20f; PhotonNetwork.RaiseEvent((byte)165, (object)null, new RaiseEventOptions { Receivers = (ReceiverGroup)2 }, SendOptions.SendReliable); } } catch { } } private void OnEvent(EventData ev) { try { if ((ev.Code >= 167 && ev.Code <= 170) || ev.Code == 173 || ev.Code == 175) { Room currentRoom = PhotonNetwork.CurrentRoom; Player val = ((currentRoom != null) ? currentRoom.GetPlayer(ev.Sender, false) : null); if (val != null && val.IsMasterClient) { Handle(ev.Code, ev.CustomData); } } } catch { } } private void AskStatus() { //IL_00b5: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown askAt = Time.unscaledTime + 2f; try { if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { FindLobbyCommands(); if (localStatus != null && (Object)(object)lookedAt != (Object)null) { status = (localStatus.Invoke(null, new object[1] { ((Component)lookedAt).gameObject }) as string) ?? status; } if ((Object)(object)lookedAt != (Object)null && status != null) { StatusCache[lookedAt] = status; } } else { PhotonNetwork.RaiseEvent((byte)166, (object)lookedView, new RaiseEventOptions { Receivers = (ReceiverGroup)2 }, SendOptions.SendReliable); } } catch { } } private void Handle(byte code, object data) { switch (code) { case 167: if (data is object[] array3 && array3.Length >= 2 && array3[0] is int num6 && num6 == lookedView) { status = array3[1] as string; if ((Object)(object)lookedAt != (Object)null && status != null) { StatusCache[lookedAt] = status; } } break; case 173: ApplyStates(data as object[]); break; case 175: ApplyTrack(data as object[]); break; case 168: { if (!(data is object[] array2) || array2.Length < 4) { break; } string headerText = array2[0] as string; string titleText = array2[1] as string; string bodyText = array2[2] as string; int num3 = ((array2[3] is int num4) ? num4 : (-1)); bool flag = default(bool); int num5; if (array2.Length >= 5) { object obj = array2[4]; if (obj is bool) { flag = (bool)obj; num5 = 1; } else { num5 = 0; } } else { num5 = 0; } Notifications.Show(headerText, titleText, bodyText, num3, (byte)((uint)num5 & (flag ? 1u : 0u)) != 0); break; } case 169: if (data is string { Length: >0 } text) { toast = text; toastUntil = Time.unscaledTime + 3.5f + (float)text.Length * 0.03f; statesAt = Mathf.Min(statesAt, Time.unscaledTime + 0.5f); } break; case 170: if (data is object[] array && array.Length >= 2) { question = array[0] as string; float num = ((array[1] is float num2) ? num2 : 30f); questionUntil = (string.IsNullOrEmpty(question) ? 0f : (Time.unscaledTime + num)); } break; case 171: case 172: case 174: break; } } private void AnswerKeys() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b3: Expected O, but got Unknown if (string.IsNullOrEmpty(question) || Time.unscaledTime > questionUntil) { return; } bool flag = false; bool flag2 = false; try { flag = Input.GetKeyDown(yesKey.Value); flag2 = Input.GetKeyDown(noKey.Value); } catch { } if ((!flag && !flag2) || ChatOpen()) { return; } question = null; try { if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { FindLobbyCommands(); localReply?.Invoke(null, new object[1] { flag }); } else { PhotonNetwork.RaiseEvent((byte)171, (object)flag, new RaiseEventOptions { Receivers = (ReceiverGroup)2 }, SendOptions.SendReliable); } } catch { } } private static bool ChatOpen() { try { ChatManager value = Traverse.Create(typeof(ChatManager)).Field("instance").GetValue<ChatManager>(); return (Object)(object)value != (Object)null && Traverse.Create((object)value).Field("chatActive").GetValue<bool>(); } catch { return false; } } private void PollLocal() { if (Time.unscaledTime < pollAt) { return; } pollAt = Time.unscaledTime + 0.25f; try { if (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient) { return; } FindLobbyCommands(); if (takeLocal == null) { return; } for (int i = 0; i < 10; i++) { if (!(takeLocal.Invoke(null, null) is object[] array)) { break; } if (array.Length < 2) { break; } if (!(array[0] is int num)) { break; } Handle((byte)num, array[1]); } } catch { } } private static void FindLobbyCommands() { if (lcChecked) { return; } lcChecked = true; try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = assemblies[i].GetType("LobbyCommands.BoxInfoLink", throwOnError: false); if (!(type == null)) { localStatus = type.GetMethod("LocalStatus", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); localInfo = type.GetMethod("LocalInfo", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); takeLocal = type.GetMethod("TakeLocal", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); localReply = type.GetMethod("LocalReply", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); localAll = type.GetMethod("LocalAll", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); localTrack = type.GetMethod("LocalTrack", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); localUse = type.GetMethod("LocalUse", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); break; } } } catch { } } private void Look() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { lookedAt = null; return; } PhysGrabObject val = null; float num = maxDistance.Value; RaycastHit[] array = Physics.RaycastAll(((Component)main).transform.position, ((Component)main).transform.forward, maxDistance.Value, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; if (!(((RaycastHit)(ref val2)).distance >= num)) { PlayerAvatar componentInParent = ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<PlayerAvatar>(); if (!((Object)(object)componentInParent != (Object)null) || (!((Object)(object)componentInParent.photonView == (Object)null) && !componentInParent.photonView.IsMine)) { num = ((RaycastHit)(ref val2)).distance; val = ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<PhysGrabObject>(); } } } if ((Object)(object)val == (Object)(object)lookedAt) { if ((Object)(object)lookedAt != (Object)null && Time.unscaledTime >= askAt) { AskStatus(); } return; } lookedAt = null; lookedView = -1; status = null; lookedBox = null; if (!((Object)(object)val == (Object)null)) { WallBox wallBox = BoxFor(val); if (wallBox != null && !string.IsNullOrEmpty(wallBox.Title)) { title = wallBox.Title; body = wallBox.Body; rarity = wallBox.Rarity; lookedAt = val; lookedBox = wallBox; lookedView = wallBox.View; StatusCache.TryGetValue(val, out status); AskStatus(); } } } private void OnGUI() { try { DrawMarkers(); } catch { } } private void LateUpdate() { try { UpdateUi(); } catch (Exception ex) { Log.LogDebug((object)("UI: " + ex.Message)); } } private static (string name, string label) SplitTitle(string t) { if (string.IsNullOrEmpty(t)) { return (name: t, label: ""); } int num = t.IndexOf(" (", StringComparison.Ordinal); if (num <= 0 || !t.EndsWith(")")) { return (name: t, label: ""); } string text = t.Substring(num + 2, t.Length - num - 3); return (name: t.Substring(0, num), label: (text.Length > 0) ? (char.ToUpperInvariant(text[0]) + text.Substring(1)) : text); } private void UpdateUi() { //IL_001f: 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_0033: 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_0047: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_019b: 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_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) if (lookCard == null) { Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0f); lookCard = new UiCard("BoxInfo Look", val, val); questionCard = new UiCard("BoxInfo Question", val, val); toastCard = new UiCard("BoxInfo Message", val, val); } float num = (float)fontSize.Value / 18f; float maxWidth = Mathf.Min(panelWidth.Value * Ui.CanvasWidth, 1100f); float num2 = bottomGap.Value * 1080f; Color color = default(Color); ((Color)(ref color))..ctor(0.96f, 0.96f, 0.96f); Color color2 = default(Color); ((Color)(ref color2))..ctor(0.86f, 0.88f, 0.9f); Color color3 = default(Color); ((Color)(ref color3))..ctor(0.65f, 0.68f, 0.7f); bool flag = !string.IsNullOrEmpty(question) && Time.unscaledTime < questionUntil; bool flag2 = !string.IsNullOrEmpty(toast) && Time.unscaledTime < toastUntil; questionCard.Visible = flag; if (flag) { questionCard.Set(new Ui.Line[2] { new Ui.Line(question, 28f * num, color, upper: false, center: true), new Ui.Line($"[{yesKey.Value}] Yes [{noKey.Value}] No {Mathf.CeilToInt(questionUntil - Time.unscaledTime)}s", 22f * num, color2, upper: false, center: true) }, maxWidth, 380f * num); questionCard.Place(0f, num2); num2 += questionCard.Height + 8f; } toastCard.Visible = flag2; if (flag2) { toastCard.Set(new Ui.Line[1] { new Ui.Line(toast, 24f * num, color, upper: false, center: true) }, maxWidth); toastCard.Alpha = Mathf.Clamp01((toastUntil - Time.unscaledTime) / 0.5f); toastCard.Place(0f, num2); } bool flag3 = !flag && !flag2 && showPanel.Value && (Object)(object)lookedAt != (Object)null && !string.IsNullOrEmpty(title); lookCard.Visible = flag3; if (flag3) { var (text, text2) = SplitTitle(title); lookCard.Set(new Ui.Line[5] { new Ui.Line(text2, 22f * num, color2), new Ui.Line(text, 44f * num, RarityColor(rarity), upper: true), new Ui.Line(status ?? "", 22f * num, color), new Ui.Line(body ?? "", 20f * num, color2), new Ui.Line(KeyHint(), 19f * num, color3) }, maxWidth); lookCard.Place(0f, bottomGap.Value * 1080f); } UpdateTracker(num); } private static Color RarityColor(int r) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (r < 0) { return new Color(0.85f, 0.85f, 0.85f); } return Notifications.RarityColor(r); } private void BindWalls() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Expected O, but got Unknown useKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "Equip Key", (KeyCode)103, "While looking at a badge or ability box: equip / unequip it (same as grabbing it, without touching the box)."); trackKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "Track Key", (KeyCode)116, "While looking at a badge or ability box: keep its progress on screen. Press again on the same box to stop."); markersOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Markers", "Show Markers", true, "Draw your own markers on the wall boxes: green check = earned / unlocked, gold star = equipped, purple ring = mastered. Only you see them."); markerDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Markers", "Marker Distance", 14f, new ConfigDescription("Show markers for boxes up to this far away (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 40f), Array.Empty<object>())); markerSize = ((BaseUnityPlugin)this).Config.Bind<float>("Markers", "Marker Size", 1f, new ConfigDescription("Size of the markers.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 3f), Array.Empty<object>())); namesOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Markers", "Show Names", true, "Write each badge / ability name on its box (in its rarity color). Only you see them."); nameDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Markers", "Name Distance", 7f, new ConfigDescription("Show names on boxes up to this far away (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 30f), Array.Empty<object>())); nameSize = ((BaseUnityPlugin)this).Config.Bind<float>("Markers", "Name Size", 1f, new ConfigDescription("Size of the names (1 = normal).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 3f), Array.Empty<object>())); if (Mathf.Approximately(nameSize.Value, 1.7f)) { nameSize.Value = 1f; } Canvas.willRenderCanvases += new WillRenderCanvases(OnWillRenderCanvases); tracked = ((BaseUnityPlugin)this).Config.Bind<string>("Tracker", "Tracked", "", "What the tracker follows (set with the Track Key). Empty = nothing."); trackerX = ((BaseUnityPlugin)this).Config.Bind<float>("Tracker", "Left Edge", 0.015f, new ConfigDescription("Tracker position from the left, as a share of the screen width.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.9f), Array.Empty<object>())); trackerY = ((BaseUnityPlugin)this).Config.Bind<float>("Tracker", "Top Edge", 0.22f, new ConfigDescription("Tracker position from the top, as a share of the screen height.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.9f), Array.Empty<object>())); } private void ClearWalls() { foreach (WallBox value in boxes.Values) { ReleaseLabel(value); } boxes.Clear(); StatusCache.Clear(); lookedBox = null; scanAt = 0f; statesAt = Time.unscaledTime + 3f; trackAt = Time.unscaledTime + 3f; } private void WallsTick() { float unscaledTime = Time.unscaledTime; if (unscaledTime >= scanAt) { scanAt = unscaledTime + 2f; Scan(); } if (boxes.Count > 0 && unscaledTime >= statesAt) { statesAt = unscaledTime + 15f; AskStates(); } if (unscaledTime >= visibleAt) { visibleAt = unscaledTime + 0.25f; UpdateVisibility(); } if (!string.IsNullOrEmpty(tracked.Value) && unscaledTime >= trackAt) { trackAt = unscaledTime + 3f; AskTrack(); } Keys(); } private void Keys() { //IL_000a: 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_01ae: 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_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown bool flag = false; bool flag2 = false; try { flag = Input.GetKeyDown(useKey.Value); flag2 = Input.GetKeyDown(trackKey.Value); } catch { } if ((!flag && !flag2) || lookedBox == null || (Object)(object)lookedAt == (Object)null || ChatOpen()) { return; } if (flag2 && !string.IsNullOrEmpty(lookedBox.Id)) { string text = lookedBox.Kind + ":" + lookedBox.Id; if (tracked.Value == text) { tracked.Value = ""; ShowLocalToast("Stopped tracking '" + ShortTitle(lookedBox.Title) + "'."); } else { tracked.Value = text; trackTitle = ShortTitle(lookedBox.Title); trackRarity = lookedBox.Rarity; trackProgress = null; trackHow = null; ShowLocalToast("Tracking '" + trackTitle + "'. Its progress stays on screen."); trackAt = 0f; } } if ((flag && !string.IsNullOrEmpty(question) && Time.unscaledTime < questionUntil) || !flag) { return; } try { if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { FindLobbyCommands(); localUse?.Invoke(null, new object[1] { ((Component)lookedAt).gameObject }); } else { PhotonNetwork.RaiseEvent((byte)176, (object)lookedBox.View, new RaiseEventOptions { Receivers = (ReceiverGroup)2 }, SendOptions.SendReliable); } } catch { } } private void ShowLocalToast(string text) { toast = text; toastUntil = Time.unscaledTime + 3f; } private static string ShortTitle(string t) { if (string.IsNullOrEmpty(t)) { return t; } int num = t.IndexOf(" (", StringComparison.Ordinal); if (num <= 0) { return t; } return t.Substring(0, num); } private string KeyHint() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (lookedBox == null) { return ""; } if (lookedBox.Kind == "drone") { return $"[{useKey.Value}] Unequip all"; } if (string.IsNullOrEmpty(lookedBox.Id)) { return ""; } bool flag = tracked.Value == lookedBox.Kind + ":" + lookedBox.Id; return string.Format("[{0}] Equip / unequip [{1}] {2}", useKey.Value, trackKey.Value, flag ? "Stop tracking" : "Track progress"); } private WallBox BoxFor(PhysGrabObject pgo) { if ((Object)(object)pgo == (Object)null) { return null; } if (boxes.TryGetValue(pgo, out var value)) { return value; } value = Parse(pgo); if (value != null) { boxes[pgo] = value; statesAt = Mathf.Min(statesAt, Time.unscaledTime + 0.5f); } return value; } private void Scan() { List<PhysGrabObject> list = new List<PhysGrabObject>(); foreach (PhysGrabObject key in boxes.Keys) { if ((Object)(object)key == (Object)null) { list.Add(key); } } foreach (PhysGrabObject item in list) { ReleaseLabel(boxes[item]); boxes.Remove(item); StatusCache.Remove(item); } PhysGrabObject[] array; try { array = Object.FindObjectsByType<PhysGrabObject>((FindObjectsSortMode)0); } catch { return; } PhysGrabObject[] array2 = array; foreach (PhysGrabObject val in array2) { if ((Object)(object)val != (Object)null && !boxes.ContainsKey(val)) { BoxFor(val); } } } private WallBox Parse(PhysGrabObject pgo) { PhotonView component = ((Component)pgo).GetComponent<PhotonView>(); object[] array = null; object[] array2 = (((Object)(object)component != (Object)null) ? component.InstantiationData : null); if (array2 != null && array2.Length >= 8 && array2[3] is string text && text == "LobbyCommands.BadgeWall") { array = new object[5] { array2[4], array2[5], array2[6], array2[7], (array2.Length >= 9) ? array2[8] : null }; } else if (!PhotonNetwork.InRoom) { FindLobbyCommands(); try { array = localInfo?.Invoke(null, new object[1] { ((Component)pgo).gameObject }) as object[]; } catch { } } if (array != null && array.Length >= 4 && array[1] is string { Length: not 0 } text2) { WallBox obj2 = new WallBox { Pgo = pgo, View = (((Object)(object)component != (Object)null) ? component.ViewID : (-1)), Kind = (array[0] as string), Title = text2, Body = (array[2] as string), Rarity = ((array[3] is int num) ? num : (-1)), Id = ((array.Length >= 5) ? (array[4] as string) : null) }; MeasureBox(obj2); return obj2; } return null; } private static void MeasureBox(WallBox b) { //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_00ce: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) bool flag = false; Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(((Component)b.Pgo).transform.position, Vector3.zero); Collider[] componentsInChildren = ((Component)b.Pgo).GetComponentsInChildren<Collider>(); foreach (Collider val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !val.isTrigger && val.enabled) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } if (!flag) { MeshRenderer[] componentsInChildren2 = ((Component)b.Pgo).GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null) && ((Renderer)val2).enabled) { if (!flag) { bounds = ((Renderer)val2).bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(((Renderer)val2).bounds); } } } } b.Center = ((Bounds)(ref bounds)).center; b.Top = ((Bounds)(ref bounds)).center + Vector3.up * ((Bounds)(ref bounds)).extents.y * 0.6f; b.TopLocal = ((Component)b.Pgo).transform.InverseTransformPoint(b.Top); MeasureLocal(b); } private static void MeasureLocal(WallBox b) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 toLocal = ((Component)b.Pgo).transform.worldToLocalMatrix; bool any = false; Vector3 mn = Vector3.zero; Vector3 mx = Vector3.zero; Collider[] componentsInChildren = ((Component)b.Pgo).GetComponentsInChildren<Collider>(); foreach (Collider val in componentsInChildren) { if ((Object)(object)val == (Object)null || val.isTrigger || !val.enabled) { continue; } Matrix4x4 localToWorldMatrix = ((Component)val).transform.localToWorldMatrix; Collider val2 = val; BoxCollider val3 = (BoxCollider)(object)((val2 is BoxCollider) ? val2 : null); if (val3 == null) { MeshCollider val4 = (MeshCollider)(object)((val2 is MeshCollider) ? val2 : null); if (val4 == null) { SphereCollider val5 = (SphereCollider)(object)((val2 is SphereCollider) ? val2 : null); if (val5 == null) { CapsuleCollider val6 = (CapsuleCollider)(object)((val2 is CapsuleCollider) ? val2 : null); if (val6 != null) { Add(localToWorldMatrix, val6.center, new Vector3(val6.radius * 2f, val6.height, val6.radius * 2f)); } } else { Add(localToWorldMatrix, val5.center, Vector3.one * val5.radius * 2f); } } else if ((Object)(object)val4.sharedMesh != (Object)null) { Bounds bounds = val4.sharedMesh.bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = val4.sharedMesh.bounds; Add(localToWorldMatrix, center, ((Bounds)(ref bounds)).size); } } else { Add(localToWorldMatrix, val3.center, val3.size); } } b.HasLocal = any; if (any) { b.LocalMin = mn; b.LocalMax = mx; } void Add(Matrix4x4 m, Vector3 c, Vector3 size) { //IL_0007: 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) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) for (int j = 0; j < 8; j++) { Vector3 val7 = c + Vector3.Scale(size * 0.5f, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1)))); Vector3 val8 = ((Matrix4x4)(ref toLocal)).MultiplyPoint3x4(((Matrix4x4)(ref m)).MultiplyPoint3x4(val7)); if (!any) { mn = (mx = val8); any = true; } else { mn = Vector3.Min(mn, val8); mx = Vector3.Max(mx, val8); } } } } private static Vector3 NamePoint(WallBox b, Camera cam) { //IL_0022: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00a0: 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_00b5: 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) Transform transform = ((Component)b.Pgo).transform; if (!b.HasLocal) { return transform.TransformPoint(b.TopLocal); } Vector3 localMin = b.LocalMin; Vector3 localMax = b.LocalMax; Vector3 val = localMax - localMin; float num = ((transform.InverseTransformPoint(((Component)cam).transform.position).z >= (localMin.z + localMax.z) * 0.5f) ? (localMax.z + val.z * 0.05f) : (localMin.z - val.z * 0.05f)); return transform.TransformPoint(new Vector3((localMin.x + localMax.x) * 0.5f, localMin.y + val.y * 0.22f, num)); } private static Vector3 MarkerPoint(WallBox b, Camera cam) { //IL_0022: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00a9: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00d3: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0106: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)b.Pgo).transform; if (!b.HasLocal) { return transform.TransformPoint(b.TopLocal); } Vector3 localMin = b.LocalMin; Vector3 localMax = b.LocalMax; Vector3 val = localMax - localMin; float num = ((transform.InverseTransformPoint(((Component)cam).transform.position).z >= (localMin.z + localMax.z) * 0.5f) ? (localMax.z + val.z * 0.05f) : (localMin.z - val.z * 0.05f)); float num2 = val.x * 0.2f; float num3 = val.y * 0.2f; Vector3 val2 = transform.TransformPoint(new Vector3(localMax.x - num2, localMax.y - num3, num)); Vector3 val3 = transform.TransformPoint(new Vector3(localMin.x + num2, localMax.y - num3, num)); if (!(cam.WorldToScreenPoint(val2).x >= cam.WorldToScreenPoint(val3).x)) { return val3; } return val2; } private void AskStates() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown try { if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { FindLobbyCommands(); ApplyStates(localAll?.Invoke(null, null) as object[]); } else { PhotonNetwork.RaiseEvent((byte)172, (object)null, new RaiseEventOptions { Receivers = (ReceiverGroup)2 }, SendOptions.SendReliable); } } catch { } } private void ApplyStates(object[] d) { if (d == null || d.Length < 2 || !(d[1] is int[] array)) { return; } if (d[0] is int[] array2) { Dictionary<int, WallBox> dictionary = new Dictionary<int, WallBox>(); foreach (WallBox value2 in boxes.Values) { if (value2.View > 0) { dictionary[value2.View] = value2; } } for (int i = 0; i < array2.Length && i < array.Length; i++) { if (dictionary.TryGetValue(array2[i], out var value)) { value.State = array[i]; } } } else { if (!(d[0] is GameObject[] array3)) { return; } for (int j = 0; j < array3.Length && j < array.Length; j++) { PhysGrabObject pgo = (((Object)(object)array3[j] != (Object)null) ? array3[j].GetComponent<PhysGrabObject>() : null); WallBox wallBox = BoxFor(pgo); if (wallBox != null) { wallBox.State = array[j]; } } } } private void UpdateVisibility() { //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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_017e: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null || (!markersOn.Value && !namesOn.Value)) { return; } Vector3 position = ((Component)main).transform.position; float num = (markersOn.Value ? markerDistance.Value : 0f); float num2 = (namesOn.Value ? nameDistance.Value : 0f); int num3 = 0; int num4 = 0; foreach (WallBox value in boxes.Values) { value.Visible = false; value.NameVisible = false; if ((Object)(object)value.Pgo == (Object)null) { continue; } if (value.State >= 1) { num3++; } float num5 = Mathf.Max((value.State >= 1) ? num : 0f, num2); if (num5 <= 0f) { continue; } Vector3 val = ((Component)value.Pgo).transform.position - position; if (((Vector3)(ref val)).sqrMagnitude > (num5 + 3f) * (num5 + 3f)) { continue; } MeasureBox(value); Vector3 val2 = value.Center - position; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > num5 || magnitude < 0.01f || Vector3.Dot(val2, ((Component)main).transform.forward) <= 0f) { continue; } bool flag = false; RaycastHit[] array = Physics.RaycastAll(position, val2 / magnitude, magnitude + 0.5f, -1, (QueryTriggerInteraction)1); Array.Sort(array, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance)); RaycastHit[] array2 = array; for (int num6 = 0; num6 < array2.Length; num6++) { RaycastHit val3 = array2[num6]; PlayerAvatar componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<PlayerAvatar>(); if (!((Object)(object)componentInParent != (Object)null) || (!((Object)(object)componentInParent.photonView == (Object)null) && !componentInParent.photonView.IsMine)) { flag = (Object)(object)((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<PhysGrabObject>() != (Object)(object)value.Pgo; break; } } if (!flag) { value.Dist = magnitude; value.Visible = value.State >= 1 && magnitude <= num; value.NameVisible = magnitude <= num2; if (value.Visible) { num4++; } } } if ((boxes.Count != lastBoxCount || num3 != lastStateCount || num4 > 0 != lastVisibleCount > 0) && Time.unscaledTime >= markerLogAt) { markerLogAt = Time.unscaledTime + 5f; lastBoxCount = boxes.Count; lastStateCount = num3; lastVisibleCount = num4; Log.LogInfo((object)$"Markers: {boxes.Count} wall boxes found, {num3} you have, {num4} in view."); } } private void DrawMarkers() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: 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) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) if (!markersOn.Value || boxes.Count == 0 || (int)Event.current.type != 7) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } MakeIcons(); float num = (float)Screen.height / 1080f * markerSize.Value; Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.9f); foreach (WallBox value in boxes.Values) { if (!value.Visible || (Object)(object)value.Pgo == (Object)null || value.State < 1) { continue; } Vector3 val = main.WorldToScreenPoint(NamePoint(value, main)); if (!(val.z <= 0f)) { float num2 = Mathf.Clamp(44f / Mathf.Max(0.5f, val.z), 8f, 24f) * num; float num3 = (((Object)(object)value.Label != (Object)null) ? value.NameHalfPx : 0f) + num2 / 2f + 3f * (float)Screen.height / 1080f; float x = val.x; float num4 = (float)Screen.height - val.y - num3; Rect val2 = new Rect(x - num2 / 2f, num4 - num2 / 2f, num2, num2); if ((value.State & 4) != 0) { float num5 = num2 * 1.35f; GUI.DrawTexture(new Rect(x - num5 / 2f, num4 - num5 / 2f, num5, num5), (Texture)(object)ringTex); } GUI.DrawTexture(val2, (Texture)(object)(((value.State & 2) != 0) ? starTex : checkTex)); } } GUI.color = color; } private void OnWillRenderCanvases() { if (Time.frameCount == nameFrame) { return; } nameFrame = Time.frameCount; try { UpdateNameLabels(); } catch (Exception ex) { Log.LogDebug((object)("Names: " + ex.Message)); } } private static bool LocalInTruck() { try { PlayerAvatar value = Traverse.Create(typeof(PlayerAvatar)).Field("instance").GetValue<PlayerAvatar>(); if ((Object)(object)value == (Object)null) { return false; } object value2 = Traverse.Create((object)value).Field("RoomVolumeCheck").GetValue(); return value2 != null && Traverse.Create(value2).Field("inTruck").GetValue<bool>(); } catch { return false; } } private void UpdateNameLabels() { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; bool flag = namesOn.Value && (Object)(object)main != (Object)null && LocalInTruck(); float num = Time.unscaledDeltaTime / 0.3f; float num2 = 1080f / Mathf.Max(1f, (float)Screen.height); foreach (WallBox value in boxes.Values) { float num3 = ((flag && value.NameVisible) ? 1f : 0f); value.NameAlpha = Mathf.MoveTowards(value.NameAlpha, num3, num); if (value.NameAlpha <= 0.001f || (Object)(object)value.Pgo == (Object)null || !value.HasLocal || (Object)(object)main == (Object)null || string.IsNullOrEmpty(value.Title)) { ReleaseLabel(value); continue; } Transform transform = ((Component)value.Pgo).transform; Vector3 localMin = value.LocalMin; Vector3 localMax = value.LocalMax; Vector3 val = localMax - localMin; float num4 = ((transform.InverseTransformPoint(((Component)main).transform.position).z >= (localMin.z + localMax.z) * 0.5f) ? (localMax.z + val.z * 0.05f) : (localMin.z - val.z * 0.05f)); float num5 = localMin.y + val.y * 0.22f; Vector3 val2 = transform.TransformPoint(new Vector3((localMin.x + localMax.x) * 0.5f, num5, num4)); Vector3 val3 = main.WorldToScreenPoint(val2); if (val3.z <= 0.05f) { ReleaseLabel(value); continue; } Vector3 val4 = main.WorldToScreenPoint(transform.TransformPoint(new Vector3(localMin.x, num5, num4))); float num6 = Mathf.Abs(main.WorldToScreenPoint(transform.TransformPoint(new Vector3(localMax.x, num5, num4))).x - val4.x) * num2 * 1.1f; TextMeshProUGUI val5 = value.Label; if ((Object)(object)val5 == (Object)null) { val5 = (value.Label = ((spareLabels.Count > 0) ? spareLabels.Pop() : NewNameLabel())); ((Component)val5).gameObject.SetActive(true); ((TMP_Text)val5).text = ((value.Kind == "drone") ? "Unequip" : ShortTitle(value.Title)); ((Graphic)val5).color = (Color)((value.Kind == "drone") ? new Color(1f, 0.27f, 0.25f) : RarityColor(value.Rarity)); ((TMP_Text)val5).fontSize = 20f; value.LongestWord = 0f; } TMP_FontAsset font = Ui.Font; if ((Object)(object)font != (Object)null && (Object)(object)((TMP_Text)val5).font != (Object)(object)font) { ((TMP_Text)val5).font = font; Shadow(val5); value.LongestWord = 0f; } if (value.LongestWord <= 0f) { string[] array = ((TMP_Text)val5).text.Split(' '); foreach (string text in array) { if (text.Length > 0) { value.LongestWord = Mathf.Max(value.LongestWord, ((TMP_Text)val5).GetPreferredValues(text).x + 4f); } } } float num7 = Vector3.Distance(((Component)main).transform.position, val2); float num8 = Mathf.Clamp(36f / Mathf.Max(0.5f, num7), 7f, 20f) / 20f * 1.7f * nameSize.Value; RectTransform val6 = (RectTransform)((TMP_Text)val5).transform; ((Transform)val6).localScale = new Vector3(num8, num8, 1f); val6.sizeDelta = new Vector2(Mathf.Max(Mathf.Max(40f, num6) / num8, value.LongestWord), 60f); val6.anchoredPosition = new Vector2(val3.x * num2, val3.y * num2); ((TMP_Text)val5).alpha = value.NameAlpha; value.NameHalfPx = ((TMP_Text)val5).preferredHeight * num8 * 0.5f / num2; } } private void ReleaseLabel(WallBox b) { if (!((Object)(object)b.Label == (Object)null)) { ((Component)b.Label).gameObject.SetActive(false); spareLabels.Push(b.Label); b.Label = null; } } private TextMeshProUGUI NewNameLabel() { //IL_0018: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ae: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BoxInfo Name", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(Ui.Canvas, false); val.transform.SetAsFirstSibling(); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); ((Graphic)val2).raycastTarget = false; ((TMP_Text)val2).alignment = (TextAlignmentOptions)514; ((TMP_Text)val2).enableWordWrapping = true; ((TMP_Text)val2).overflowMode = (TextOverflowModes)0; ((TMP_Text)val2).fontStyle = (FontStyles)17; if ((Object)(object)Ui.Font != (Object)null) { ((TMP_Text)val2).font = Ui.Font; } Shadow(val2); RectTransform val3 = (RectTransform)val.transform; Vector2 anchorMin = (val3.anchorMax = Vector2.zero); val3.anchorMin = anchorMin; val3.pivot = new Vector2(0.5f, 0.5f); return val2; } private static void Shadow(TextMeshProUGUI t) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) try { ((TMP_Text)t).outlineWidth = 0f; Material fontMaterial = ((TMP_Text)t).fontMaterial; fontMaterial.EnableKeyword(ShaderUtilities.Keyword_Underlay); fontMaterial.SetColor(ShaderUtilities.ID_UnderlayColor, new Color(0f, 0f, 0f, 0.9f)); fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, 0.2f); fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, -0.3f); fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayDilate, 0.6f); fontMaterial.SetFloat(ShaderUtilities.ID_UnderlaySoftness, 1f); ((TMP_Text)t).UpdateMeshPadding(); } catch { } } private void AskTrack() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown string[] array = tracked.Value.Split(new char[1] { ':' }, 2); if (array.Length < 2) { return; } try { if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { FindLobbyCommands(); ApplyTrack(localTrack?.Invoke(null, new object[2] { array[0], array[1] }) as object[]); } else { PhotonNetwork.RaiseEvent((byte)174, (object)new object[2] { array[0], array[1] }, new RaiseEventOptions { Receivers = (ReceiverGroup)2 }, SendOptions.SendReliable); } } catch { } } private void ApplyTrack(object[] d) { if (d != null && d.Length >= 6 && d[0] is string text && d[1] is string text2 && !(tracked.Value != text + ":" + text2)) { trackTitle = d[2] as string; trackProgress = d[3] as string; trackRarity = ((d[4] is int num) ? num : (-1)); trackHow = d[5] as string; trackAnswerAt = Time.unscaledTime; } } private void UpdateTracker(float k) { //IL_0018: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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) if (trackCard == null) { trackCard = new UiCard("BoxInfo Tracker", new Vector2(0f, 1f), new Vector2(0f, 1f)); } bool flag = !string.IsNullOrEmpty(tracked.Value) && !string.IsNullOrEmpty(trackTitle) && Time.unscaledTime - trackAnswerAt <= 12f; trackCard.Visible = flag; if (flag) { trackCard.Set(new Ui.Line[4] { new Ui.Line("Tracking", 20f * k, new Color(0.86f, 0.88f, 0.9f)), new Ui.Line(trackTitle, 34f * k, RarityColor(trackRarity), upper: true), new Ui.Line(trackProgress ?? "...", 22f * k, new Color(0.96f, 0.96f, 0.96f)), new Ui.Line(trackHow ?? "", 18f * k, new Color(0.75f, 0.78f, 0.8f)) }, 400f * k, 220f * k); trackCard.Place(trackerX.Value * Ui.CanvasWidth, (0f - trackerY.Value) * 1080f); } } private void MakeIcons() { //IL_001f: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)checkTex != (Object)null) { return; } checkTex = Icon(new Color(0.2f, 0.72f, 0.33f), (float x, float y) => Seg(x, y, 0.27f, 0.5f, 0.43f, 0.34f, 0.075f) || Seg(x, y, 0.43f, 0.34f, 0.74f, 0.67f, 0.075f)); starTex = Icon(new Color(0.95f, 0.66f, 0.05f), Star); ringTex = new Texture2D(64, 64, (TextureFormat)4, false); Color val = default(Color); ((Color)(ref val))..ctor(0.66f, 0.36f, 1f); for (int num = 0; num < 64; num++) { for (int num2 = 0; num2 < 64; num2++) { float num3 = 0f; for (int num4 = 0; num4 < 4; num4++) { float num5 = ((float)num2 + 0.25f + 0.5f * (float)(num4 & 1)) / 64f - 0.5f; float num6 = ((float)num + 0.25f + 0.5f * (float)(num4 >> 1)) / 64f - 0.5f; float num7 = Mathf.Sqrt(num5 * num5 + num6 * num6); if (num7 <= 0.49f && num7 >= 0.4f) { num3 += 0.25f; } } ringTex.SetPixel(num2, num, new Color(val.r, val.g, val.b, num3)); } } ringTex.Apply(); } private static Texture2D Icon(Color fill, Func<float, float, bool> symbol) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_00e6: 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_00db: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); Color val2 = default(Color); ((Color)(ref val2))..ctor(fill.r * 0.45f, fill.g * 0.45f, fill.b * 0.45f); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { Color val3 = Color.clear; for (int k = 0; k < 4; k++) { float num = ((float)j + 0.25f + 0.5f * (float)(k & 1)) / 64f; float num2 = ((float)i + 0.25f + 0.5f * (float)(k >> 1)) / 64f; float num3 = Mathf.Sqrt((num - 0.5f) * (num - 0.5f) + (num2 - 0.5f) * (num2 - 0.5f)); Color val4 = Color.clear; if (num3 <= 0.48f) { val4 = ((num3 >= 0.42f) ? val2 : (symbol(num, num2) ? Color.white : fill)); } val3 += val4 * 0.25f; } val.SetPixel(j, i, val3); } } val.Apply(); return val; } private static bool Seg(float x, float y, float ax, float ay, float bx, float by, float w) { float num = bx - ax; float num2 = by - ay; float num3 = Mathf.Clamp01(((x - ax) * num + (y - ay) * num2) / (num * num + num2 * num2)); float num4 = x - (ax + num * num3); float num5 = y - (ay + num2 * num3); return num4 * num4 + num5 * num5 <= w * w; } private static bool Star(float x, float y) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Vector2[] array = (Vector2[])(object)new Vector2[10]; for (int i = 0; i < 10; i++) { float num = MathF.PI / 2f + (float)i * MathF.PI / 5f; float num2 = ((i % 2 == 0) ? 0.31f : 0.13f); array[i] = new Vector2(0.5f + num2 * Mathf.Cos(num), 0.48f + num2 * Mathf.Sin(num)); } bool flag = false; int num3 = 0; int num4 = 9; while (num3 < 10) { if (array[num3].y > y != array[num4].y > y && x < (array[num4].x - array[num3].x) * (y - array[num3].y) / (array[num4].y - array[num3].y) + array[num3].x) { flag = !flag; } num4 = num3++; } return flag; } } internal static class Ui { internal struct Line { public string Text; public float Size; public Color Color; public bool Upper; public bool Center; public Line(string text, float size, Color color, bool upper = false, bool center = false) { //IL_000f: 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) Text = text; Size = size; Color = color; Upper = upper; Center = center; } } private static GameObject root; private static TMP_FontAsset font; private static float fontCheckAt; internal static Transform Canvas { get { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root != (Object)null) { return root.transform; } root = new GameObject("BoxInfo UI"); Object.DontDestroyOnLoad((Object)(object)root); Canvas obj = root.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 990; CanvasScaler obj2 = root.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.matchWidthOrHeight = 1f; return root.transform; } } internal static float CanvasWidth => 1080f * (float)Screen.width / Mathf.Max(1f, (float)Screen.height); internal static TMP_FontAsset Font { get { if ((Object)(object)font != (Object)null || Time.unscaledTime < fontCheckAt) { return font; } fontCheckAt = Time.unscaledTime + 2f; try { HaulUI val = Object.FindFirstObjectByType<HaulUI>((FindObjectsInactive)1); TMP_Text val2 = (((Obje