using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DG.Tweening; using HarmonyLib; using I2.Loc; using ShinyShoe; using ShinyShoe.Loading; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Patty_RelicPicker_MOD")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Patty_RelicPicker_MOD")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b5b9af5c-ebb2-46ed-95e5-e695c77e4af7")] [assembly: AssemblyFileVersion("2.3.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("2.3.0.0")] namespace Patty_RelicPicker_MOD; internal sealed class ConfigurationManagerAttributes { public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput); public bool? ShowRangeAsPercent; public Action CustomDrawer; public CustomHotkeyDrawerFunc CustomHotkeyDrawer; public bool? Browsable; public string Category; public object DefaultValue; public bool? HideDefaultButton; public bool? HideSettingName; public string Description; public string DispName; public int? Order; public bool? ReadOnly; public bool? IsAdvanced; public Func ObjToStr; public Func StrToObj; } internal struct ModButtonInfo { internal Action onToggle; internal ConfigEntry entry; internal string text; internal int fontSize; internal ModButtonInfo(ConfigEntry entry, int fontSize = 31, Action onToggle = null) { this.onToggle = onToggle; this.entry = entry; text = ((ConfigEntryBase)entry).Definition.Key; this.fontSize = fontSize; } internal ModButtonInfo(string text, ConfigEntry entry, int fontSize = 31, Action onToggle = null) { this.onToggle = onToggle; this.entry = entry; this.text = text; this.fontSize = fontSize; } internal ModButtonInfo(string text, ConfigEntry entry) { onToggle = null; this.entry = entry; this.text = text; fontSize = 31; } internal ModButtonInfo(string text) { onToggle = null; entry = null; this.text = text; fontSize = 31; } } [RequireComponent(typeof(RectTransform))] internal class ModButtonTooltip : MonoBehaviour { internal ModOptionDialog optionDialog; private bool initialized; private Image bg; private LayoutElement layoutElement; private ContentSizeFitter sizeFitter; private TextMeshProUGUI label; internal ModButtonUI focusedModButton; private void Start() { ((Object)this).name = "ModButtonTooltip"; Initialize(); } private void Initialize() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) if (!initialized) { initialized = true; ((Component)this).gameObject.layer = LayerMask.NameToLayer("UI"); bg = ((Component)this).gameObject.AddComponent(); ((Graphic)bg).rectTransform.pivot = new Vector2(0.5f, 1f); ((Graphic)bg).raycastTarget = false; bg.type = (Type)1; bg.sprite = ModOptionDialog.tooltipSprite; ((Component)this).gameObject.AddComponent(); layoutElement = ((Component)this).gameObject.AddComponent(); layoutElement.minWidth = 350f; layoutElement.preferredWidth = 350f; sizeFitter = ((Component)this).gameObject.AddComponent(); sizeFitter.horizontalFit = (FitMode)2; sizeFitter.verticalFit = (FitMode)2; label = Object.Instantiate(PatchList.championNameLabelPrefab, ((Component)this).transform); ((Object)label).name = "Label"; ((TMP_Text)label).fontSizeMax = 30f; ((TMP_Text)label).fontSizeMin = ((TMP_Text)label).fontSizeMax; ((TMP_Text)label).fontSize = ((TMP_Text)label).fontSizeMax; ((TMP_Text)label).enableAutoSizing = false; ((TMP_Text)label).enableWordWrapping = true; ((TMP_Text)label).margin = new Vector4(10f, 5f, 10f, 5f); } } internal void Open(ModButtonUI modButton) { Initialize(); focusedModButton = modButton; ((TMP_Text)label).text = ((ConfigEntryBase)focusedModButton.info.entry).Description.Description; SoundManager.PlaySfxSignal.Dispatch("UI_HighlightLight"); ((Component)this).gameObject.SetActive(true); } internal void Close() { SoundManager.PlaySfxSignal.Dispatch("UI_CancelLight"); ((Component)this).gameObject.SetActive(false); } private void LateUpdate() { UpdateTooltipPosition(); } private void UpdateTooltipPosition() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0063: 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_0075: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_009c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)focusedModButton == (Object)null)) { RectTransform val = (RectTransform)((Component)this).transform; RectTransform val2 = (RectTransform)((Component)focusedModButton).transform; val.anchorMin = val2.anchorMin; val.anchorMax = val2.anchorMax; val.sizeDelta = val2.sizeDelta; Vector3 position = ((Transform)val2).position; RectTransform val3 = (RectTransform)((Component)optionDialog).transform; Vector2 val4 = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(val3, RectTransformUtility.WorldToScreenPoint((Camera)null, position), (Camera)null, ref val4); Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(950f, -570f); val.anchoredPosition = val4 + val5; } } } [RequireComponent(typeof(RectTransform))] internal class ModButtonUI : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IInitializePotentialDragHandler { internal ModButtonInfo info; internal GameUISelectableToggle toggleButton; internal TextMeshProUGUI label; internal ModOptionDialog modDialog; private bool isHovering; public void OnPointerEnter(PointerEventData eventData) { isHovering = true; modDialog.modTooltip.Open(this); } public void OnPointerExit(PointerEventData eventData) { isHovering = false; modDialog.modTooltip.Close(); } public void OnInitializePotentialDrag(PointerEventData eventData) { if (isHovering && (Object)(object)modDialog != (Object)null && (Object)(object)modDialog.scrollRect != (Object)null) { modDialog.scrollRect.OnInitializePotentialDrag(eventData); eventData.useDragThreshold = true; } } internal void CheckNullComponent() { if ((Object)(object)label == (Object)null) { label = ((Component)((Component)this).transform.GetChild(0)).GetComponent(); } if ((Object)(object)toggleButton == (Object)null) { toggleButton = ((Component)((Component)this).transform.GetChild(2)).GetComponent(); } } public void Update() { //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) ((Transform)((Component)toggleButton).GetComponent()).localPosition = Vector2.op_Implicit(new Vector2(-228f, 7f)); } internal void Set(ModButtonInfo info) { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown if (info.entry == null) { Plugin.LogSource.LogError((object)"Please do not call ModButtonUI.Set without setting an entry. ModButtonInfo without an entry is only intended for a placeholder"); return; } CheckNullComponent(); ((Object)this).name = ((ConfigEntryBase)info.entry).Definition.Key; this.info = info; ((TMP_Text)label).text = info.text; ((TMP_Text)label).fontSizeMax = info.fontSize; ((TMP_Text)label).fontSizeMin = info.fontSize; ((TMP_Text)label).fontSize = info.fontSize; ((UnityEvent)((Button)toggleButton).onClick).AddListener((UnityAction)delegate { bool value = toggleButton.Toggle(); info.entry.Value = value; }); info.entry.SettingChanged += Entry_SettingChanged; toggleButton.isOn = info.entry.Value; ((Component)this).gameObject.SetActive(true); } private void OnDestroy() { if (info.entry != null) { info.entry.SettingChanged -= Entry_SettingChanged; } } private void Entry_SettingChanged(object sender, EventArgs e) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown SettingChangedEventArgs val = (SettingChangedEventArgs)e; toggleButton.isOn = (bool)val.ChangedSetting.BoxedValue; info.onToggle?.Invoke(toggleButton.isOn); } internal static ModButtonUI CreateModButtonUI(Transform parent, ModButtonInfo info) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_0105: 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_0125: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) IScreen screen = AllGameManagers.Instance.GetScreenManager().GetScreen((ScreenName)42); RunSetupScreen val = (RunSetupScreen)(object)((screen is RunSetupScreen) ? screen : null); if ((Object)(object)val == (Object)null) { Plugin.LogSource.LogError((object)"This is intended to be created on RunSetupScreen menu"); return null; } GameObject val2 = (GameObject)AccessTools.Field(typeof(RunSetupScreen), "championNameRoot").GetValue(val); Image val3 = Object.Instantiate(val2.GetComponentInChildren(), parent); ((Component)val3).transform.localPosition = Vector2.op_Implicit(new Vector2(500f, -460f)); ((Component)val3).GetComponent().pivot = Vector2.one * 0.5f; TextMeshProUGUI componentInChildren = ((Component)val3).GetComponentInChildren(); ((Object)componentInChildren).name = "Option Name"; ((TMP_Text)componentInChildren).enableAutoSizing = false; ((TMP_Text)componentInChildren).alignment = (TextAlignmentOptions)513; ((TMP_Text)componentInChildren).text = info.text; ((TMP_Text)componentInChildren).rectTransform.pivot = new Vector2(0f, 0.5f); ((Transform)((TMP_Text)componentInChildren).rectTransform).localPosition = Vector2.op_Implicit(new Vector2(-165f, 6f)); ((TMP_Text)componentInChildren).rectTransform.anchoredPosition = new Vector2(50f, 6f); ((TMP_Text)componentInChildren).fontSizeMax = info.fontSize; ((TMP_Text)componentInChildren).fontSizeMin = info.fontSize; ((TMP_Text)componentInChildren).fontSize = info.fontSize; ModButtonUI modButtonUI = ((Component)val3).gameObject.AddComponent(); modButtonUI.label = componentInChildren; modButtonUI.info.onToggle = info.onToggle; Image val4 = new GameObject("Target Graphic").AddComponent(); ((Component)val4).gameObject.layer = LayerMask.NameToLayer("UI"); ((Component)val4).transform.SetParent(((Component)modButtonUI).transform, false); ((Graphic)val4).rectTransform.pivot = new Vector2(0.5f, 0.42f); ((Graphic)val4).rectTransform.sizeDelta = new Vector2(400f, 88f); ((Graphic)val4).color = Color.clear; GameUISelectableToggle val5 = Object.Instantiate(Object.FindObjectOfType(true), ((Component)val3).transform); ((Component)val5).gameObject.SetActive(true); ((Object)val5).name = "Option Toggle"; ((Button)val5).onClick = new ButtonClickedEvent(); ((Component)((Component)val5).transform.GetChild(0)).gameObject.SetActive(false); ((Component)((Component)val5).transform.GetChild(2)).gameObject.SetActive(false); modButtonUI.toggleButton = val5; RectTransform component = ((Component)val5).GetComponent(); component.anchorMax = Vector2.one; component.anchorMin = Vector2.zero; component.pivot = Vector2.one * 0.5f; component.anchoredPosition = new Vector2(146f, 7f); return modButtonUI; } } internal class ModOptionDialog : MonoBehaviour { [CompilerGenerated] private sealed class d__19 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private ModButtonInfo <>2__current; private int <>l__initialThreadId; public ModOptionDialog <>4__this; ModButtonInfo IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__19(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = new ModButtonInfo(Plugin.EnableOnChallenge, 25); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = new ModButtonInfo(Plugin.ShowUncollectableRelics, 25, delegate { RelicSelectionDialog.Instance.ResetMenu(); }); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = new ModButtonInfo(Plugin.ShowEnemyRelics, 25, delegate { RelicSelectionDialog.Instance.ResetMenu(); }); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = new ModButtonInfo(Plugin.ShowCovenantRelics, 25, delegate { RelicSelectionDialog.Instance.ResetMenu(); }); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = new ModButtonInfo(Plugin.ShowMutatorRelics, 25, delegate { RelicSelectionDialog.Instance.ResetMenu(); }); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = new ModButtonInfo(Plugin.ShowPyreArtifactRelics, 25, delegate { RelicSelectionDialog.Instance.ResetMenu(); }); <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = new ModButtonInfo(Plugin.ShowEndlessMutatorRelics, 25, delegate { RelicSelectionDialog.Instance.ResetMenu(); }); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = new ModButtonInfo(Plugin.ShowEnhancerRelics, 25, delegate { RelicSelectionDialog.Instance.ResetMenu(); }); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = new ModButtonInfo(Plugin.ShowTooltips, 25, delegate { RelicSelectionDialog.Instance.SetupTooltip(); }); <>1__state = 9; return true; case 9: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__19 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new d__19(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } private ScreenDialog dialog; internal ModButtonUI layout; private Button closeButton; private List modButtons = new List(); private TextMeshProUGUI title; private TextMeshProUGUI warning; private bool initialized; internal ScrollRect scrollRect; internal ModButtonTooltip modTooltip; internal static Sprite tooltipSprite; private void Awake() { Setup(); } private void OnEnable() { Open(); } private void OnDisable() { Close(); } internal void Open() { Setup(); ((Component)this).transform.SetAsLastSibling(); ((ScreenTransition)dialog).SetActive(true, ((Component)this).gameObject, (Action)null, (Action)null); } internal void Close() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) Setup(); ((ScreenTransition)dialog).SetActive(false, ((Component)this).gameObject, (Action)null, (Action)null); ((Graphic)RelicSelectionDialog.Instance.bg).color = RelicSelectionDialog.BGColor; } internal void Setup() { if (!initialized) { initialized = true; Object.DestroyImmediate((Object)(object)((Component)this).gameObject.GetComponent()); InitializeBasicComponents(); SetupDialogAndScrollView(); SetupTitleAndWarning(); SetupGridLayout(); SetupModButtonTemplate(); SetupCloseButton(); ResetOrder(); modTooltip = CreateTooltip(); } } internal void CreateAllEntry() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) foreach (ModButtonInfo item in CreateModButtons()) { ModButtonUI modButtonUI = Object.Instantiate(layout, (Transform)(object)scrollRect.content); modButtonUI.modDialog = this; modButtonUI.Set(item); if (Chainloader.PluginInfos.ContainsKey("Patty_SoundChanger_MOD")) { int num = -357; ((Component)modButtonUI.toggleButton).GetComponent().anchoredPosition = new Vector2((float)num, 7f); } modButtons.Add(modButtonUI); } } private ModButtonTooltip CreateTooltip() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_004b: 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_0073: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown if ((Object)(object)tooltipSprite == (Object)null) { TooltipUI val = Object.FindObjectOfType(true); if ((Object)(object)val == (Object)null) { return null; } Image component = ((Component)((Component)val).transform.GetChild(0)).GetComponent(); tooltipSprite = Sprite.Create((Texture2D)((Graphic)component).mainTexture, new Rect(3f, 389f, 256f, 60f), new Vector2(128f, 30f), 100f, 0u, (SpriteMeshType)1, Vector4.one * 10f); } if ((Object)(object)tooltipSprite == (Object)null) { return null; } GameObject val2 = new GameObject("TooltipContent"); val2.transform.SetParent(((Component)this).transform, false); val2.SetActive(false); ModButtonTooltip modButtonTooltip = val2.AddOrGetComponent(); modButtonTooltip.optionDialog = this; return modButtonTooltip; } private void ResetOrder() { modButtons = modButtons.OrderBy((ModButtonUI modButton) => modButton.info.text).ToList(); for (int i = 0; i < modButtons.Count; i++) { ModButtonUI modButtonUI = modButtons[i]; ((Component)modButtonUI).transform.SetSiblingIndex(i); } } [IteratorStateMachine(typeof(d__19))] private IEnumerable CreateModButtons() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__19(-2) { <>4__this = this }; } private void InitializeBasicComponents() { ((Object)this).name = "ModOptionDialog"; dialog = ((Component)this).GetComponentInChildren(); scrollRect = ((Component)this).GetComponentInChildren(); } private void SetupDialogAndScrollView() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown Transform val = ((Component)this).transform.Find("Dialog/CloseButton"); Object.DestroyImmediate((Object)(object)((Component)val).GetComponent()); foreach (Transform item in (Transform)scrollRect.content) { Transform val2 = item; Object.DestroyImmediate((Object)(object)((Component)val2).gameObject); } } private void SetupTitleAndWarning() { Transform val = ((Component)dialog).transform.Find("Content/Info and Preview/Instructions"); title = ((Component)val.Find("Instructions label")).GetComponent(); Object.DestroyImmediate((Object)(object)((Component)title).GetComponent()); ((TMP_Text)title).text = "Change the mod options."; warning = ((Component)val.Find("Warning layout/Warning label")).GetComponent(); Object.DestroyImmediate((Object)(object)((Component)warning).GetComponent()); ((TMP_Text)warning).text = "Some options might requires you to re-open the menu for it to take effect. Hover into the option to view the description."; ((Component)val.parent.Find("Mutators preview")).gameObject.SetActive(false); } private void SetupGridLayout() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) GridLayoutGroup component = ((Component)scrollRect.content).GetComponent(); component.constraint = (Constraint)1; component.cellSize = new Vector2(434f, 100f); component.constraintCount = 3; } private void SetupModButtonTemplate() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)PatchList.modButtonPrefab == (Object)null) { PatchList.modButtonPrefab = ModButtonUI.CreateModButtonUI(null, default(ModButtonInfo)); Object.DontDestroyOnLoad((Object)(object)((Component)PatchList.modButtonPrefab).gameObject); } if ((Object)(object)PatchList.modButtonPrefab == (Object)null) { Plugin.LogSource.LogError((object)"Failed to create mod button prefab"); return; } layout = Object.Instantiate(PatchList.modButtonPrefab, ((Component)this).transform); ((Object)layout).name = "ModButtonUI Prefab"; ((Component)layout).transform.localScale = Vector3.one; ((Component)layout).gameObject.SetActive(false); } private void SetupCloseButton() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown Transform val = ((Component)this).transform.Find("Dialog/CloseButton"); closeButton = ((Component)val).gameObject.AddOrGetComponent