using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BrigadeModMenu; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using PinnedQuests; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Localization; using UnityEngine.Localization.Components; using UnityEngine.Localization.Settings; using UnityEngine.Localization.Tables; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(PinnedQuestsMod), "Pinned Quests", "1.0.0", "Pinned Quests", null)] [assembly: MelonGame("BoltBlasterGames", "TheSpellBrigade")] [assembly: MelonOptionalDependencies(new string[] { "BrigadeModMenu" })] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("PinnedQuests")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PinnedQuests")] [assembly: AssemblyTitle("PinnedQuests")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BrigadeModMenu { public static class ModMenuCompat { public static Page Entry(this Page page, MelonPreferences_Entry entry, Func label = null) { if (entry != null) { return page.Entry(entry.Raw, label ?? ((Func)(() => entry.DisplayName))); } return page; } public static Page Category(this Page page, MelonPreferences_Category category) { if (category == null) { return page; } Menu.HideCategory(category.Identifier); foreach (MelonPreferences_Entry e in category.Entries) { if (e != null && !e.IsHidden) { page.Entry(e.Raw, (Func)(() => e.DisplayName)); } } return page; } } } namespace PinnedQuests { internal sealed class Cards { private sealed class Card { public ChallengeId? Id; public string SampleText; public int SampleValue; public int SampleTarget; public GameObject Go; public TMP_Text Text; public TMP_Text Count; public RectTransform Fill; public Image Icon; public Image FillImage; public LayoutElement Info; } private const float IconSize = 112f; private static readonly Color Green = new Color(0.45f, 0.85f, 0.4f, 1f); public readonly RectTransform Root; private readonly List _cards = new List(); private string _built; private readonly GridLayoutGroup _grid; private static Sprite _style; private static string _styleKey; private static TMP_FontAsset _font; public int Count => _cards.Count; public Cards(Transform parent, string name) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00df: Unknown result type (might be due to invalid IL or missing references) Root = new GameObject(name).AddComponent(); ((Transform)Root).SetParent(parent, false); RectTransform root = Root; RectTransform root2 = Root; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(1f, 0.5f); root2.anchorMax = val; root.anchorMin = val; Root.pivot = new Vector2(1f, 1f); _grid = ((Component)Root).gameObject.AddComponent(); _grid.spacing = new Vector2(12f, 12f); _grid.startCorner = (Corner)1; _grid.startAxis = (Axis)0; ((LayoutGroup)_grid).childAlignment = (TextAnchor)2; ContentSizeFitter obj = ((Component)Root).gameObject.AddComponent(); FitMode horizontalFit = (FitMode)2; obj.verticalFit = (FitMode)2; obj.horizontalFit = horizontalFit; } public void Refresh(bool samplesIfEmpty) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (ChallengeId item in PinnedQuestsMod.Pinned) { if (PinnedQuestsMod.ShowCompleted.Value || !Quests.Progress(item).done) { list.Add(item); } } bool flag = list.Count == 0 && samplesIfEmpty; string text = (flag ? "samples" : string.Join(",", list)); if (text != _built) { _built = text; foreach (Card card in _cards) { if ((Object)(object)card.Go != (Object)null) { Object.Destroy((Object)(object)card.Go); } } _cards.Clear(); if (flag) { _cards.Add(Make(new Card { SampleText = "Pin quests in the Quests menu to see them here.", SampleValue = 120, SampleTarget = 500 })); _cards.Add(Make(new Card { SampleText = "Sample quest: defeat 1,000 enemies.", SampleValue = 1000, SampleTarget = 1000 })); } else { foreach (ChallengeId item2 in list) { _cards.Add(Make(new Card { Id = item2 })); } } } foreach (Card card2 in _cards) { Update(card2); } } public void Place() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(PinnedQuestsMod.CardWidth.Value, PinnedQuestsMod.CardHeight.Value); if (_grid.cellSize != val) { _grid.cellSize = val; foreach (Card card in _cards) { if ((Object)(object)card.Info != (Object)null) { card.Info.preferredWidth = val.x - 112f - 88f; } } } QuestLayout value = PinnedQuestsMod.Layout.Value; Constraint val2 = (Constraint)((value != QuestLayout.Horizontal) ? 1 : 2); int num = ((value != QuestLayout.Grid) ? 1 : Mathf.Max(1, PinnedQuestsMod.Columns.Value)); if (_grid.constraint != val2) { _grid.constraint = val2; } if (_grid.constraintCount != num) { _grid.constraintCount = num; } float value2 = PinnedQuestsMod.Size.Value; ((Transform)Root).localScale = new Vector3(value2, value2, 1f); Root.anchoredPosition = new Vector2(0f - PinnedQuestsMod.OffsetX.Value, PinnedQuestsMod.OffsetY.Value); } private static void Update(Card card) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) ChallengeId? id = card.Id; int num; int num2; bool flag; if (id.HasValue) { ChallengeId valueOrDefault = id.GetValueOrDefault(); (num, num2, flag) = Quests.Progress(valueOrDefault); card.Text.text = Quests.Text(valueOrDefault); if ((Object)(object)card.Icon.sprite == (Object)null) { Image icon = card.Icon; ChallengeConfiguration obj = Quests.Config(valueOrDefault); icon.sprite = ((obj != null) ? obj.Icon : null); ((Behaviour)card.Icon).enabled = (Object)(object)card.Icon.sprite != (Object)null; } } else { int sampleValue = card.SampleValue; num2 = card.SampleTarget; num = sampleValue; flag = num >= num2; card.Text.text = card.SampleText; ((Behaviour)card.Icon).enabled = false; } float num3 = (flag ? 1f : ((num2 > 0) ? Mathf.Clamp01((float)num / (float)num2) : 0f)); card.Fill.anchorMax = new Vector2(num3, 1f); ((Graphic)card.FillImage).color = (flag ? Green : QuestCards.Gold); card.Count.text = (flag ? "Done" : ((num2 > 1) ? $"{num:N0} / {num2:N0}" : "Not yet")); ((Graphic)card.Count).color = (flag ? Green : QuestCards.Gold); } private Card Make(Card card) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032a: 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_00ac: Unknown result type (might be due to invalid IL or missing references) RectTransform val = new GameObject("Quest").AddComponent(); ((Transform)val).SetParent((Transform)(object)Root, false); card.Go = ((Component)val).gameObject; RectTransform obj = new GameObject("Background").AddComponent(); ((Transform)obj).SetParent((Transform)(object)val, false); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; Vector2 offsetMin = (obj.offsetMax = Vector2.zero); obj.offsetMin = offsetMin; ((Component)obj).gameObject.AddComponent().ignoreLayout = true; Image val2 = ((Component)obj).gameObject.AddComponent(); ((Graphic)val2).raycastTarget = true; if (!ApplyStyle(val2)) { ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.6f); } HorizontalLayoutGroup obj2 = ((Component)val).gameObject.AddComponent(); ((LayoutGroup)obj2).padding = Pad(30, 36, 22, 22); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 22f; ((LayoutGroup)obj2).childAlignment = (TextAnchor)3; bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = childControlWidth; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = true; Image val3 = new GameObject("Icon").AddComponent(); ((Transform)((Graphic)val3).rectTransform).SetParent((Transform)(object)val, false); val3.preserveAspect = true; ((Graphic)val3).raycastTarget = false; LayoutElement obj3 = ((Component)val3).gameObject.AddComponent(); float preferredWidth = (obj3.preferredHeight = 112f); obj3.preferredWidth = preferredWidth; card.Icon = val3; RectTransform val4 = new GameObject("Info").AddComponent(); ((Transform)val4).SetParent((Transform)(object)val, false); VerticalLayoutGroup obj4 = ((Component)val4).gameObject.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj4).spacing = 6f; childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj4).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj4).childControlWidth = childControlWidth; ((HorizontalOrVerticalLayoutGroup)obj4).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj4).childForceExpandHeight = false; ((LayoutGroup)obj4).childAlignment = (TextAnchor)3; card.Info = ((Component)val4).gameObject.AddComponent(); card.Info.preferredWidth = PinnedQuestsMod.CardWidth.Value - 112f - 88f; card.Text = Label((Transform)(object)val4, 38f, Color.white, (TextAlignmentOptions)4097, wrap: true); card.Text.enableAutoSizing = true; card.Text.fontSizeMin = 20f; card.Text.fontSizeMax = 38f; card.Text.overflowMode = (TextOverflowModes)1; LayoutElement obj5 = ((Component)card.Text).gameObject.AddComponent(); obj5.flexibleHeight = 1f; obj5.minHeight = 0f; obj5.preferredHeight = 0f; Image val5 = new GameObject("Bar").AddComponent(); ((Transform)((Graphic)val5).rectTransform).SetParent((Transform)(object)val4, false); ((Graphic)val5).color = new Color(1f, 1f, 1f, 0.15f); ((Graphic)val5).raycastTarget = false; ((Component)val5).gameObject.AddComponent().preferredHeight = 12f; Image val6 = new GameObject("Fill").AddComponent(); ((Transform)((Graphic)val6).rectTransform).SetParent((Transform)(object)((Graphic)val5).rectTransform, false); ((Graphic)val6).rectTransform.anchorMin = Vector2.zero; ((Graphic)val6).rectTransform.anchorMax = new Vector2(0f, 1f); RectTransform rectTransform = ((Graphic)val6).rectTransform; offsetMin = (((Graphic)val6).rectTransform.offsetMax = Vector2.zero); rectTransform.offsetMin = offsetMin; ((Graphic)val6).raycastTarget = false; card.Fill = ((Graphic)val6).rectTransform; card.FillImage = val6; card.Count = Label((Transform)(object)val4, 34f, QuestCards.Gold, (TextAlignmentOptions)516, wrap: false); return card; } private static bool ApplyStyle(Image bg) { //IL_0114: Unknown result type (might be due to invalid IL or missing references) string value = PinnedQuestsMod.CardStyle.Value; if (string.IsNullOrEmpty(value)) { return false; } string[] array = value.Split('|'); if (array.Length < 3) { return false; } if (_styleKey != value || (Object)(object)_style == (Object)null || ((Il2CppObjectBase)_style).WasCollected) { _style = null; _styleKey = value; foreach (Sprite item in Resources.FindObjectsOfTypeAll()) { if ((Object)(object)item != (Object)null && ((Object)item).name == array[0]) { _style = item; break; } } } if ((Object)(object)_style == (Object)null) { return false; } string[] c = array[1].Split(','); bg.sprite = _style; bg.type = (Type)((array.Length <= 3 || !int.TryParse(array[3], out var result)) ? 1 : result); ((Graphic)bg).color = new Color(F(0), F(1), F(2), F(3)); if (float.TryParse(array[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) && result2 > 0f) { bg.pixelsPerUnitMultiplier = result2; } return true; float F(int i) { if (c.Length <= i || !float.TryParse(c[i], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3)) { return 1f; } return result3; } } internal static TMP_Text Label(Transform parent, float size, Color color, TextAlignmentOptions align, bool wrap) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = new GameObject("Text").AddComponent(); ((Transform)((TMP_Text)val).rectTransform).SetParent(parent, false); TMP_FontAsset val2 = Font(); if ((Object)(object)val2 != (Object)null) { ((TMP_Text)val).font = val2; ((TMP_Text)val).fontSharedMaterial = ((TMP_Asset)val2).material; } ((TMP_Text)val).fontSize = size; ((Graphic)val).color = color; ((TMP_Text)val).alignment = align; ((TMP_Text)val).textWrappingMode = (TextWrappingModes)(wrap ? 1 : 0); ((Graphic)val).raycastTarget = false; ((TMP_Text)val).outlineWidth = 0.15f; ((TMP_Text)val).outlineColor = new Color32((byte)0, (byte)0, (byte)0, (byte)180); return (TMP_Text)(object)val; } private static TMP_FontAsset Font() { if ((Object)(object)_font != (Object)null && !((Il2CppObjectBase)_font).WasCollected) { return _font; } foreach (TMP_FontAsset item in Resources.FindObjectsOfTypeAll()) { if ((Object)(object)item != (Object)null && ((Object)item).name == "TitilliumWeb-SemiBold SDF") { return _font = item; } } return null; } internal static RectOffset Pad(int left, int right, int top, int bottom) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return new RectOffset { left = left, right = right, top = top, bottom = bottom }; } public void Clamp(RectTransform canvas) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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_005f: 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) if (!((Object)(object)canvas == (Object)null)) { LayoutRebuilder.ForceRebuildLayoutImmediate(Root); float value = PinnedQuestsMod.Size.Value; Rect rect = Root.rect; float num = ((Rect)(ref rect)).width * value; rect = Root.rect; float num2 = ((Rect)(ref rect)).height * value; rect = canvas.rect; float width = ((Rect)(ref rect)).width; rect = canvas.rect; float height = ((Rect)(ref rect)).height; float num3 = Mathf.Clamp(PinnedQuestsMod.OffsetX.Value, 0f, Mathf.Max(0f, width - num)); float num4 = Mathf.Clamp(PinnedQuestsMod.OffsetY.Value, (0f - height) / 2f + num2, height / 2f); if (Mathf.Abs(num3 - PinnedQuestsMod.OffsetX.Value) > 0.5f) { PinnedQuestsMod.OffsetX.Value = Mathf.Round(num3); } if (Mathf.Abs(num4 - PinnedQuestsMod.OffsetY.Value) > 0.5f) { PinnedQuestsMod.OffsetY.Value = Mathf.Round(num4); } } } } internal static class Hud { private static Cards _cards; private static Canvas _canvas; private static float _nextSearch; private static float _nextUpdate; private static bool _dragging; private static Vector2 _dragStart; private static Vector2 _offsetStart; private static IntPtr _run; private static float _runStart; private static bool _captured; private static float _editingUntil; internal static RectTransform LiveCards() { if (!EnsureRoot()) { return null; } _editingUntil = Time.unscaledTime + 0.3f; _dragging = false; SetVisible(on: true); if (Time.unscaledTime >= _nextUpdate) { _nextUpdate = Time.unscaledTime + 0.5f; _cards.Refresh(samplesIfEmpty: true); } _cards.Place(); return _cards.Root; } public static void Tick() { if (Time.unscaledTime < _editingUntil) { return; } try { RunManager instance = NetworkSingleton.Instance; int num; if ((Object)(object)instance != (Object)null) { num = (instance.runHasStarted ? 1 : 0); if (num != 0 && ((Il2CppObjectBase)instance).Pointer != _run) { _run = ((Il2CppObjectBase)instance).Pointer; _runStart = Time.unscaledTime; _captured = false; } } else { num = 0; } if (num == 0) { _run = IntPtr.Zero; } if (!((num != 0 && !ShopOpen()) & (PinnedQuestsMod.Show.Value && PinnedQuestsMod.Pinned.Count > 0))) { SetVisible(on: false); _dragging = false; } else if (EnsureRoot()) { SetVisible(on: true); if (Time.unscaledTime >= _nextUpdate) { _nextUpdate = Time.unscaledTime + 0.5f; _cards.Refresh(samplesIfEmpty: false); } _cards.Place(); Mouse(); } } catch (Exception ex) { PinnedQuestsMod.Log.Warning("mission cards: " + ex.Message); _nextSearch = Time.unscaledTime + 5f; _cards = null; } } private static bool ShopOpen() { StoreManager instance = NetworkSingleton.Instance; if ((Object)(object)instance != (Object)null) { if (!instance.IsShopPanelActive) { return instance.IsExitingStore; } return true; } return false; } private static void SetVisible(bool on) { if (_cards != null && (Object)(object)_cards.Root != (Object)null && !((Il2CppObjectBase)_cards.Root).WasCollected && ((Component)_cards.Root).gameObject.activeSelf != on) { ((Component)_cards.Root).gameObject.SetActive(on); } } private static bool EnsureRoot() { if (_cards != null && (Object)(object)_cards.Root != (Object)null && !((Il2CppObjectBase)_cards.Root).WasCollected) { return true; } _cards = null; if (Time.unscaledTime < _nextSearch) { return false; } _nextSearch = Time.unscaledTime + 1f; Canvas val = null; foreach (SpellSlotsDisplay item in Object.FindObjectsOfType()) { Canvas componentInParent = ((Component)item).GetComponentInParent(); val = ((componentInParent != null) ? componentInParent.rootCanvas : null); if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null) { return false; } _canvas = val; _cards = new Cards(((Component)val).transform, "PinnedQuests"); return true; } private static void Mouse() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_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) Mouse current = Mouse.current; if (current == null || !Cursor.visible) { _dragging = false; return; } Vector2 val = ((InputControl)(object)((Pointer)current).position).ReadValue(); Camera val2 = (((Object)(object)_canvas != (Object)null && (int)_canvas.renderMode != 0) ? _canvas.worldCamera : null); float num = (((Object)(object)_canvas != (Object)null) ? _canvas.scaleFactor : 1f); RectTransform canvas = (((Object)(object)_canvas != (Object)null) ? ((Component)_canvas).GetComponent() : null); if (_dragging) { Vector2 val3 = (val - _dragStart) / num; PinnedQuestsMod.OffsetX.Value = Mathf.Round(_offsetStart.x - val3.x); PinnedQuestsMod.OffsetY.Value = Mathf.Round(_offsetStart.y + val3.y); _cards.Clamp(canvas); if (!current.leftButton.isPressed) { _dragging = false; } } else if (RectTransformUtility.RectangleContainsScreenPoint(_cards.Root, val, val2)) { if (current.leftButton.wasPressedThisFrame) { _dragging = true; _dragStart = val; _offsetStart = new Vector2(PinnedQuestsMod.OffsetX.Value, PinnedQuestsMod.OffsetY.Value); } float y = ((InputControl)(object)current.scroll).ReadValue().y; if (Mathf.Abs(y) > 0.01f) { PinnedQuestsMod.Size.Value = Mathf.Clamp(Mathf.Round((PinnedQuestsMod.Size.Value + Mathf.Sign(y) * 0.05f) * 100f) / 100f, 0.5f, 2f); _cards.Clamp(canvas); } } } } internal static class MenuPage { private static bool _registered; private static Cards _previewCards; private static float _nextPreviewRefresh; private static readonly HudElement Element = new HudElement { Name = "Pinned Quests", Build = delegate(RectTransform parent) { _previewCards = new Cards((Transform)(object)parent, "PinnedQuestsPreview"); _previewCards.Refresh(samplesIfEmpty: true); return _previewCards.Root; }, Place = delegate { if (_previewCards != null) { if (Time.unscaledTime >= _nextPreviewRefresh) { _nextPreviewRefresh = Time.unscaledTime + 0.5f; _previewCards.Refresh(samplesIfEmpty: true); } _previewCards.Place(); } }, Live = Hud.LiveCards, GetOffset = () => new Vector2(0f - PinnedQuestsMod.OffsetX.Value, PinnedQuestsMod.OffsetY.Value), SetOffset = delegate(Vector2 v) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) PinnedQuestsMod.OffsetX.Value = 0f - v.x; PinnedQuestsMod.OffsetY.Value = v.y; }, GetSize = () => PinnedQuestsMod.Size.Value, SetSize = delegate(float v) { PinnedQuestsMod.Size.Value = v; }, GetDimensions = () => new Vector2(PinnedQuestsMod.CardWidth.Value, PinnedQuestsMod.CardHeight.Value), SetDimensions = delegate(Vector2 d) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) PinnedQuestsMod.CardWidth.Value = d.x; PinnedQuestsMod.CardHeight.Value = d.y; }, MinDimensions = new Vector2(400f, 110f), MaxDimensions = new Vector2(1600f, 500f), Reset = delegate { PinnedQuestsMod.OffsetX.Value = PinnedQuestsMod.OffsetX.DefaultValue; PinnedQuestsMod.OffsetY.Value = PinnedQuestsMod.OffsetY.DefaultValue; PinnedQuestsMod.Size.Value = PinnedQuestsMod.Size.DefaultValue; PinnedQuestsMod.CardWidth.Value = PinnedQuestsMod.CardWidth.DefaultValue; PinnedQuestsMod.CardHeight.Value = PinnedQuestsMod.CardHeight.DefaultValue; } }; [MethodImpl(MethodImplOptions.NoInlining)] internal static void Register() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown _registered = true; HudEditor.Register(Element); Menu.AddPage("PinnedQuests", "Pinned Quests").Note((Func)(() => "Pin quests with the pin on each quest in the Quests menu.")).Header((Func)(() => "Pinned")) .List((Func>)PinnedEntries, (Func)(() => "No quests pinned.")) .Buttons((MenuButton[])(object)new MenuButton[2] { new MenuButton("Edit Position & Size", (Action)EditLayout, false), new MenuButton("Unpin All", (Action)PinnedQuestsMod.UnpinAll, true) }) .Note((Func)(() => "Edit Position & Size: drag and resize the quests over the game's HUD. During a mission you can also drag them, and use the mouse wheel over them to resize.")) .Header((Func)(() => "During Missions")) .Entry(PinnedQuestsMod.Show, () => "Show Pinned Quests") .Entry(PinnedQuestsMod.ShowCompleted, () => "Show Completed") .Entry(PinnedQuestsMod.Layout, () => "Layout") .Entry(PinnedQuestsMod.Columns, () => "Grid Columns") .Entry(PinnedQuestsMod.CardWidth, () => "Card Width") .Entry(PinnedQuestsMod.CardHeight, () => "Card Height") .Entry(PinnedQuestsMod.Size, () => "Size") .Entry(PinnedQuestsMod.OffsetX, () => "Position X") .Entry(PinnedQuestsMod.OffsetY, () => "Position Y"); PinnedQuestsMod.Changed += Refresh; } private static void EditLayout() { HudEditor.Open(Element); } [MethodImpl(MethodImplOptions.NoInlining)] private static void Refresh() { if (_registered) { Menu.Refresh(); } } private static IList PinnedEntries() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown List list = new List(); foreach (ChallengeId item in PinnedQuestsMod.Pinned) { ChallengeId quest = item; list.Add(new ListEntry(Quests.Text(quest), (MenuButton[])(object)new MenuButton[1] { new MenuButton("Unpin", (Action)delegate { //IL_0001: Unknown result type (might be due to invalid IL or missing references) PinnedQuestsMod.Toggle(quest); }, false) })); } return list; } } public enum QuestLayout { Vertical, Horizontal, Grid } public class PinnedQuestsMod : MelonMod { internal static MelonLogger.Instance Log; internal static MelonPreferences_Entry Show; internal static MelonPreferences_Entry ShowCompleted; internal static MelonPreferences_Entry Size; internal static MelonPreferences_Entry OffsetX; internal static MelonPreferences_Entry OffsetY; internal static MelonPreferences_Entry CardWidth; internal static MelonPreferences_Entry CardHeight; internal static MelonPreferences_Entry Layout; internal static MelonPreferences_Entry Columns; internal static MelonPreferences_Entry PinIcon; internal static MelonPreferences_Entry CardStyle; private static MelonPreferences_Entry PinnedEntry; private static MelonPreferences_Entry TextsEntry; private static MelonPreferences_Category _category; internal static readonly List Pinned = new List(); internal static readonly Dictionary Texts = new Dictionary(); private const string Sep = ";;"; private const string KeySep = "::"; internal static event Action Changed; public override void OnInitializeMelon() { Log = base.LoggerInstance; _category = MelonPreferences.CreateCategory("PinnedQuests", "Pinned Quests"); Show = _category.CreateEntry("Show", default_value: true, "Show During Missions", "Show your pinned quests and their progress during missions"); Layout = _category.CreateEntry("Layout", QuestLayout.Vertical, "Layout", "How the quest cards line up: one under another, side by side, or in a grid"); Columns = _category.CreateEntry("Columns", 2, "Grid Columns", "How many cards side by side in the Grid layout", is_hidden: false, dont_save_default: false, new ValueRange(1, 6)); CardWidth = _category.CreateEntry("CardWidth", 780f, "Card Width", "Width of each quest card (drag its side edges in the editor)", is_hidden: false, dont_save_default: false, new ValueRange(400f, 1600f)); CardHeight = _category.CreateEntry("CardHeight", 170f, "Card Height", "Height of each quest card (drag its top or bottom edge in the editor)", is_hidden: false, dont_save_default: false, new ValueRange(110f, 500f)); ShowCompleted = _category.CreateEntry("ShowCompleted", default_value: true, "Show Completed", "Keep showing pinned quests once they're completed (marked Done)"); Size = _category.CreateEntry("Size", 0.75f, "Size", "Size of the quest cards (mouse wheel over them during a mission)", is_hidden: false, dont_save_default: false, new ValueRange(0.5f, 2f)); OffsetX = _category.CreateEntry("OffsetFromRight", 40f, "Position X", "Distance from the right edge (drag the cards during a mission)", is_hidden: false, dont_save_default: false, new ValueRange(0f, 6000f)); OffsetY = _category.CreateEntry("OffsetY", 150f, "Position Y", "Distance above the middle of the screen (drag the cards during a mission)", is_hidden: false, dont_save_default: false, new ValueRange(-1100f, 1100f)); PinIcon = _category.CreateEntry("PinIcon", "", "Pin Icon", "Name of the upgrade screen's pin picture, once found", is_hidden: true); CardStyle = _category.CreateEntry("CardBackground", "", "Card Background", "The Quests menu cards' background picture and tint, once seen", is_hidden: true); PinnedEntry = _category.CreateEntry("Pinned", "", "Pinned", "Pinned quests (ids, comma-separated)", is_hidden: true); TextsEntry = _category.CreateEntry("Descriptions", "", "Descriptions", "Quest descriptions copied from the Quests menu", is_hidden: true); Load(); if (Array.Exists(AppDomain.CurrentDomain.GetAssemblies(), (Assembly a) => a.GetName().Name == "BrigadeModMenu")) { try { RegisterMenu(); } catch (Exception ex) { Log.Warning("Mod Menu page: " + ex.Message); } } Log.Msg($"ready — {Pinned.Count} pinned"); } [MethodImpl(MethodImplOptions.NoInlining)] private static void RegisterMenu() { MenuPage.Register(); } public override void OnUpdate() { QuestCards.Tick(); Hud.Tick(); } internal static bool IsPinned(ChallengeId id) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return Pinned.Contains(id); } internal static void Toggle(ChallengeId id) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!Pinned.Remove(id)) { Pinned.Add(id); } Save(); } internal static void UnpinAll() { Pinned.Clear(); Save(); } internal static void RememberText(ChallengeId id, string text) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(text)) { return; } text = text.Replace(";;", " ").Replace("::", " ").Trim(); if (!Texts.TryGetValue(id, out var value) || !(value == text)) { Texts[id] = text; if (IsPinned(id)) { SaveTexts(); } } } private static void Load() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) string[] array = (PinnedEntry.Value ?? "").Split(','); for (int i = 0; i < array.Length; i++) { if (Enum.TryParse(array[i].Trim(), out ChallengeId result) && !Pinned.Contains(result)) { Pinned.Add(result); } } array = (TextsEntry.Value ?? "").Split(new string[1] { ";;" }, StringSplitOptions.RemoveEmptyEntries); foreach (string text in array) { int num = text.IndexOf("::", StringComparison.Ordinal); if (num > 0 && Enum.TryParse(text.Substring(0, num), out ChallengeId result2)) { Texts[result2] = text.Substring(num + "::".Length); } } } private unsafe static void Save() { PinnedEntry.Value = string.Join(",", Pinned.ConvertAll((ChallengeId p) => ((object)(*(ChallengeId*)(&p))/*cast due to .constrained prefix*/).ToString())); SaveTexts(); PinnedQuestsMod.Changed?.Invoke(); } private unsafe static void SaveTexts() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (ChallengeId item in Pinned) { if (Texts.TryGetValue(item, out var value)) { list.Add(((object)(*(ChallengeId*)(&item))/*cast due to .constrained prefix*/).ToString() + "::" + value); } } TextsEntry.Value = string.Join(";;", list); _category.SaveToFile(printmsg: false); } } internal static class QuestCards { private const string ButtonName = "PinnedQuests_Pin"; internal static readonly Color Gold = new Color(0.96f, 0.76f, 0.3f, 1f); private static readonly Color Bright = new Color(1f, 0.86f, 0.15f, 1f); private static readonly Color Off = new Color(0.27f, 0.27f, 0.29f, 1f); private static float _next; private static readonly Dictionary CardQuest = new Dictionary(); private static readonly Dictionary LastText = new Dictionary(); private static Sprite _pin; private static float _nextPinSearch; public static void Tick() { //IL_009e: 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) if (Time.unscaledTime < _next) { return; } _next = Time.unscaledTime + 0.5f; try { foreach (ChallengeCategoryPanel item in Object.FindObjectsOfType()) { if ((Object)(object)item == (Object)null || !((Component)item).gameObject.activeInHierarchy) { continue; } Dictionary challengeProgressPanelsForConfigurations = item.challengeProgressPanelsForConfigurations; if (challengeProgressPanelsForConfigurations == null) { continue; } Enumerator enumerator2 = challengeProgressPanelsForConfigurations.GetEnumerator(); while (enumerator2.MoveNext()) { KeyValuePair current2 = enumerator2.Current; ChallengeConfiguration key = current2.Key; ChallengeProgressPanel value = current2.Value; if (!((Object)(object)key == (Object)null) && !((Object)(object)value == (Object)null) && ((Component)value).gameObject.activeInHierarchy) { Ensure(value, key.Id); if (string.IsNullOrEmpty(PinnedQuestsMod.CardStyle.Value)) { RememberStyle(value); } Remember(value, key.Id); } } } } catch (Exception ex) { PinnedQuestsMod.Log.Warning("quest cards: " + ex.Message); _next = Time.unscaledTime + 5f; } } private static void Ensure(ChallengeProgressPanel card, ChallengeId id) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) CardQuest[((Il2CppObjectBase)card).Pointer] = id; Transform val = ((Component)card).transform.Find("PinnedQuests_Pin"); if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).GetComponentInChildren(true) != (Object)null && (Object)(object)PinSprite() != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); val = null; } TMP_Text val2 = null; Image val7; if ((Object)(object)val == (Object)null) { RectTransform val3 = new GameObject("PinnedQuests_Pin").AddComponent(); ((Transform)val3).SetParent(((Component)card).transform, false); Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(1f, 1f); val3.pivot = val4; Vector2 anchorMin = (val3.anchorMax = val4); val3.anchorMin = anchorMin; Sprite val6 = PinSprite(); val3.sizeDelta = (((Object)(object)val6 != (Object)null) ? new Vector2(64f, 64f) : new Vector2(150f, 52f)); val3.anchoredPosition = new Vector2(-16f, -12f); val7 = ((Component)val3).gameObject.AddComponent(); val7.sprite = val6; val7.preserveAspect = true; if ((Object)(object)val6 == (Object)null) { ((Graphic)val7).color = new Color(0f, 0f, 0f, 0.55f); } Button obj = ((Component)val3).gameObject.AddComponent