Decompiled source of Examination v1.0.1
Mods\Examination.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.Json; using System.Threading.Tasks; using BoneLib; using BoneLib.BoneMenu; using Examination; using Il2Cpp; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.AI; using Il2CppSLZ.Marrow.Data; using Il2CppSLZ.Marrow.Interaction; using Il2CppSLZ.Marrow.Pool; using Il2CppSLZ.Marrow.VFX; using Il2CppSLZ.Marrow.Warehouse; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Utils; using UnityEngine; using UnityEngine.AI; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Main), "Examination", "0.2.0", "syrup", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyVersion("0.0.0.0")] namespace Examination; public static class BootAudio { private static readonly Dictionary<string, AudioClip> Clips = new Dictionary<string, AudioClip>(); private static bool _scanned; private static AudioSource _rapidSource; public static void Reset() { try { if ((Object)(object)_rapidSource != (Object)null) { Object.Destroy((Object)(object)((Component)_rapidSource).gameObject); _rapidSource = null; } foreach (AudioClip value in Clips.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } } Clips.Clear(); _scanned = false; } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: boot audio reset failed: " + ex.Message); } } } public static void Play(string name) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown try { AudioClip clip = GetClip(name); if (!((Object)(object)clip == (Object)null)) { GameObject val = new GameObject("[Examination] BootAudio"); ((Object)val).hideFlags = (HideFlags)61; AudioSource val2 = val.AddComponent<AudioSource>(); val2.spatialBlend = 0f; val2.playOnAwake = false; val2.loop = false; val2.clip = clip; val2.Play(); Object.Destroy((Object)(object)val, clip.length + 0.5f); } } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: boot audio playback failed: " + ex.Message); } } } public static void PlayType() { string[] array = new string[3] { "type", "type2", "type3" }; int num = Random.Range(0, array.Length); for (int i = 0; i < array.Length; i++) { string name = array[(num + i) % array.Length]; if ((Object)(object)GetClip(name) != (Object)null) { Play(name); break; } } } public static void PlayRapid(string name) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown try { AudioClip clip = GetClip(name); if (!((Object)(object)clip == (Object)null)) { if ((Object)(object)_rapidSource == (Object)null) { GameObject val = new GameObject("[Examination] BootAudioRapid"); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); _rapidSource = val.AddComponent<AudioSource>(); _rapidSource.spatialBlend = 0f; _rapidSource.playOnAwake = false; _rapidSource.loop = false; } _rapidSource.clip = clip; _rapidSource.Play(); } } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: rapid audio playback failed: " + ex.Message); } } } public static void PlayRapidAny(params string[] names) { for (int i = 0; i < names.Length; i++) { AudioClip clip = GetClip(names[i]); if ((Object)(object)clip != (Object)null) { PlayRapid(names[i]); break; } } } private static AudioClip GetClip(string name) { if (Clips.TryGetValue(name, out var value)) { return value; } if (!_scanned) { _scanned = true; Scan(); } Clips.TryGetValue(name, out value); if ((Object)(object)value == (Object)null) { string path = Path.Combine(Data.Dir, "sounds", name + ".wav"); if (File.Exists(path)) { value = LoadWav(name, path); if ((Object)(object)value != (Object)null) { Clips[name] = value; } } } return value; } private static void Scan() { try { string text = Path.Combine(Data.Dir, "sounds"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Msg("Examination: created sounds folder " + text + " (drop in: off.wav, type.wav, power_on.wav, activated.wav)"); } return; } string[] array = new string[15] { "off", "type", "type2", "type3", "power_on", "activated", "select", "error", "nvgdie", "nvgdie2", "nvguplink", "nvgtick", "nvgcharge", "nvgcritical", "rebooting" }; for (int i = 0; i < array.Length; i++) { string path = Path.Combine(text, array[i] + ".wav"); if (File.Exists(path)) { AudioClip val = LoadWav(array[i], path); if ((Object)(object)val != (Object)null) { Clips[array[i]] = val; } } } Main instance2 = Main.Instance; if (instance2 != null) { ((MelonBase)instance2).LoggerInstance.Msg("Examination: boot sounds loaded (" + Clips.Count + " of 4)."); } } catch (Exception ex) { Main instance3 = Main.Instance; if (instance3 != null) { ((MelonBase)instance3).LoggerInstance.Warning("Examination: boot audio scan failed: " + ex.Message); } } } private static AudioClip LoadWav(string name, string path) { try { byte[] array = File.ReadAllBytes(path); if (array.Length < 44 || array[0] != 82 || array[1] != 73 || array[2] != 70 || array[3] != 70 || array[8] != 87 || array[9] != 65 || array[10] != 86 || array[11] != 69) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: " + name + ".wav is not a RIFF WAV file."); } return null; } int num = 1; int num2 = 44100; int num3 = 16; int num4 = -1; int num5 = 0; int num6; for (int i = 12; i + 8 <= array.Length; i += 8 + num6 + (num6 & 1)) { string text = new string(new char[4] { (char)array[i], (char)array[i + 1], (char)array[i + 2], (char)array[i + 3] }); num6 = array[i + 4] | (array[i + 5] << 8) | (array[i + 6] << 16) | (array[i + 7] << 24); if (text == "fmt " && num6 >= 16) { int num7 = array[i + 8] | (array[i + 9] << 8); num = array[i + 10] | (array[i + 11] << 8); num2 = array[i + 12] | (array[i + 13] << 8) | (array[i + 14] << 16) | (array[i + 15] << 24); num3 = array[i + 22] | (array[i + 23] << 8); if (num7 != 1 && num7 != 65534) { Main instance2 = Main.Instance; if (instance2 != null) { ((MelonBase)instance2).LoggerInstance.Warning("Examination: " + name + ".wav is not PCM (compressed formats unsupported)."); } return null; } } else if (text == "data") { num4 = i + 8; num5 = num6; break; } } if (num4 < 0 || num5 <= 0 || num < 1 || num > 2 || (num3 != 16 && num3 != 24 && num3 != 32)) { Main instance3 = Main.Instance; if (instance3 != null) { ((MelonBase)instance3).LoggerInstance.Warning("Examination: " + name + ".wav must be 16/24/32-bit PCM mono or stereo."); } return null; } int num8 = num3 / 8; int num9 = num5 / num8; int num10 = num9 / num; if (num10 <= 0) { return null; } float[] array2 = new float[num9]; for (int j = 0; j < num9; j++) { int num11 = num4 + j * num8; switch (num3) { case 16: { short num14 = (short)(array[num11] | (array[num11 + 1] << 8)); array2[j] = (float)num14 / 32768f; break; } case 24: { int num13 = array[num11] | (array[num11 + 1] << 8) | (array[num11 + 2] << 16); if ((num13 & 0x800000) != 0) { num13 |= -16777216; } array2[j] = (float)num13 / 8388608f; break; } default: { int num12 = array[num11] | (array[num11 + 1] << 8) | (array[num11 + 2] << 16) | (array[num11 + 3] << 24); array2[j] = (float)num12 / 2.1474836E+09f; break; } } } AudioClip val = AudioClip.Create(name, num10, num, num2, false); val.SetData(Il2CppStructArray<float>.op_Implicit(array2), 0); return val; } catch (Exception ex) { Main instance4 = Main.Instance; if (instance4 != null) { ((MelonBase)instance4).LoggerInstance.Warning("Examination: failed to load " + name + ".wav: " + ex.Message); } return null; } } } public static class ClassApplier { private enum PhaseKind { Clear, Avatar, Item } private class Phase { public PhaseKind Kind; public string Title; } private static readonly Queue<Phase> _phases = new Queue<Phase>(); private static readonly List<GameObject> _spawned = new List<GameObject>(); private static int _generation; private static float _nextPhaseAt; private static float _applyAt; public static void Apply(ClassDef cls) { if (cls != null) { _generation++; _phases.Clear(); _nextPhaseAt = Time.unscaledTime + 0.15f; _applyAt = Time.unscaledTime; _phases.Enqueue(new Phase { Kind = PhaseKind.Clear, Title = null }); _phases.Enqueue(new Phase { Kind = PhaseKind.Avatar, Title = cls.Avatar }); Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Msg("Examination: applying " + cls.Id); } } } public static void Tick() { if (_phases.Count == 0 || Time.unscaledTime < _nextPhaseAt) { return; } Phase phase = _phases.Peek(); if (phase.Kind == PhaseKind.Item && !PalletIndex.Ready && Time.unscaledTime - _applyAt < 20f) { _nextPhaseAt = Time.unscaledTime + 0.25f; return; } _phases.Dequeue(); _nextPhaseAt = Time.unscaledTime + ((phase.Kind == PhaseKind.Item) ? 0.9f : 0.35f); switch (phase.Kind) { case PhaseKind.Clear: ClearKit(); break; case PhaseKind.Avatar: SwapAvatar(phase.Title); break; case PhaseKind.Item: Give(phase.Title); break; } } private static void ClearKit() { for (int i = 0; i < _spawned.Count; i++) { if ((Object)(object)_spawned[i] != (Object)null) { DespawnObject(_spawned[i]); } } _spawned.Clear(); ClearHolsters(); } private static void DespawnObject(GameObject go) { try { Poolee val = go.GetComponentInParent<Poolee>(); if ((Object)(object)val == (Object)null) { val = go.GetComponentInChildren<Poolee>(true); } MarrowEntity val2 = go.GetComponentInParent<MarrowEntity>(); if ((Object)(object)val2 == (Object)null) { val2 = go.GetComponentInChildren<MarrowEntity>(true); } if ((Object)(object)val != (Object)null) { if ((Object)(object)val2 != (Object)null) { SpawnEffects.CallDespawnEffect(val2); } val.Despawn(); } } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: kit cleanup failed: " + ex.Message); } } } private static void ClearHolsters() { RigManager rigManager = LocalPlayer.RigManager; if ((Object)(object)rigManager == (Object)null) { return; } InventorySlotReceiver[] array = Il2CppArrayBase<InventorySlotReceiver>.op_Implicit(((Component)rigManager).GetComponentsInChildren<InventorySlotReceiver>(true)); foreach (InventorySlotReceiver val in array) { IGrippable host = val.GetHost(); if (host == null) { continue; } GameObject val2 = null; try { val2 = host.GetHostGameObject(); } catch { continue; } if ((Object)(object)val2 == (Object)null) { continue; } Poolee val3 = val2.GetComponentInParent<Poolee>(); if ((Object)(object)val3 == (Object)null) { val3 = val2.GetComponentInChildren<Poolee>(true); } MarrowEntity val4 = val2.GetComponentInParent<MarrowEntity>(); if ((Object)(object)val4 == (Object)null) { val4 = val2.GetComponentInChildren<MarrowEntity>(true); } if (!((Object)(object)val3 != (Object)null)) { continue; } try { if ((Object)(object)val4 != (Object)null) { SpawnEffects.CallDespawnEffect(val4); } val3.Despawn(); } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: holster clear failed: " + ex.Message); } } } } private static void Give(string title) { //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Expected O, but got Unknown //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(title)) { return; } SpawnableCrate crate = Crates.FindSpawnable(title); if ((Object)(object)crate == (Object)null) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: no loaded spawnable matches \"" + title + "\". Is the pack installed and its pallet loaded?"); } return; } string text = PalletIndex.FindSpawnableBarcode(title); if (string.IsNullOrEmpty(text)) { try { text = ((((Scannable)crate).Barcode != (Barcode)null) ? ((Scannable)crate).Barcode.ID : null); } catch { text = null; } } if (string.IsNullOrEmpty(text)) { Main instance2 = Main.Instance; if (instance2 != null) { ((MelonBase)instance2).LoggerInstance.Warning("Examination: no barcode for \"" + title + "\" - skipping."); } return; } Transform head = LocalPlayer.Head; Vector3 val = (((Object)(object)head != (Object)null) ? head.forward : Vector3.forward); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = (((Object)(object)head != (Object)null) ? head.position : (((Component)LocalPlayer.RigManager).transform.position + Vector3.up * 1.2f)) + val * 1.25f + Vector3.down * 0.12f; Quaternion val3 = Quaternion.LookRotation(val, Vector3.up); int gen = _generation; Action<GameObject> action = delegate(GameObject go) { if (gen != _generation || (Object)(object)go == (Object)null) { if ((Object)(object)go != (Object)null) { DespawnObject(go); } } else { _spawned.Add(go); Main instance6 = Main.Instance; if (instance6 != null) { ((MelonBase)instance6).LoggerInstance.Msg("Examination: " + ((Scannable)crate).Title + " spawned at the player."); } } }; try { if (FusionBridge.SpawnNetworked(text, val2, val3)) { Main instance3 = Main.Instance; if (instance3 != null) { ((MelonBase)instance3).LoggerInstance.Msg("Examination: " + ((Scannable)crate).Title + " spawned (networked)."); } return; } Spawnable val4 = new Spawnable(); val4.crateRef = new SpawnableCrateReference(text); val4.policyData = null; AssetSpawner.Register(val4); MethodInfo method = typeof(AssetSpawner).GetMethod("Spawn"); if (method != null) { method.Invoke(null, new object[9] { val4, val2, val3, null, null, false, null, null, null }); return; } throw new MissingMethodException("AssetSpawner.Spawn"); } catch (Exception ex) { Main instance4 = Main.Instance; if (instance4 != null) { ((MelonBase)instance4).LoggerInstance.Warning("Examination: AssetSpawner failed for \"" + title + "\" (" + ex.Message + ") - falling back to the warehouse spawn."); } try { HelperMethods.SpawnCrate(text, val2, val3, Vector3.one, false, action, (Action<GameObject>)null); } catch (Exception ex2) { Main instance5 = Main.Instance; if (instance5 != null) { ((MelonBase)instance5).LoggerInstance.Warning("Examination: spawn failed for \"" + title + "\": " + ex2.Message); } } } } private static void SwapAvatar(string match) { if (string.IsNullOrEmpty(match)) { return; } AvatarCrate val = Crates.FindAvatar(match); if ((Object)(object)val == (Object)null) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: no loaded avatar matches \"" + match + "\". Is the Mintys Soldiers pack installed and its pallet loaded?"); } return; } try { RigManager rigManager = LocalPlayer.RigManager; MethodInfo method = typeof(RigManager).GetMethod("SwapAvatarCrate"); if (method != null) { method.Invoke(rigManager, new object[3] { ((Scannable)val).Barcode, true, null }); Main instance2 = Main.Instance; if (instance2 != null) { ((MelonBase)instance2).LoggerInstance.Msg("Examination: avatar swapped to " + ((Scannable)val).Title + "."); } } else { Main instance3 = Main.Instance; if (instance3 != null) { ((MelonBase)instance3).LoggerInstance.Warning("Examination: SwapAvatarCrate missing - avatar swap skipped."); } } } catch (Exception ex) { Main instance4 = Main.Instance; if (instance4 != null) { ((MelonBase)instance4).LoggerInstance.Warning("Examination: avatar swap failed: " + ex.Message); } } } } public static class ClassSelection { private static readonly Color Accent = new Color(0.72f, 0.1f, 0.16f, 1f); private static readonly Color Sub = new Color(0.9f, 0.9f, 0.9f, 1f); private static readonly Color Rasonia = new Color(0.88f, 0.22f, 0.2f, 1f); private static readonly Color Menlo = new Color(0.28f, 0.72f, 0.34f, 1f); private static Page _classPage; private static Page _rasoniaSection; private static Page _menloSection; private static Page _rootPage; private static Element _nvgEnableOption; private static Page _nvgColorPage; private static bool _nvgOptionsShown; public static string LockedClass { get; private set; } public static void SetNvgOption(bool available) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) if (_rootPage == null || available == _nvgOptionsShown) { return; } _nvgOptionsShown = available; if (available) { _nvgEnableOption = (Element)(object)_rootPage.CreateBool("NVG Enabled", Sub, Minimap.NvgEnabled, (Action<bool>)delegate(bool value) { Minimap.NvgEnabled = value; }); _nvgColorPage = _rootPage.CreatePage("NVG Color", Sub, 6, true); _nvgColorPage.CreateFunction("White", Sub, (Action)delegate { Minimap.NvgColor = Nvg.ColorMode.White; }); _nvgColorPage.CreateFunction("Green", Sub, (Action)delegate { Minimap.NvgColor = Nvg.ColorMode.Green; }); _nvgColorPage.CreateFunction("Red", Sub, (Action)delegate { Minimap.NvgColor = Nvg.ColorMode.Red; }); _nvgColorPage.CreateFunction("Blue", Sub, (Action)delegate { Minimap.NvgColor = Nvg.ColorMode.Blue; }); _nvgColorPage.CreateFunction("Amber", Sub, (Action)delegate { Minimap.NvgColor = Nvg.ColorMode.Amber; }); } else { if (_nvgEnableOption != null) { _rootPage.Remove(_nvgEnableOption); _nvgEnableOption = null; } if (_nvgColorPage != null) { _rootPage.RemovePage(_nvgColorPage); _nvgColorPage = null; } if (Minimap.NvgEnabled) { Minimap.NvgEnabled = false; } } } private static void PickClass(ClassDef cls) { if (LockedClass != null) { BootAudio.Play("error"); Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: class locked as " + LockedClass + " - rejoin the server to pick again."); } return; } if (Teams.PlayerTeam != Faction.None) { bool flag = cls.Faction == "RASONIA"; if ((Teams.PlayerTeam == Faction.Rasonia && !flag) || (Teams.PlayerTeam == Faction.Menlo && flag)) { BootAudio.Play("error"); Main instance2 = Main.Instance; if (instance2 != null) { ((MelonBase)instance2).LoggerInstance.Warning("Examination: " + cls.Faction + " classes are locked - you are on team " + Teams.Name(Teams.PlayerTeam) + "."); } return; } } LockedClass = cls.Id; BootAudio.Play("select"); ClassApplier.Apply(cls); } public static void RefreshSections() { //IL_0084: 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) if (_classPage == null) { return; } try { if (_rasoniaSection != null) { _classPage.RemovePage(_rasoniaSection); _rasoniaSection = null; } if (_menloSection != null) { _classPage.RemovePage(_menloSection); _menloSection = null; } } catch { } if (Teams.PlayerTeam != Faction.Menlo) { _rasoniaSection = BuildSection(_classPage, "RASONIAN FORCES", "RASONIA", Rasonia); } if (Teams.PlayerTeam != Faction.Rasonia) { _menloSection = BuildSection(_classPage, "MENLONIAN FORCES", "MENLO", Menlo); } } public static void Build() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) Page val = Page.Root.CreatePage("Examination", Accent, 7, true); _classPage = val.CreatePage("Class Selection", Sub, 6, true); RefreshSections(); Page val2 = val.CreatePage("Team", new Color(0.55f, 0.55f, 0.55f, 1f), 7, true); val2.CreateFunction("Join RASONIAN FORCES", Rasonia, (Action)Teams.JoinRasonia); val2.CreateFunction("Join MENLONIAN FORCES", Menlo, (Action)Teams.JoinMenlo); val2.CreateFunction("Leave Team", Sub, (Action)Teams.Leave); FunctionElement val3 = val2.CreateFunction("Assign Nearest NPC: RASONIA", Rasonia, (Action)Teams.AssignGrabbedRasonia); ((Element)val3).SetTooltip("Assigns the NPC nearest to you. The name is remembered."); FunctionElement val4 = val2.CreateFunction("Assign Nearest NPC: MENLO", Menlo, (Action)Teams.AssignGrabbedMenlo); ((Element)val4).SetTooltip("Assigns the NPC nearest to you. The name is remembered."); val2.CreateFunction("Clear Nearest NPC", Sub, (Action)Teams.ClearGrabbed); Page val5 = val2.CreatePage("Assign NPC Class", Sub, 8, true); for (int i = 0; i < Data.Classes.Count; i++) { ClassDef classDef = Data.Classes[i]; string id = classDef.Id; Color val6 = ((classDef.Faction == "RASONIA") ? Rasonia : Menlo); FunctionElement val7 = val5.CreateFunction(classDef.Name, val6, (Action)delegate { Teams.AssignNearestClass(id); }); ((Element)val7).SetTooltip(string.IsNullOrEmpty(classDef.Tag) ? "Assigns this class to the nearest NPC (no nametag yet)." : ("Assigns this class to the nearest NPC; their nametag shows [" + classDef.Tag + "].")); } val.CreateBool("Minimap", Sub, Minimap.Enabled, (Action<bool>)delegate(bool value) { Minimap.Enabled = value; }); Page val8 = val.CreatePage("Attachment", Sub, 7, true); val8.CreateFunction("Wrist", Sub, (Action)delegate { Minimap.Anchor = Minimap.MapAnchor.Wrist; }); val8.CreateFunction("Unit-Styled", Sub, (Action)delegate { Minimap.Anchor = Minimap.MapAnchor.UnitStyled; }); val.CreateFloat("Radar Range", Sub, Minimap.RadarMetres, 10f, 30f, 300f, (Action<float>)delegate(float value) { Minimap.RadarMetres = value; }); _rootPage = val; FunctionElement val9 = val.CreateFunction("ACTIVATE MAPPING HUD.", Sub, (Action)Minimap.RenderMap); ((Element)val9).SetTooltip("Powers on the minimap: snapshots the current level and plays the boot sequence."); try { Hooking.OnLevelLoaded += delegate { LockedClass = null; }; } catch { } } private static Page BuildSection(Page parent, string title, string faction, Color color) { //IL_0010: 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_00c1: Unknown result type (might be due to invalid IL or missing references) Page val = parent.CreatePage(title, color, 8, true); bool flag = false; for (int i = 0; i < Data.Classes.Count; i++) { ClassDef cls = Data.Classes[i]; if (!(cls.Faction != faction)) { FunctionElement val2 = val.CreateFunction(cls.Name, Sub, (Action)delegate { PickClass(cls); }); ((Element)val2).SetTooltip(TooltipOf(cls)); flag = true; } } if (!flag) { FunctionElement val3 = val.CreateFunction("NO CLASSES DEPLOYED", Sub, (Action)delegate { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Msg("Examination: no " + faction + " classes in classes.json yet."); } }); ((Element)val3).SetTooltip("Add classes to UserData/Examination/classes.json with \"Faction\": \"" + faction + "\"."); } return val; } private static string TooltipOf(ClassDef cls) { string text = string.Empty; if (!string.IsNullOrEmpty(cls.Primary)) { text = text + "\nPRIMARY (back): " + cls.Primary; } if (!string.IsNullOrEmpty(cls.Secondary)) { text = text + "\nSECONDARY (front): " + cls.Secondary; } if (!string.IsNullOrEmpty(cls.Avatar)) { text = text + "\nAVATAR: " + cls.Avatar; } return (string.IsNullOrEmpty(cls.Description) ? cls.Name : cls.Description) + text; } } public static class Crates { private static readonly Dictionary<string, AvatarCrate> _avatars = new Dictionary<string, AvatarCrate>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, SpawnableCrate> _spawnables = new Dictionary<string, SpawnableCrate>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, AvatarCrate> _avatarCache = new Dictionary<string, AvatarCrate>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, SpawnableCrate> _spawnCache = new Dictionary<string, SpawnableCrate>(StringComparer.OrdinalIgnoreCase); private static bool _subscribed; private static bool _scanned; private static bool _hotLoadTried; public static void Ensure() { if (_subscribed) { return; } _subscribed = true; try { Action<Barcode> action = OnCrateAdded; Action<Barcode> onCrateAdded = Action<Barcode>.op_Implicit(action); AssetWarehouse.Instance.OnCrateAdded = onCrateAdded; } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: warehouse event subscription failed: " + ex.Message); } } } private static void OnCrateAdded(Barcode barcode) { try { AssetWarehouse instance = AssetWarehouse.Instance; AvatarCrate val = default(AvatarCrate); if (instance.TryGetCrate<AvatarCrate>(barcode, ref val) && (Object)(object)val != (Object)null) { _avatars[Title((Crate)(object)val)] = val; } SpawnableCrate val2 = default(SpawnableCrate); if (instance.TryGetCrate<SpawnableCrate>(barcode, ref val2) && (Object)(object)val2 != (Object)null) { _spawnables[Title((Crate)(object)val2)] = val2; } } catch { } } private static void ScanOnce() { if (!_subscribed) { Ensure(); } if (_scanned) { return; } _scanned = true; try { List<Crate> crates = AssetWarehouse.Instance.GetCrates(); for (int i = 0; i < crates.Count; i++) { Crate obj = crates[i]; AvatarCrate val = (AvatarCrate)(object)((obj is AvatarCrate) ? obj : null); if (val != null) { _avatars[Title((Crate)(object)val)] = val; continue; } Crate obj2 = crates[i]; SpawnableCrate val2 = (SpawnableCrate)(object)((obj2 is SpawnableCrate) ? obj2 : null); if (val2 != null) { _spawnables[Title((Crate)(object)val2)] = val2; } } } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: warehouse scan failed: " + ex.Message); } } } public static AvatarCrate FindAvatar(string match) { if (_avatarCache.TryGetValue(match ?? "", out var value) && (Object)(object)value != (Object)null) { return value; } ScanOnce(); string text = PalletIndex.FindAvatarBarcode(match); if (text != null) { AvatarCrate val = TryGetAvatar(text); if ((Object)(object)val != (Object)null) { _avatarCache[match] = val; return val; } } PalletIndex.Scan(); text = PalletIndex.FindAvatarBarcode(match); if (text != null) { AvatarCrate val2 = TryGetAvatar(text); if ((Object)(object)val2 != (Object)null) { _avatarCache[match] = val2; return val2; } } AvatarCrate val3 = FindIn(_avatars, match); if ((Object)(object)val3 == (Object)null) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: no avatar matches \"" + match + "\" on disk or in memory. Is the pack installed? (Pallet index: " + PalletIndex.FindAvatarBarcode(match) + ")"); } } else { _avatarCache[match] = val3; } return val3; } public static SpawnableCrate FindSpawnable(string match) { if (_spawnCache.TryGetValue(match ?? "", out var value) && (Object)(object)value != (Object)null) { return value; } ScanOnce(); string text = PalletIndex.FindSpawnableBarcode(match); if (text != null) { SpawnableCrate val = TryGetSpawnable(text); if ((Object)(object)val != (Object)null) { _spawnCache[match] = val; return val; } } PalletIndex.Scan(); text = PalletIndex.FindSpawnableBarcode(match); if (text != null) { SpawnableCrate val2 = TryGetSpawnable(text); if ((Object)(object)val2 != (Object)null) { _spawnCache[match] = val2; return val2; } } SpawnableCrate val3 = FindIn(_spawnables, match); if ((Object)(object)val3 == (Object)null) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: no spawnable matches \"" + match + "\" on disk or in memory. Is the pack installed?"); } } else { _spawnCache[match] = val3; } return val3; } public static void DumpLoaded() { PalletIndex.Scan(); PalletIndex.Dump(); } private static AvatarCrate TryGetAvatar(string barcode) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown try { AvatarCrate val = default(AvatarCrate); if (AssetWarehouse.Instance.TryGetCrate<AvatarCrate>(new Barcode(barcode), ref val) && (Object)(object)val != (Object)null) { return val; } } catch { } return null; } private static SpawnableCrate TryGetSpawnable(string barcode) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown try { SpawnableCrate val = default(SpawnableCrate); if (AssetWarehouse.Instance.TryGetCrate<SpawnableCrate>(new Barcode(barcode), ref val) && (Object)(object)val != (Object)null) { return val; } } catch { } return null; } private static void HotLoadPallets() { if (_hotLoadTried) { return; } _hotLoadTried = true; try { AssetWarehouse.Instance.LoadPalletsFromModsFolder(); Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Msg("Examination: hot-loaded pallets from the Mods folder."); } } catch (Exception ex) { Main instance2 = Main.Instance; if (instance2 != null) { ((MelonBase)instance2).LoggerInstance.Warning("Examination: hot pallet load failed: " + ex.Message); } } } public static void Tick() { if (_hotLoadTried) { return; } try { if (AssetWarehouse.Instance != null && !HelperMethods.IsLoading()) { HotLoadPallets(); } } catch { } } private static T FindIn<T>(Dictionary<string, T> map, string match) where T : class { if (string.IsNullOrEmpty(match)) { return null; } if (map.TryGetValue(match, out var value)) { return value; } string text = PalletIndex.Plain(match); if (!string.IsNullOrEmpty(text) && map.TryGetValue(text, out value)) { return value; } foreach (KeyValuePair<string, T> item in map) { string text2 = PalletIndex.Plain(item.Key); if (string.IsNullOrEmpty(text2) || (!text2.Contains(text, StringComparison.OrdinalIgnoreCase) && !text2.Contains(match, StringComparison.OrdinalIgnoreCase))) { continue; } return item.Value; } return null; } private static string Title(Crate crate) { try { return ((Scannable)crate).Title ?? string.Empty; } catch { return string.Empty; } } } public class ClassDef { public string Id { get; set; } = string.Empty; public string Faction { get; set; } = "MENLO"; public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Tier { get; set; } = "standard"; public string RankRequired { get; set; } public string Avatar { get; set; } public string Primary { get; set; } public string Secondary { get; set; } public string PrimaryHolster { get; set; } = "back"; public string Item1 { get; set; } public string Item2 { get; set; } public string Tag { get; set; } public string TagColor { get; set; } } public class RankDef { public string Id { get; set; } = string.Empty; public int Badges { get; set; } public string Sidearm { get; set; } public string NameTag { get; set; } = string.Empty; } public static class Data { public static List<ClassDef> Classes { get; private set; } = new List<ClassDef>(); public static List<RankDef> Ranks { get; private set; } = new List<RankDef>(); public static string Dir => Path.Combine(MelonEnvironment.UserDataDirectory, "Examination"); public static void Load() { try { Directory.CreateDirectory(Dir); Seed(); Classes = Read<List<ClassDef>>("classes.json") ?? new List<ClassDef>(); Ranks = Read<List<RankDef>>("ranks.json") ?? new List<RankDef>(); bool patched = false; PatchTag("rif_infantryman", "R.I.F", "#F72828"); PatchTag("rif_medic", "R.I.F - M", "#DB8181"); PatchTag("rif_arrowhead", "R.I.F - A", "#BD2626"); PatchTag("rif_shotgunner", "R.I.F - S", "#FF0000"); PatchTag("mgf_standard", "M.G.F", "#00FF4C"); PatchTag("mgf_breacher", "M.G.F - B", "#07AB38"); PatchTag("mgf_medic", "M.G.F - M", "#6DC789"); PatchTag("mgf_enforcer", "M.G.F - E", "#38E8D3"); if (patched) { try { File.WriteAllText(Path.Combine(Dir, "classes.json"), JsonSerializer.Serialize(Classes, new JsonSerializerOptions { WriteIndented = true })); Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Msg("Examination data: patched classes.json with class tags."); } } catch (Exception ex) { Main instance2 = Main.Instance; if (instance2 != null) { ((MelonBase)instance2).LoggerInstance.Warning("Examination data: tag patch failed: " + ex.Message); } } } Main instance3 = Main.Instance; if (instance3 != null) { ((MelonBase)instance3).LoggerInstance.Msg("Examination data: " + Classes.Count + " classes, " + Ranks.Count + " ranks."); } void PatchTag(string id, string tag, string color) { for (int i = 0; i < Classes.Count; i++) { if (Classes[i].Id == id && (Classes[i].Tag != tag || Classes[i].TagColor != color)) { Classes[i].Tag = tag; Classes[i].TagColor = color; patched = true; } } } } catch (Exception ex2) { Main instance4 = Main.Instance; if (instance4 != null) { ((MelonBase)instance4).LoggerInstance.Error("Examination data load failed: " + ex2.Message); } } } public static void ReloadClasses() { Classes = Read<List<ClassDef>>("classes.json") ?? new List<ClassDef>(); Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Msg("Examination classes reloaded: " + Classes.Count); } } private static T Read<T>(string file) where T : class { string path = Path.Combine(Dir, file); if (!File.Exists(path)) { return null; } return JsonSerializer.Deserialize<T>(File.ReadAllText(path)); } private static void WriteIfMissing(string file, string content) { string path = Path.Combine(Dir, file); if (!File.Exists(path)) { File.WriteAllText(path, content); } } private static void Seed() { WriteIfMissing("ranks.json", "[\n { \"Id\": \"CONSCRIPT\", \"Badges\": 0, \"Sidearm\": null, \"NameTag\": \"CST\" },\n { \"Id\": \"PVT\", \"Badges\": 1, \"Sidearm\": null, \"NameTag\": \"PVT\" },\n { \"Id\": \"SPEC\", \"Badges\": 3, \"Sidearm\": null, \"NameTag\": \"SPEC\" },\n { \"Id\": \"CPL\", \"Badges\": 4, \"Sidearm\": null, \"NameTag\": \"CPL\" },\n { \"Id\": \"SGT\", \"Badges\": 5, \"Sidearm\": \"LOCK-17 (F)\", \"NameTag\": \"SGT\" },\n { \"Id\": \"SSGT\", \"Badges\": 6, \"Sidearm\": null, \"NameTag\": \"SSGT\" },\n { \"Id\": \"FA\", \"Badges\": 8, \"Sidearm\": null, \"NameTag\": \"FA\" },\n { \"Id\": \"FO\", \"Badges\": 9, \"Sidearm\": null, \"NameTag\": \"FO\" },\n { \"Id\": \"FS\", \"Badges\": 10, \"Sidearm\": null, \"NameTag\": \"FS\" },\n { \"Id\": \"OFC\", \"Badges\": 11, \"Sidearm\": \"AOP-9\", \"NameTag\": \"OFC\" },\n { \"Id\": \"XFC\", \"Badges\": 12, \"Sidearm\": null, \"NameTag\": \"XFC\" },\n { \"Id\": \"LT\", \"Badges\": 13, \"Sidearm\": null, \"NameTag\": \"LT\" }\n]"); WriteIfMissing("classes.json", "[\n {\n \"Id\": \"rif_infantryman\",\n \"Faction\": \"RASONIA\",\n \"Name\": \"☬┊CLASS #1 — RIF INFANTRYMAN\",\n \"Description\": \"Standard Rasonian infantry. Reliable, aggressive, and everywhere at once.\",\n \"Tier\": \"standard\",\n \"Avatar\": \"(S) Soldier A\",\n \"Primary\": \"<color=#b80000>AK-47\",\n \"Secondary\": \"<color=#b80000>MK23\",\n \"Tag\": \"R.I.F\",\n \"TagColor\": \"#F72828\"\n },\n {\n \"Id\": \"rif_medic\",\n \"Faction\": \"RASONIA\",\n \"Name\": \"☬┊CLASS #2 — RIF MEDIC\",\n \"Description\": \"Keeps the squad alive under fire.\",\n \"Tier\": \"standard\",\n \"Avatar\": \"(GD) Mortician Royal\",\n \"Secondary\": \"<color=#b80000>MK23\",\n \"Item1\": \"<color=#ff3100>Auto Injector\",\n \"Tag\": \"R.I.F - M\",\n \"TagColor\": \"#DB8181\"\n },\n {\n \"Id\": \"rif_arrowhead\",\n \"Faction\": \"RASONIA\",\n \"Name\": \"☬┊CLASS #3 — RIF ARROWHEAD\",\n \"Description\": \"The RIF's long-range specialists and secondary stealth units. They support Infantrymen by providing overwatch and engaging distant threats. Patience, accuracy, and coordination.\",\n \"Tier\": \"standard\",\n \"Avatar\": \"(GD) Shocktrooper Royal\",\n \"Primary\": \"<color=#b80000>Lee-Enfield No.1 Mk III\",\n \"Secondary\": \"<color=#b80000>MK23\",\n \"Tag\": \"R.I.F - A\",\n \"TagColor\": \"#BD2626\"\n },\n {\n \"Id\": \"rif_shotgunner\",\n \"Faction\": \"RASONIA\",\n \"Name\": \"☬┊CLASS #4 — RIF SHOTGUNNER\",\n \"Description\": \"Breaching specialists. The shotgun does the talking.\",\n \"Tier\": \"standard\",\n \"Avatar\": \"(GD) Rook Royal\",\n \"Primary\": \"<color=#b80000>Remington 870\",\n \"PrimaryHolster\": \"front\",\n \"Secondary\": \"<color=#b80000>MK23\",\n \"Tag\": \"R.I.F - S\",\n \"TagColor\": \"#FF0000\"\n },\n {\n \"Id\": \"mgf_standard\",\n \"Faction\": \"MENLO\",\n \"Name\": \"☬┊CLASS #1 — MGF STANDARD\",\n \"Description\": \"Menlonian Ground Forces rifleman, standard issue.\",\n \"Tier\": \"standard\",\n \"Avatar\": \"(S) Olive B\",\n \"Primary\": \"<color=#b80000>MP5A2\",\n \"PrimaryHolster\": \"front\",\n \"Secondary\": \"<color=#b80000>M1911A1\",\n \"Tag\": \"M.G.F\",\n \"TagColor\": \"#00FF4C\"\n },\n {\n \"Id\": \"mgf_breacher\",\n \"Faction\": \"MENLO\",\n \"Name\": \"☬┊CLASS #2 — MGF BREACHER\",\n \"Description\": \"First through the door. Loud, fast, decisive.\",\n \"Tier\": \"standard\",\n \"Avatar\": \"(S) Olive A\",\n \"Primary\": \"<color=#b80000>Model 80\",\n \"PrimaryHolster\": \"front\",\n \"Secondary\": \"<color=#b80000>M1911A1\",\n \"Tag\": \"M.G.F - B\",\n \"TagColor\": \"#07AB38\"\n },\n {\n \"Id\": \"mgf_medic\",\n \"Faction\": \"MENLO\",\n \"Name\": \"☬┊CLASS #3 — MGF MEDIC\",\n \"Description\": \"Combat medic. Keeps the push moving.\",\n \"Tier\": \"standard\",\n \"Avatar\": \"(S) Nameless G\",\n \"Secondary\": \"<color=#b80000>P345\",\n \"Item1\": \"<color=#ff3100>Auto Injector\",\n \"Tag\": \"M.G.F - M\",\n \"TagColor\": \"#6DC789\"\n },\n {\n \"Id\": \"mgf_enforcer\",\n \"Faction\": \"MENLO\",\n \"Name\": \"☬┊CLASS #4 — MGF ENFORCER\",\n \"Description\": \"Heavy armour, heavier firepower. The Enforcer holds the line.\",\n \"Tier\": \"standard\",\n \"Avatar\": \"(S) Blue B\",\n \"Primary\": \"<color=#00ffffff>R870\",\n \"PrimaryHolster\": \"front\",\n \"Secondary\": \"<color=yellow>M6C/SOCOM Pistol\",\n \"Item2\": \"GIGN Shield\",\n \"Tag\": \"M.G.F - E\",\n \"TagColor\": \"#38E8D3\"\n }\n]"); } } public static class FusionBridge { private static bool _probed; private static MethodInfo _init; private static MethodInfo _tick; private static MethodInfo _factionOf; private static MethodInfo _classOf; private static MethodInfo _spawnNetworked; private static MethodInfo _isPlayerRig; public static bool Available { get { Probe(); return _init != null; } } public static void Init() { Probe(); if (!(_init != null)) { return; } try { _init.Invoke(null, null); } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: fusion bridge init failed: " + ex.Message); } } } public static void Tick() { Probe(); if (!(_tick != null)) { return; } try { _tick.Invoke(null, new object[2] { (int)Teams.PlayerTeam, ClassSelection.LockedClass ?? "" }); } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: fusion bridge tick failed: " + ex.Message); } } } public static int FactionOf(GameObject rig) { Probe(); if (_factionOf == null || (Object)(object)rig == (Object)null) { return 0; } try { return (int)_factionOf.Invoke(null, new object[1] { rig }); } catch { return 0; } } public static string ClassOf(GameObject rig) { Probe(); if (_classOf == null || (Object)(object)rig == (Object)null) { return null; } try { return (string)_classOf.Invoke(null, new object[1] { rig }); } catch { return null; } } public static bool IsPlayerRig(GameObject rig) { Probe(); if (_isPlayerRig == null || (Object)(object)rig == (Object)null) { return false; } try { return (bool)_isPlayerRig.Invoke(null, new object[1] { rig }); } catch { return false; } } public static bool SpawnNetworked(string barcode, Vector3 position, Quaternion rotation) { //IL_003a: 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) Probe(); if (_spawnNetworked == null || string.IsNullOrEmpty(barcode)) { return false; } try { return (bool)_spawnNetworked.Invoke(null, new object[3] { barcode, position, rotation }); } catch { return false; } } private static void Probe() { if (_probed) { return; } _probed = true; try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (!(assembly.GetName().Name != "ExaminationFusion")) { Type type = assembly.GetType("Examination.FusionSync"); if (!(type == null)) { _init = type.GetMethod("Init", BindingFlags.Static | BindingFlags.Public); _tick = type.GetMethod("Tick", BindingFlags.Static | BindingFlags.Public); _factionOf = type.GetMethod("FactionOf", BindingFlags.Static | BindingFlags.Public); _classOf = type.GetMethod("ClassOf", BindingFlags.Static | BindingFlags.Public); _spawnNetworked = type.GetMethod("SpawnNetworked", BindingFlags.Static | BindingFlags.Public); _isPlayerRig = type.GetMethod("IsPlayerRig", BindingFlags.Static | BindingFlags.Public); } break; } } } catch { } } } public class Main : MelonMod { public static Main Instance { get; private set; } public override void OnInitializeMelon() { Instance = this; Data.Load(); Teams.Load(); Crates.Ensure(); ClassSelection.Build(); Minimap.Init(); FusionBridge.Init(); PalletIndex.Scan(); ((MelonBase)this).LoggerInstance.Msg("Examination ready. BoneMenu -> Examination -> Class Selection."); } public override void OnUpdate() { Minimap.Update(); Nametags.Update(); FusionBridge.Tick(); ClassApplier.Tick(); Crates.Tick(); } } public static class Minimap { private enum SnapStage { Idle, Bounds, Bake, Probe, Render, Pixels, Final } public enum MapAnchor { Wrist, UnitStyled } private enum BootPhase { Off, Activating, Activated, Fading, On } private struct BootLine { public string Text; public int Color; public BootLine(string text, int color) { Text = text; Color = color; } } private const float Unit = 0.0111f; private const float Design = 300f; private const float Edge = 150f; private const int Tex = 1024; private const int Coarse = 288; private const int BakePerFrame = 16384; private const int NavGrid = 64; private const float RevealR = 36f; private const float StampR = 42f; private const float PeekTime = 0.12f; private static GameObject _root; private static Transform _mapT; private static Transform _ticksT; private static Transform _arrowT; private static Transform _wedgeT; private static Mesh _letters; private static Transform _readoutT; private static Mesh _readoutMesh; private static string _lastReadout; private static float _nextReadout; private static Material _mapMat; private static Mesh _mapMesh; private static Vector2[] _planeBaseUv; private static Vector2[] _planeUv; private static readonly List<Material> _tinted = new List<Material>(); private static Texture2D _map; private static byte[] _explored; private static byte[] _snap; private static byte[] _walkable; private static Il2CppStructArray<Color32> _ilPixels; private static float[] _radial; private static Camera _eye; private static float _nextEye; private static Vector2 _worldCenter; private static float _worldHalf; private static float _peek = 1f; private static bool _built; private static bool _hooked; private static bool _mapReady; private static int _lastTx = int.MinValue; private static int _lastTz = int.MinValue; private static SnapStage _job = SnapStage.Idle; private static int _jobCursor; private static byte[] _jobCoarse; private static Vector3 _jobCenter; private static float _jobHalf; private static GameObject _jobCamGo; private static Camera _jobCam; private static RenderTexture _jobRt; private static bool _jobFlipU; private static bool _jobFlipV; private static bool _jobProbed; private static float _displayAz; private static float _scrollX; private static float _scrollZ; private static float _winX; private static float _winZ; private static float _uvScale = 1f; private static float _smoothScale = 1f; private static Vector3 _smoothPos; private static BootPhase _boot = BootPhase.Off; private static float _bootAt; private static Transform _bootScreenT; private static Material _bootScreenMat; private static Transform _bootTextT; private static Mesh _bootTextMesh; private static Material _bootTextMat; private static Transform _bootHeaderT; private static Mesh _bootHeaderMesh; private static Material _bootHeaderMat; private static Transform _bootLineT; private static Material _bootLineMat; private static string _bootTextShown; private static int _bootVisible = -1; private static BootLine[] _bootLines; private static int[] _lineTyped; private static float[] _lineNextAt; private static float[] _lineStartAt; private static int _bootLinesStarted; private static float _bootSoundAt; private static float _bootTypeAt; private static float _bootDoneAt; private static readonly List<GameObject> _npcs = new List<GameObject>(); private static readonly List<Transform> _npcMarkers = new List<Transform>(); private static readonly List<Transform> _npcArrows = new List<Transform>(); private static readonly List<Transform> _npcCones = new List<Transform>(); private static readonly List<Transform> _npcHeads = new List<Transform>(); private static readonly List<Vector3> _npcPrev = new List<Vector3>(); private static readonly List<float> _npcPrevT = new List<float>(); private static readonly List<AIBrain> _npcBrains = new List<AIBrain>(); private static readonly List<Transform> _npcSkulls = new List<Transform>(); private static readonly List<bool> _npcIsPlayer = new List<bool>(); private static float _nextNpcScan; private static readonly List<GameObject> _lootObjs = new List<GameObject>(); private static readonly List<Transform> _lootMarkers = new List<Transform>(); private static readonly List<Material> _lootMats = new List<Material>(); private static float _nextLootScan; private static GameObject _nvgGroup; private static MeshFilter _nvgStatusF; private static int _nvgStatusOn = -1; private static MeshFilter _nvgPctF; private static int _nvgPctShown = -1; private static Mesh _nvgBarsMesh; private static Color[] _nvgBarColors; private static float _nvgBlinkT; private static bool _nvgBlinkOn; private static float _nvgPct = 100f; private static float _nvgTickT; private static float _nvgCooldownUntil; private static bool _nvgRecharging; private static float _nvgRechargeAt; private static bool _nvgOn; private const string FontOrder = "0123456789[] ,-+"; private static readonly string[][] FontRows = new string[16][] { new string[7] { "01110", "10001", "10011", "10101", "11001", "10001", "01110" }, new string[7] { "00100", "01100", "00100", "00100", "00100", "00100", "01110" }, new string[7] { "01110", "10001", "00001", "00010", "00100", "01000", "11111" }, new string[7] { "11111", "00010", "00100", "00010", "00001", "10001", "01110" }, new string[7] { "00010", "00110", "01010", "10010", "11111", "00010", "00010" }, new string[7] { "11111", "10000", "11110", "00001", "00001", "10001", "01110" }, new string[7] { "00110", "01000", "10000", "11110", "10001", "10001", "01110" }, new string[7] { "11111", "00001", "00010", "00100", "01000", "01000", "01000" }, new string[7] { "01110", "10001", "10001", "01110", "10001", "10001", "01110" }, new string[7] { "01110", "10001", "10001", "01111", "00001", "00010", "01100" }, new string[7] { "00110", "00100", "00100", "00100", "00100", "00100", "00110" }, new string[7] { "01100", "00100", "00100", "00100", "00100", "00100", "01100" }, new string[7] { "00000", "00000", "00000", "00000", "00000", "00000", "00000" }, new string[7] { "00000", "00000", "00000", "00000", "00100", "00100", "01000" }, new string[7] { "00000", "00000", "00000", "11111", "00000", "00000", "00000" }, new string[7] { "00000", "00100", "00100", "11111", "00100", "00100", "00000" } }; internal const string BootOrder = "ABCDEFGHIKLMNOPRSTUVWXY0123456789[]-/>:%!,._ ╔═╗║╚╝"; internal static readonly string[][] BootRows = new string[51][] { new string[7] { "00100", "01010", "10001", "11111", "10001", "10001", "10001" }, new string[7] { "11110", "10001", "10001", "11110", "10001", "10001", "11110" }, new string[7] { "01111", "10000", "10000", "10000", "10000", "10000", "01111" }, new string[7] { "11110", "10001", "10001", "10001", "10001", "10001", "11110" }, new string[7] { "11111", "10000", "10000", "11110", "10000", "10000", "11111" }, new string[7] { "11111", "10000", "10000", "11110", "10000", "10000", "10000" }, new string[7] { "01111", "10000", "10000", "10111", "10001", "10001", "01111" }, new string[7] { "10001", "10001", "10001", "11111", "10001", "10001", "10001" }, new string[7] { "11111", "00100", "00100", "00100", "00100", "00100", "11111" }, new string[7] { "10001", "10010", "10100", "11000", "10100", "10010", "10001" }, new string[7] { "10000", "10000", "10000", "10000", "10000", "10000", "11111" }, new string[7] { "10001", "11011", "10101", "10101", "10001", "10001", "10001" }, new string[7] { "10001", "11001", "10101", "10011", "10001", "10001", "10001" }, new string[7] { "01110", "10001", "10001", "10001", "10001", "10001", "01110" }, new string[7] { "11110", "10001", "10001", "11110", "10000", "10000", "10000" }, new string[7] { "11110", "10001", "10001", "11110", "10100", "10010", "10001" }, new string[7] { "01111", "10000", "10000", "01110", "00001", "00001", "11110" }, new string[7] { "11111", "00100", "00100", "00100", "00100", "00100", "00100" }, new string[7] { "10001", "10001", "10001", "10001", "10001", "10001", "01110" }, new string[7] { "10001", "10001", "10001", "10001", "10001", "01010", "00100" }, new string[7] { "10001", "10001", "10001", "10101", "10101", "11011", "10001" }, new string[7] { "10001", "10001", "01010", "00100", "01010", "10001", "10001" }, new string[7] { "10001", "10001", "01010", "00100", "00100", "00100", "00100" }, new string[7] { "01110", "10001", "10001", "10001", "10001", "10001", "01110" }, new string[7] { "00100", "01100", "00100", "00100", "00100", "00100", "11111" }, new string[7] { "01110", "10001", "00001", "00110", "01000", "10000", "11111" }, new string[7] { "01110", "10001", "00001", "00110", "00001", "10001", "01110" }, new string[7] { "00010", "00110", "01010", "10010", "11111", "00010", "00010" }, new string[7] { "11111", "10000", "11110", "00001", "00001", "10001", "01110" }, new string[7] { "01110", "10000", "10000", "11110", "10001", "10001", "01110" }, new string[7] { "11111", "00001", "00010", "00100", "00100", "01000", "01000" }, new string[7] { "01110", "10001", "10001", "01110", "10001", "10001", "01110" }, new string[7] { "01110", "10001", "10001", "01111", "00001", "00001", "01110" }, new string[7] { "01110", "01000", "01000", "01000", "01000", "01000", "01110" }, new string[7] { "01110", "00010", "00010", "00010", "00010", "00010", "01110" }, new string[7] { "00000", "00000", "00000", "11111", "00000", "00000", "00000" }, new string[7] { "00001", "00010", "00010", "00100", "01000", "01000", "10000" }, new string[7] { "10000", "01000", "00100", "00010", "00100", "01000", "10000" }, new string[7] { "00000", "01100", "01100", "00000", "01100", "01100", "00000" }, new string[7] { "11001", "11001", "00010", "00100", "01000", "10011", "10011" }, new string[7] { "00100", "00100", "00100", "00100", "00100", "00000", "00100" }, new string[7] { "00000", "00000", "00000", "00000", "00100", "00100", "01000" }, new string[7] { "00000", "00000", "00000", "00000", "00000", "01100", "01100" }, new string[7] { "00000", "00000", "00000", "00000", "00000", "00000", "11111" }, new string[7] { "00000", "00000", "00000", "00000", "00000", "00000", "00000" }, new string[7] { "00111", "00100", "00100", "00100", "00100", "00100", "00100" }, new string[7] { "00000", "00000", "11111", "00000", "00000", "00000", "00000" }, new string[7] { "11100", "00100", "00100", "00100", "00100", "00100", "00100" }, new string[7] { "00100", "00100", "00100", "00100", "00100", "00100", "00100" }, new string[7] { "00100", "00100", "00100", "00100", "00100", "00100", "00111" }, new string[7] { "00100", "00100", "00100", "00100", "00100", "00100", "11100" } }; private static readonly BootLine[][] BootScripts = new BootLine[7][] { new BootLine[17] { new BootLine("[EXAMWORKS]", 0), new BootLine("", 0), new BootLine("[BOOT] INITIALIZING...", 0), new BootLine("[ OK ] MEMORY BANKS SYNCED", 0), new BootLine("[ OK ] SENSOR ARRAY READY", 0), new BootLine("[ OK ] ENVIRO FILTERS...", 0), new BootLine("[ OK ] AIR: ACCEPTABLE", 0), new BootLine("[ OK ] MAPPING TERRAIN...", 0), new BootLine("[ OK ] TERRAIN SCANNED", 0), new BootLine("[WARN] STAY SHARP, SOLDIER", 2), new BootLine("[ ??? ] TARGET SIGNATURE", 3), new BootLine("[ OK ] SIGNATURE ADDED", 0), new BootLine("[INFO] MOTION TRACKER...", 0), new BootLine("[ OK ] TRACKER ONLINE", 4), new BootLine("", 0), new BootLine("> SYSTEM READY", 0), new BootLine("> LETS GET TO WORK", 0) }, new BootLine[17] { new BootLine("[EXAMWORKS]", 0), new BootLine("", 0), new BootLine("[BOOT] POWERING FIELD HUD", 0), new BootLine("[ OK ] MEMORY BANKS SYNCED", 0), new BootLine("[ OK ] SENSORS RESPONDING", 0), new BootLine("[ OK ] SUIT INTEGRITY OK", 0), new BootLine("[ OK ] ARMOR: STABLE", 0), new BootLine("[ OK ] SCANNING TERRAIN", 0), new BootLine("[ OK ] MAP DATA RECEIVED", 0), new BootLine("[WARN] STAY SHARP, SOLDIER", 0), new BootLine("[ ??? ] SEARCHING HOSTILES", 3), new BootLine("[ OK ] TARGET SIGNATURE", 0), new BootLine("[INFO] MOTION TRACKER...", 5), new BootLine("[ OK ] TRACKER ONLINE", 4), new BootLine("", 0), new BootLine("> SYSTEM READY", 0), new BootLine("> CLEARED TO MOVE", 0) }, new BootLine[16] { new BootLine("[EXAMWORKS]", 0), new BootLine("", 0), new BootLine("[BOOT] EXPLORATION MODE", 0), new BootLine("[ OK ] NAV MODULE ONLINE", 0), new BootLine("[ OK ] SENSORS ACTIVE", 5), new BootLine("[ OK ] CHECKING AIR...", 0), new BootLine("[ OK ] AIR: BREATHABLE", 0), new BootLine("[ OK ] MAPPING AREA...", 0), new BootLine("[ OK ] TERRAIN SCANNED", 0), new BootLine("[WARN] UNCHARTED REGION", 0), new BootLine("[ ??? ] UNKNOWN STRUCTURES", 3), new BootLine("[INFO] NO MATCHING RECORDS", 2), new BootLine("[ OK ] LOCATIONS MAPPED", 4), new BootLine("", 0), new BootLine("> SYSTEM READY", 0), new BootLine("> WATCH YOUR STEP", 0) }, new BootLine[14] { new BootLine("[EXAMWORKS]", 0), new BootLine("", 0), new BootLine("[BOOT] COMMS UPLINK...", 0), new BootLine("[ OK ] ENCRYPTION: SECURE", 0), new BootLine("[ OK ] SATELLITE LOCK", 5), new BootLine("[ ] SYNCING NAV GRID", 0), new BootLine("[ OK ] NAV GRID: SYNCED", 0), new BootLine("[WARN] JAMMING DETECTED", 2), new BootLine("[ ??? ] TRACING SIGNAL...", 3), new BootLine("[INFO] SIGNAL: LOCAL", 0), new BootLine("[ OK ] COMMS: GREEN", 4), new BootLine("", 0), new BootLine("> UPLINK STABLE", 0), new BootLine("> KEEP YOUR HEAD DOWN", 0) }, new BootLine[14] { new BootLine("[EXAMWORKS]", 0), new BootLine("", 0), new BootLine("[BOOT] ARMORY CHECK...", 0), new BootLine("[ OK ] MAGAZINES: LOADED", 0), new BootLine("[ OK ] AMMO SUPPLY: FULL", 0), new BootLine("[ OK ] WEAPON RACKS LOCKED", 0), new BootLine("[WARN] UNACCOUNTED ROUNDS", 2), new BootLine("[ ??? ] TRACKING SERIAL...", 3), new BootLine("[ OK ] SERIAL: REGISTERED", 0), new BootLine("[INFO] AUDIT: COMPLETE", 5), new BootLine("[ OK ] ARMORY: SECURE", 4), new BootLine("", 0), new BootLine("> ALL ACCOUNTED FOR", 0), new BootLine("> LOCK AND LOAD", 0) }, new BootLine[14] { new BootLine("[EXAMWORKS]", 0), new BootLine("", 0), new BootLine("[BOOT] RECON DRONE LINK", 0), new BootLine("[ OK ] DRONE: AIRBORNE", 0), new BootLine("[ OK ] CAMERAS: LIVE", 5), new BootLine("[ OK ] FEED UPLINK: CLEAN", 0), new BootLine("[ ] SCANNING PERIMETER", 0), new BootLine("[WARN] MOTION IN SECTOR 4", 2), new BootLine("[ ??? ] IDENTIFYING TARGET", 3), new BootLine("[INFO] TARGET: UNKNOWN", 2), new BootLine("[ OK ] PERIMETER: HELD", 4), new BootLine("", 0), new BootLine("> RECON COMPLETE", 0), new BootLine("> EYES OPEN, OPERATOR", 0) }, new BootLine[13] { new BootLine("[EXAMWORKS]", 0), new BootLine("", 0), new BootLine("[BOOT] MEDBAY SYSTEMS...", 0), new BootLine("[ OK ] BLOOD TYPE: ON FILE", 0), new BootLine("[ OK ] STIM PACKS: FULL", 0), new BootLine("[ OK ] AUTO-INJECTORS READY", 0), new BootLine("[WARN] LOW MORPHINE STOCK", 2), new BootLine("[ ??? ] VITALS UNKNOWN...", 3), new BootLine("[INFO] MEDBAY: STANDBY", 5), new BootLine("[ OK ] TRAUMA KIT: PACKED", 4), new BootLine("", 0), new BootLine("> MEDICAL READY", 0), new BootLine("> DONT GET SHOT", 0) } }; public static bool SnapshotDone => _job == SnapStage.Idle && _mapReady; public static bool Enabled { get; set; } = true; public static bool DebugDump { get; set; } = false; public static MapAnchor Anchor { get; set; } = MapAnchor.Wrist; public static bool FogOfWar { get; set; } = false; public static float RadarMetres { get; set; } = 80f; public static bool NvgEnabled { get { return _nvgOn; } set { SetNvg(value); } } public static Nvg.ColorMode NvgColor { get { return Nvg.Mode; } set { Nvg.Mode = value; Nvg.ApplyTint(); } } public static bool MappingActive => (Object)(object)_root != (Object)null && _built && _boot != BootPhase.Off && _boot != BootPhase.Activating; public static void SetNvg(bool value) { if (value == _nvgOn) { return; } if (value && !MappingActive) { BootAudio.Play("error"); } else if (value && (_nvgRecharging || (_nvgCooldownUntil > 0f && Time.unscaledTime < _nvgCooldownUntil))) { BootAudio.Play("error"); } else if (Nvg.SetEnabled(value)) { _nvgOn = value; if (!value) { if (_nvgPct >= 100f) { _nvgCooldownUntil = 0f; _nvgRecharging = false; } else { _nvgCooldownUntil = Time.unscaledTime + 20f; _nvgRecharging = true; _nvgRechargeAt = Time.unscaledTime + 2.5f; } } BootAudio.Play(value ? "power_on" : "off"); } else { BootAudio.Play("error"); } } public static void Init() { if (_hooked) { return; } _hooked = true; try { Hooking.OnLevelLoaded += delegate { ResetForLevel(); }; } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: minimap level hook failed: " + ex.Message); } } } private static void ResetForLevel() { try { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _root = null; _built = false; if ((Object)(object)_map != (Object)null) { Object.Destroy((Object)(object)_map); } _map = null; _mapReady = false; } catch (Exception ex) { Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: level reset failed: " + ex.Message); } } if (_nvgOn) { Nvg.SetEnabled(value: false); _nvgOn = false; } BootAudio.Reset(); } public static void Update() { if (!Enabled) { Hide(); if (_nvgOn) { Nvg.SetEnabled(value: false); _nvgOn = false; } ClassSelection.SetNvgOption(available: false); } else if (!((Object)(object)LocalPlayer.RigManager == (Object)null) && !((Object)(object)LocalPlayer.Head == (Object)null)) { ClassSelection.SetNvgOption(MappingActive); Nvg.Tick(); RenderMapTick(); EnsureBuilt(); FollowAnchor(); EnsureMap(); if ((Object)(object)_root != (Object)null) { _root.SetActive(true); } Heading(); Fog(); Peek(); Scale(); Readout(); BootSequence(); NpcMarkers(); LootMarkers(); NvgBar(); } } private static void EnsureBuilt() { //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_0808: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Unknown result type (might be due to invalid IL or missing references) //IL_0891: Unknown result type (might be due to invalid IL or missing references) //IL_08bc: Unknown result type (might be due to invalid IL or missing references) //IL_08c1: Unknown result type (might be due to invalid IL or missing references) //IL_08cb: Unknown result type (might be due to invalid IL or missing references) //IL_08d0: Unknown result type (might be due to invalid IL or missing references) //IL_0906: Unknown result type (might be due to invalid IL or missing references) //IL_0945: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Unknown result type (might be due to invalid IL or missing references) //IL_0975: Unknown result type (might be due to invalid IL or missing references) //IL_097f: Unknown result type (might be due to invalid IL or missing references) //IL_0984: Unknown result type (might be due to invalid IL or missing references) if (_built && (Object)(object)_root != (Object)null) { return; } _built = false; if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); _root = null; } _tinted.Clear(); _mapT = null; _ticksT = null; _mapMat = null; _mapMesh = null; _planeBaseUv = null; _planeUv = null; _arrowT = null; _wedgeT = null; _readoutT = null; _readoutMesh = null; _lastReadout = null; _letters = null; _eye = null; _boot = BootPhase.Off; _bootScreenT = null; _bootScreenMat = null; _bootTextT = null; _bootTextMesh = null; _bootTextMat = null; _bootHeaderT = null; _bootHeaderMesh = null; _bootHeaderMat = null; _bootLineT = null; _bootLineMat = null; _bootTextShown = null; _bootVisible = -1; _bootLines = null; _lineTyped = null; _lineNextAt = null; _lineStartAt = null; _bootLinesStarted = 0; _bootSoundAt = 0f; _bootDoneAt = 0f; _npcs.Clear(); _npcMarkers.Clear(); _npcArrows.Clear(); _npcCones.Clear(); _npcHeads.Clear(); _npcPrev.Clear(); _npcPrevT.Clear(); _npcBrains.Clear(); _npcSkulls.Clear(); _npcIsPlayer.Clear(); _lootObjs.Clear(); _lootMarkers.Clear(); _lootMats.Clear(); _job = SnapStage.Idle; _jobCoarse = null; _jobCamGo = null; _jobCam = null; _jobRt = null; _nvgGroup = null; _nvgStatusF = null; _nvgStatusOn = -1; _nvgPctF = null; _nvgPctShown = -1; _nvgBarsMesh = null; _nvgBarColors = null; _nvgBlinkOn = false; _nvgPct = 100f; _nvgCooldownUntil = 0f; _nvgRecharging = false; _built = true; try { _root = new GameObject("[Examination] Minimap"); ((Object)_root).hideFlags = (HideFlags)61; Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Unlit/Transparent"); } if ((Object)(object)val == (Object)null) { _built = false; return; } _mapT = AddMesh(_root.transform, "MapPlane", val, out _mapMat); _mapMat.renderQueue = 3001; _tinted.Add(_mapMat); _mapMesh = ((Component)_mapT).GetComponent<MeshFilter>().mesh; Vector3[] array = (Vector3[])(object)new Vector3[49]; Vector2[] array2 = (Vector2[])(object)new Vector2[49]; int[] array3 = new int[144]; array[0] = Vector3.zero; array2[0] = new Vector2(0.5f, 0.5f); for (int i = 1; i <= 48; i++) { float num = (float)(i - 1) / 48f * (float)Math.PI * 2f; array[i] = new Vector3(Mathf.Sin(num) * 150f, Mathf.Cos(num) * 150f, 0f); array2[i] = new Vector2(0.5f - Mathf.Sin(num) * 0.5f, 0.5f - Mathf.Cos(num) * 0.5f); int num2 = (i - 1) * 3; int num3 = i % 48 + 1; array3[num2] = 0; array3[num2 + 1] = i; array3[num2 + 2] = num3; } _planeBaseUv = array2; _planeUv = (Vector2[])(object)new Vector2[array2.Length]; for (int j = 0; j < array2.Length; j++) { _planeUv[j] = array2[j]; } _mapMesh.vertices = Il2CppStructArray<Vector3>.op_Implicit(array); _mapMesh.uv = Il2CppStructArray<Vector2>.op_Implicit(array2); Color[] array4 = (Color[])(object)new Color[array.Length]; for (int k = 0; k < array.Length; k++) { array4[k] = Color.white; } _mapMesh.colors = Il2CppStructArray<Color>.op_Implicit(array4); _mapMesh.triangles = Il2CppStructArray<int>.op_Implicit(array3); _mapMesh.bounds = new Bounds(Vector3.zero, Vector3.one * 1000f); Material material; Transform val2 = AddMesh(_root.transform, "Vignette", val, out material); material.renderQueue = 3002; _tinted.Add(material); ((Component)val2).GetComponent<MeshFilter>().mesh = VignetteMesh(); _ticksT = AddMesh(_root.transform, "Ticks", val, out var material2); material2.renderQueue = 3010; _tinted.Add(material2); ((Component)_ticksT).GetComponent<MeshFilter>().mesh = TickMesh(); Material material3; Transform val3 = AddMesh(_root.transform, "Letters", val, out material3); material3.renderQueue = 3010; _tinted.Add(material3); material3.mainTexture = (Texture)(object)LetterAtlas(); _letters = ((Component)val3).GetComponent<MeshFilter>().mesh; BuildLetterQuads(); _readoutT = AddMesh(_root.transform, "Readout", val, out var material4); material4.renderQueue = 3010; _tinted.Add(material4); material4.mainTexture = (Texture)(object)BuildFontAtlas("0123456789[] ,-+", FontRows, 48, 0.85f, 0f); _readoutMesh = ((Component)_readoutT).GetComponent<MeshFilter>().mesh; _readoutT.localPosition = new Vector3(0f, -174f, -0.003f); BuildReadout("[+0, +0, 0]"); _arrowT = AddMesh(_root.transform, "Arrow", val, out var material5); material5.renderQueue = 3012; _tinted.Add(material5); ((Component)_arrowT).GetComponent<MeshFilter>().mesh = ArrowMesh(); _wedgeT = AddMesh(_root.transform, "Wedge", val, out var material6); material6.renderQueue = 3012; _tinted.Add(material6); _wedgeT.SetParent(_arrowT, false); _wedgeT.localPosition = Vector3.zero; ((Component)_wedgeT).GetComponent<MeshFilter>().mesh = WedgeMesh(); _bootScreenT = AddMesh(_root.transform, "BootScreen", val, out var material7); _bootScreenT.localPosition = new Vector3(0f, 0f, -0.006f); material7.renderQueue = 3020; material7.mainTexture = (Texture)(object)BootBackdrop(); material7.color = Color.white; _bootScreenMat = material7; ((Component)_bootScreenT).GetComponent<MeshFilter>().mesh = BootDiscMesh(); _bootLineT = AddMesh(_bootScreenT, "BootLine", val, out var material8); _bootLineT.localPosition = new Vector3(0f, 0f, -0.0015f); material8.renderQueue = 3025; material8.mainTexture = (Texture)(object)Texture2D.whiteTexture; material8.color = new Color(1f, 1f, 1f, 0f); _bootLineMat = material8; ((Component)_bootLineT).GetComponent<MeshFilter>().mesh = BootLineMesh(); _bootLineT.localScale = new Vector3(0.02f, 0.02f, 1f); _bootTextT = AddMesh(_bootScreenT, "BootText", val, out var material9); _bootTextT.localPosition = new Vector3(0f, 0f, -0.0025f); material9.renderQueue = 3025; material9.mainTexture = (Texture)(object)BuildFontAtlas("ABCDEFGHIKLMNOPRSTUVWXY0123456789[]-/>:%!,._ ╔═╗║╚╝", BootRows, 64, 2.4f, 1.05f, invert: true); material9.color = new Color(1f, 1f, 1f, 1f); _bootTextMat = material9; _bootTextMesh = ((Component)_bootTextT).GetComponent<MeshFilter>().mesh; _bootTextMesh.bounds = new Bounds(Vector3.zero, Vector3.one * 1000f); _bootHeaderT = AddMesh(_bootScreenT, "BootHeader", val, out var material10); _bootHeaderT.localPosition = new Vector3(0f, 62f, -0.0025f); material10.renderQueue = 3025; material10.mainTexture = (Texture)(object)BuildFontAtlas("ABCDEFGHIKLMNOPRSTUVWXY0123456789[]-/>:%!,._ ╔═╗║╚╝", BootRows, 64, 2.6f, 1.05f, invert: true); material10.color = Color.white; _bootHeaderMat = material10; _bootHeaderMesh = ((Component)_bootHeaderT).GetComponent<MeshFilter>().mesh; _bootHeaderMesh.bounds = new Bounds(Vector3.zero, Vector3.one * 1000f); StartTyping(new BootLine("MAPPING DISABLED.", 0)); BuildNvg(); _explored = new byte[1048576]; _snap = new byte[3145728]; _walkable = new byte[1048576]; _radial = new float[1048576]; } catch (Exception ex) { _built = false; Main instance = Main.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: minimap build failed: " + ex); } } } private static Transform AddMesh(Transform parent, string name, Shader shader, out Material material) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown GameObject val = new GameObject(name); ((Object)val).hideFlags = (HideFlags)61; val.transform.SetParent(parent, false); MeshFilter val2 = val.AddComponent<MeshFilter>(); MeshRenderer val3 = val.AddComponent<MeshRenderer>(); ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val3).receiveShadows = false; Mesh val4 = new Mesh(); ((Object)val4).name = name; ((Object)val4).hideFlags = (HideFlags)61; val4.bounds = new Bounds(Vector3.zero, Vector3.one * 1000f); val2.mesh = val4; material = new Material(shader); ((Object)material).hideFlags = (HideFlags)61; ((Renderer)val3).material = material; return val.transform; } private static Mesh VignetteMesh() { //IL_007c: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_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) List<Vector3> verts = new List<Vector3>(); List<Color> colors = new List<Color>(); List<int> tris = new List<int>(); for (int i = 0; i < 8; i++) { float num = (float)i / 8f; float num2 = (float)(i + 1) / 8f; float r = 93f + 57f * num; float r2 = 93f + 57f * num2; Band(r, r2, new Color(0f, 0f, 0f, (num + num2) * 0.5f)); } Band(148.5f, 149.6f, new Color(0.22f, 0.22f, 0.22f, 0.55f)); Mesh val = new Mesh(); ((Object)val).name = "MinimapVignette"; ((Object)val).hideFlags = (HideFlags)61; val.vertices = Il2CppStructArray<Vector3>.op_Implicit(verts.ToArray()); val.colors = Il2CppStructArray<Color>.op_Implicit(colors.ToArray()); val.triangles = Il2CppStructArray<int>.op_Implicit(tris.ToArray()); val.bounds = new Bounds(Vector3.zero, Vector3.one * 1000f); return val; void Band(float num4, float num5, Color color) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) int count = verts.Count; for (int j = 0; j <= 48; j++) { float num3 = (float)j / 48f * (float)Math.PI * 2f; verts.Add(new Vector3(Mathf.Sin(num3) * num4, Mathf.Cos(num3) * num4, 0f)); verts.Add(new Vector3(Mathf.Sin(num3) * num5, Mathf.Cos(num3) * num5, 0f)); colors.Add(color); colors.Add(color); } for (int k = 0; k < 48; k++) { int num6 = count + k * 2; tris.Add(num6); tris.Add(num6 + 2); tris.Add(num6 + 1); tris.Add(num6 + 2); tris.Add(num6 + 3); tris.Add(num6 + 1); } } } private static Mesh TickMesh() { //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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) Vector3[] array = (Vector3[])(object)new Vector3[96]; Color[] array2 = (Color[])(object)new Color[96]; int[] array3 = new int[144]; Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); Color val7 = default(Color); for (int i = 0; i < 24; i++) { float num = (float)i / 24f * (float)Math.PI * 2f; float num2 = ((i % 3 == 0) ? 9f : 5f); float num3 = 143f; ((Vector3)(ref val))..ctor(Mathf.Sin(num), Mathf.Cos(num), 0f); ((Vector3)(ref val2))..ctor(0f - val.y, val.x, 0f); Vector3 val3 = val * num3 - val2 * 0.7f; Vector3 val4 = val * num3 + val2 * 0.7f; Vector3 val5 = val * (num3 + num2) - val2 * 0.7f; Vector3 val6 = val * (num3 + num2) + val2 * 0.7f; int num4 = i * 4; array[num4] = val3; array[num4 + 1] = val4; array[num4 + 2] = val5; array[num4 + 3] = val6; ((Color)(ref val7))..ctor(1f, 1f, 1f, 0.3f); array2[num4] = val7; array2[num4 + 1] = val7; array2[num4 + 2] = val7; array2[num4 + 3] = val7; int num5 = i * 6; array3[num5] = num4; array3[num5 + 1] = num4 + 2; array3[num5 + 2] = num4 + 1; array3[num5 + 3] = num4 + 2; array3[num5 + 4] = num4 + 3; array3[num5 + 5] = num4 + 1; } Mesh val8 = new Mesh(); ((Object)val8).name = "MinimapTicks"; ((Object)val8).hideFlags = (HideFlags)61; val8.vertices = Il2CppStructArray<Vector3>.op_Implicit(array); val8.colors = Il2CppStructArray<Color>.op_Implicit(array2); val8.triangles = Il2CppStructArray<int>.op_Implicit(array3); val8.bounds = new Bounds(Vector3.zero, Vector3.one * 1000f); return val8; } private static void BuildLetterQuads() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[16]; Vector2[] array2 = (Vector2[])(object)new Vector2[16]; Color[] array3 = (Color[])(object)new Color[16]; int[] array4 = new int[24]; Color val = default(Color); ((Color)(ref val))..ctor(0.40392157f, 23f / 51f, 0.34509805f, 1f); float[] array5 = new float[4] { 0f, 90f, 180f, 270f }; Vector3 val2 = default(Vector3); for (int i = 0; i < 4; i++) { float num = array5[i] * ((float)Math.PI / 180f); ((Vector3)(ref val2))..ctor(Mathf.Sin(num) * 126f, Mathf.Cos(num) * 126f, 0.01f); int num2 = i * 4; array[num2] = val2 + new Vector3(-7f, -9.8f, -0.003f); array[num2 + 1] = val2 + new Vector3(7f, -9.8f, -0.003f); array[num2 + 2] = val2 + new Vector3(-7f, 9.8f, -0.003f); array[num2 + 3] = val2 + new Vector3(7f, 9.8f, -0.003f); float num3 = (float)i * 0.25f; array2[num2] = new Vector2(num3, 0f); array2[num2 + 1] = new Vector2(num3 + 0.25f, 0f); array2[num2 + 2] = new Vector2(num3, 1f); array2[num2 + 3] = new Vector2(num3 + 0.25f, 1f); array3[num2] = val; array3[num2 + 1] = val; array3[num2 + 2] = val; array3[num2 + 3] = val; int num4 = i * 6; array4[num4] = num2; array4[num4 + 1] = num2 + 2; array4[num4 + 2] = num2 + 1; array4[num4 + 3] = num2 + 2; array4[num4 + 4] = num2 + 3; array4[num4 + 5] = num2 + 1; } _letters.vertices = Il2CppStructArray<Vector3>.op_Implicit(array); _letters.uv = Il2CppStructArray<Vector2>.op_Implicit(array2); _letters.triangles = Il2CppStructArray<int>.op_Implicit(array4); _letters.colors = Il2CppStructArray<Color>.op_Implicit(array3); _letters.bounds = new Bounds(Vector3.zero, Vector3.one * 1000f); } private static Texture2D LetterAtlas() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(128, 32, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; Color32[] array = (Color32[])(object)new Color32[4096]; for (int i = 0; i < array.Length; i++) { array[i] = new Color32((byte)0, (byte)0, (byte)0, (byte)0); } DrawGlyph(array, 32, 0, "N"); DrawGlyph(array, 32, 1, "E"); DrawGlyph(array, 32, 2, "S"); DrawGlyph(array, 32, 3, "W"); val.SetPixels32(Il2CppStructArray<Color32>.op_Implicit(array)); val.Apply(false, false); return val; } private static void DrawGlyph(Color32[] px, int cell, int index, string letter) { //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } int[,] array = letter switch { "N" => new int[7, 5] { { 1, 0, 0, 0, 1 }, { 1, 1, 0, 0, 1 }, { 1, 0, 1, 0, 1 }, { 1, 0, 0, 1, 1 }, { 1, 0, 0, 0, 1 }, { 1, 0, 0, 0, 1 }, { 1, 0, 0, 0, 1 } }, "E" => new int[7, 5] { { 1, 1, 1, 1, 1 }, { 1, 0, 0, 0, 0 }, { 1, 1, 1, 1, 0 }, { 1, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1 } }, "S" => new int[7, 5] { { 0, 1, 1, 1, 1 }, { 1, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0 }, { 0, 1, 1, 1, 0 }, { 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 1 }, { 1, 1, 1, 1, 0 } }, _ => new int[7, 5] { { 1, 0, 0, 0, 1 }, { 1, 0, 0, 0, 1 }, { 1, 0, 0, 0, 1 }, { 1, 0, 1, 0, 1 }, { 1, 0, 1, 0, 1 }, { 1, 1, 0, 1, 1 }, { 1, 0, 0, 0, 1 } }, }; if (1 == 0) { } int[,] array2 = array; int num = (cell - 20) / 2; int num2 = (cell - 28) / 2; int num3 = index * cell; for (int i = 0; i < cell; i++) { for (int j = 0; j < cell; j++) { float num4 = ((float)(j - num) + 0.5f) / 4f; float num5 = ((float)(i - num2) + 0.5f) / 4f; float num6 = float.MaxValue; for (int k = 0; k < 7; k++) { for (int l = 0; l < 5; l++) { if (array2[k, l] == 1) { float num7 = num4 - ((float)l + 0.5f); float num8 = num5 - ((float)k + 0.5f); float num9 = num7 * num7 + num8 * num8; if (num9 < num6) { num6 = num9; } } } } float num10 = Mathf.Sqrt(num6); float num11 = ((num10 <= 0.55f) ? 1f : 0f); float num12 = Mathf.Clamp01(0.85f - num10); float num13 = Mathf.Max(num11, num12); if (num13 > 0.01f) { byte b = (byte)Mathf.Clamp((int)(num13 * 255f), 0, 255); px[i * cell * 4 + num3 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } } } private static Mesh ArrowMesh() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0034: 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_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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_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) Mesh val = new Mesh(); ((Object)val).name = "MinimapArrow"; ((Object)val).hideFlags = (HideFlags)61; val.vertices = Il2CppStructArray<Vector3>.op_Implicit((Vector3[])(object)new Vector3[3] { new Vector3(0f, 7f, 0f), new Vector3(-6.93f, -5f, 0f), new Vector3(6.93f, -5f, 0f) }); Color accent = Teams.Accent; val.colors = Il2CppStructArray<Color>.op_Implicit((Color[])(object)new Color[3] { accent, accent, accent }); val.triangles = Il2CppStructArray<int>.op_Implicit(new int[3] { 0, 1, 2 }); val.bounds = new Bounds(Vector3.zero, Vector3.one * 1000f); return val; } private static Mesh WedgeMesh() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0034: 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_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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c8: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) Mesh val = new Mesh(); ((Object)val).name = "MinimapWedge"; ((Object)val).hideFlags = (HideFlags)61; val.vertices = Il2CppStructArray<Vector3>.op_
Mods\ExaminationFusion.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Examination; using Il2CppSLZ.Marrow; using LabFusion.Entities; using LabFusion.Network; using LabFusion.Network.Serialization; using LabFusion.Player; using LabFusion.SDK.Modules; using MelonLoader; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(FusionMain), "ExaminationFusion", "1.0.0", "EXAMWORKS", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyVersion("0.0.0.0")] namespace Examination; public class FusionMain : MelonMod { public static FusionMain Instance { get; private set; } public override void OnInitializeMelon() { Instance = this; FusionSync.Init(); ((MelonBase)this).LoggerInstance.Msg("ExaminationFusion ready (LabFusion team/class sync)."); } } public static class FusionSync { private struct RemoteInfo { public int Faction; public string ClassId; } private static readonly Dictionary<byte, RemoteInfo> _players = new Dictionary<byte, RemoteInfo>(); private static float _nextBroadcast; private static string _lastSentKey = "\u0001"; private static MethodInfo _tryGetPlayer; private static PropertyInfo _rigRefsProp; private static PropertyInfo _rigManagerProp; private static PropertyInfo _hasRigProp; public static void Init() { try { ModuleManager.LoadModules(Assembly.GetExecutingAssembly()); } catch (Exception ex) { FusionMain instance = FusionMain.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: fusion module load failed: " + ex.Message); } } } public static void Tick(int faction, string classId) { try { if (NetworkInfo.HasServer) { string text = faction + "|" + classId; if (text != _lastSentKey || Time.unscaledTime >= _nextBroadcast) { _lastSentKey = text; _nextBroadcast = Time.unscaledTime + 3f; BroadcastLocal(faction, classId); } } } catch (Exception ex) { FusionMain instance = FusionMain.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: fusion sync tick failed: " + ex.Message); } } } public static int FactionOf(GameObject rig) { if ((Object)(object)rig == (Object)null) { return 0; } try { if (!NetworkInfo.HasServer) { return 0; } } catch { return 0; } return FactionOfInternal(rig); } public static string ClassOf(GameObject rig) { if ((Object)(object)rig == (Object)null) { return null; } try { if (!NetworkInfo.HasServer) { return null; } } catch { return null; } return ClassOfInternal(rig); } private static void BroadcastLocal(int faction, string classId) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) try { ExamPlayerInfoData examPlayerInfoData = new ExamPlayerInfoData { PlayerId = PlayerIDManager.LocalSmallID, Faction = (byte)faction, ClassId = (classId ?? "") }; MessageRelay.RelayModule<ExamPlayerInfoMessage, ExamPlayerInfoData>(examPlayerInfoData, CommonMessageRoutes.ReliableToServer); } catch (Exception ex) { FusionMain instance = FusionMain.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: fusion broadcast failed: " + ex.Message); } } } public static void ApplyRemote(byte smallId, int faction, string classId) { _players[smallId] = new RemoteInfo { Faction = faction, ClassId = (classId ?? "") }; } public static bool SpawnNetworked(string barcode, Vector3 position, Quaternion rotation) { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) try { PropertyInfo propertyInfo = typeof(NetworkInfo).Assembly.GetType("LabFusion.Scene.NetworkSceneManager")?.GetProperty("IsLevelNetworked", BindingFlags.Static | BindingFlags.Public); if (propertyInfo == null || !(bool)propertyInfo.GetValue(null)) { return false; } Assembly assembly = typeof(NetworkInfo).Assembly; object obj = (assembly.GetType("LabFusion.Marrow.Pool.LocalAssetSpawner")?.GetMethod("CreateSpawnable", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string) }, null))?.Invoke(null, new object[1] { barcode }); if (obj == null) { return false; } Type type = assembly.GetType("LabFusion.RPC.NetworkAssetSpawner"); Type type2 = type?.GetNestedType("SpawnRequestInfo", BindingFlags.Public); MethodInfo methodInfo = type?.GetMethod("Spawn", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { type2 }, null); if (type2 == null || methodInfo == null) { return false; } object obj2 = Activator.CreateInstance(type2); SetField(obj2, "Spawnable", obj); SetField(obj2, "Position", position); SetField(obj2, "Rotation", rotation); SetField(obj2, "SpawnEffect", true); FieldInfo field = type2.GetField("SpawnSource", BindingFlags.Instance | BindingFlags.Public); if (field != null && field.FieldType.IsEnum && Enum.IsDefined(field.FieldType, "Player")) { field.SetValue(obj2, Enum.Parse(field.FieldType, "Player")); } methodInfo.Invoke(null, new object[1] { obj2 }); return true; } catch (Exception ex) { FusionMain instance = FusionMain.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: networked spawn failed: " + ex.Message); } return false; } } public static bool IsPlayerRig(GameObject rig) { if ((Object)(object)rig == (Object)null) { return false; } try { if (!NetworkInfo.HasServer) { return false; } RigManager val = rig.GetComponentInParent<RigManager>(); if ((Object)(object)val == (Object)null) { val = rig.GetComponentInChildren<RigManager>(true); } return (Object)(object)val != (Object)null && NetworkPlayerManager.HasPlayer(val); } catch { return false; } } private static void SetField(object instance, string name, object value) { FieldInfo field = instance.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public); if (field != null) { field.SetValue(instance, value); } } private static int FactionOfInternal(GameObject rig) { foreach (KeyValuePair<byte, RemoteInfo> player in _players) { if (TryGetRig(player.Key, out var rigManager) && (Object)(object)rigManager != (Object)null && (Object)(object)((Component)rigManager).gameObject == (Object)(object)rig) { return player.Value.Faction; } } return 0; } private static string ClassOfInternal(GameObject rig) { foreach (KeyValuePair<byte, RemoteInfo> player in _players) { if (TryGetRig(player.Key, out var rigManager) && (Object)(object)rigManager != (Object)null && (Object)(object)((Component)rigManager).gameObject == (Object)(object)rig) { return string.IsNullOrEmpty(player.Value.ClassId) ? null : player.Value.ClassId; } } return null; } private static bool TryGetRig(byte smallId, out RigManager rigManager) { //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown rigManager = null; try { if (_tryGetPlayer == null) { MethodInfo[] methods = typeof(NetworkPlayerManager).GetMethods(); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name != "TryGetPlayer") { continue; } ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length != 2) { continue; } try { if (parameters[0].ParameterType == typeof(byte)) { _tryGetPlayer = methodInfo; break; } } catch { } } } if (_tryGetPlayer == null) { return false; } object[] array = new object[2] { smallId, null }; if (!(bool)_tryGetPlayer.Invoke(null, array) || array[1] == null) { return false; } object obj2 = array[1]; Type type = obj2.GetType(); if (_hasRigProp == null) { _hasRigProp = type.GetProperty("HasRig"); _rigRefsProp = type.GetProperty("RigRefs"); } if (_hasRigProp != null && !(bool)_hasRigProp.GetValue(obj2)) { return false; } object obj3 = ((_rigRefsProp != null) ? _rigRefsProp.GetValue(obj2) : null); if (obj3 == null) { return false; } if (_rigManagerProp == null) { _rigManagerProp = obj3.GetType().GetProperty("RigManager"); } object obj4 = ((_rigManagerProp != null) ? _rigManagerProp.GetValue(obj3) : null); if (obj4 == null) { return false; } rigManager = (RigManager)obj4; return true; } catch (Exception ex) { FusionMain instance = FusionMain.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: fusion rig lookup failed: " + ex.Message); } } return false; } } public class ExamPlayerInfoData : INetSerializable { public byte PlayerId; public byte Faction; public string ClassId; public int? GetSize() { return null; } public void Serialize(INetSerializer serializer) { serializer.SerializeValue(ref PlayerId); serializer.SerializeValue(ref Faction); serializer.SerializeValue(ref ClassId); } } public class ExamPlayerInfoMessage : ModuleMessageHandler { protected override void OnHandleMessage(ReceivedMessage received) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) ExamPlayerInfoData examPlayerInfoData = ((ReceivedMessage)(ref received)).ReadData<ExamPlayerInfoData>(); if (NetworkInfo.IsHost) { try { MessageRelay.RelayModule<ExamPlayerInfoMessage, ExamPlayerInfoData>(examPlayerInfoData, CommonMessageRoutes.ReliableToOtherClients); } catch (Exception ex) { FusionMain instance = FusionMain.Instance; if (instance != null) { ((MelonBase)instance).LoggerInstance.Warning("Examination: fusion relay failed: " + ex.Message); } } } FusionSync.ApplyRemote(examPlayerInfoData.PlayerId, examPlayerInfoData.Faction, examPlayerInfoData.ClassId); } } public class ExaminationFusionModule : Module { public override string Name => "Examination"; public override string Author => "EXAMWORKS"; public override Version Version => new Version(1, 0, 0); public override ConsoleColor Color => ConsoleColor.Magenta; protected override void OnModuleRegistered() { try { ModuleMessageManager.LoadHandlers(Assembly.GetExecutingAssembly()); ModuleLogger loggerInstance = ((Module)this).LoggerInstance; if (loggerInstance != null) { loggerInstance.Log("Examination team sync online.", ConsoleColor.White); } } catch (Exception ex) { ModuleLogger loggerInstance2 = ((Module)this).LoggerInstance; if (loggerInstance2 != null) { loggerInstance2.LogException("registering Examination module", ex); } } } protected override void OnModuleUnregistered() { } }