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.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.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace Patty_RelicPicker_MOD;
internal sealed class ConfigurationManagerAttributes
{
public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput);
public bool? ShowRangeAsPercent;
public Action<ConfigEntryBase> 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<object, string> ObjToStr;
public Func<string, object> StrToObj;
}
internal struct ModButtonInfo
{
internal Action<bool> onToggle;
internal ConfigEntry<bool> entry;
internal string text;
internal int fontSize;
internal ModButtonInfo(ConfigEntry<bool> entry, int fontSize = 31, Action<bool> onToggle = null)
{
this.onToggle = onToggle;
this.entry = entry;
text = ((ConfigEntryBase)entry).Definition.Key;
this.fontSize = fontSize;
}
internal ModButtonInfo(string text, ConfigEntry<bool> entry, int fontSize = 31, Action<bool> onToggle = null)
{
this.onToggle = onToggle;
this.entry = entry;
this.text = text;
this.fontSize = fontSize;
}
internal ModButtonInfo(string text, ConfigEntry<bool> 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_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Expected O, but got Unknown
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Expected O, but got Unknown
//IL_01b0: 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<Image>();
((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<VerticalLayoutGroup>();
layoutElement = ((Component)this).gameObject.AddComponent<LayoutElement>();
layoutElement.minWidth = 350f;
layoutElement.preferredWidth = 350f;
sizeFitter = ((Component)this).gameObject.AddComponent<ContentSizeFitter>();
sizeFitter.horizontalFit = (FitMode)2;
sizeFitter.verticalFit = (FitMode)2;
RunSetupScreen obj = (RunSetupScreen)AllGameManagers.Instance.GetScreenManager().GetScreen((ScreenName)42);
TextMeshProUGUI val = (TextMeshProUGUI)AccessTools.Field(typeof(RunSetupScreen), "championNameLabel").GetValue(obj);
label = Object.Instantiate<TextMeshProUGUI>(val, ((Component)this).transform);
((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<TextMeshProUGUI>();
}
if ((Object)(object)toggleButton == (Object)null)
{
toggleButton = ((Component)((Component)this).transform.GetChild(2)).GetComponent<GameUISelectableToggle>();
}
}
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 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_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Expected O, but got Unknown
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: 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<Image>(val2.GetComponentInChildren<Image>(), parent);
((Component)val3).transform.localPosition = Vector2.op_Implicit(new Vector2(500f, -460f));
((Component)val3).GetComponent<RectTransform>().pivot = Vector2.one * 0.5f;
TextMeshProUGUI componentInChildren = ((Component)val3).GetComponentInChildren<TextMeshProUGUI>();
((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>();
modButtonUI.label = componentInChildren;
modButtonUI.info.onToggle = info.onToggle;
Image val4 = new GameObject("Target Graphic").AddComponent<Image>();
((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<GameUISelectableToggle>(Object.FindObjectOfType<GameUISelectableToggle>(true), ((Component)val3).transform);
((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);
((Component)val5).transform.localPosition = Vector2.op_Implicit(new Vector2(62f, 55f));
modButtonUI.toggleButton = val5;
RectTransform component = ((Component)val5).GetComponent<RectTransform>();
component.anchoredPosition = new Vector2(component.anchoredPosition.x, 7f);
component.pivot = new Vector2(0.2f, 1f);
return modButtonUI;
}
}
internal class ModOptionDialog : MonoBehaviour
{
[CompilerGenerated]
private sealed class <CreateModButtons>d__19 : IEnumerable<ModButtonInfo>, IEnumerable, IEnumerator<ModButtonInfo>, IDisposable, IEnumerator
{
private int <>1__state;
private ModButtonInfo <>2__current;
private int <>l__initialThreadId;
public ModOptionDialog <>4__this;
ModButtonInfo IEnumerator<ModButtonInfo>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CreateModButtons>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
{
<>4__this.relicSelectionDialog.ResetMenu();
});
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = new ModButtonInfo(Plugin.ShowEnemyRelics, 25, delegate
{
<>4__this.relicSelectionDialog.ResetMenu();
});
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = new ModButtonInfo(Plugin.ShowCovenantRelics, 25, delegate
{
<>4__this.relicSelectionDialog.ResetMenu();
});
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
<>2__current = new ModButtonInfo(Plugin.ShowMutatorRelics, 25, delegate
{
<>4__this.relicSelectionDialog.ResetMenu();
});
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
<>2__current = new ModButtonInfo(Plugin.ShowPyreArtifactRelics, 25, delegate
{
<>4__this.relicSelectionDialog.ResetMenu();
});
<>1__state = 6;
return true;
case 6:
<>1__state = -1;
<>2__current = new ModButtonInfo(Plugin.ShowEndlessMutatorRelics, 25, delegate
{
<>4__this.relicSelectionDialog.ResetMenu();
});
<>1__state = 7;
return true;
case 7:
<>1__state = -1;
<>2__current = new ModButtonInfo(Plugin.ShowEnhancerRelics, 25, delegate
{
<>4__this.relicSelectionDialog.ResetMenu();
});
<>1__state = 8;
return true;
case 8:
<>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<ModButtonInfo> IEnumerable<ModButtonInfo>.GetEnumerator()
{
<CreateModButtons>d__19 result;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
result = this;
}
else
{
result = new <CreateModButtons>d__19(0)
{
<>4__this = <>4__this
};
}
return result;
}
[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<ModButtonInfo>)this).GetEnumerator();
}
}
private ScreenDialog dialog;
internal ModButtonUI layout;
private Button closeButton;
private List<ModButtonUI> modButtons = new List<ModButtonUI>();
private TextMeshProUGUI title;
private TextMeshProUGUI warning;
private bool initialized;
internal ScrollRect scrollRect;
internal RelicSelectionDialog relicSelectionDialog;
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_0028: 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.bg).color = RelicSelectionDialog.BGColor;
}
internal void Setup()
{
if (initialized)
{
return;
}
initialized = true;
Object.DestroyImmediate((Object)(object)((Component)this).gameObject.GetComponent<MutatorSelectionDialog>());
InitializeBasicComponents();
SetupDialogAndScrollView();
SetupTitleAndWarning();
SetupGridLayout();
SetupModButtonTemplate();
SetupCloseButton();
foreach (ModButtonInfo item in CreateModButtons())
{
ModButtonUI modButtonUI = Object.Instantiate<ModButtonUI>(layout, (Transform)(object)scrollRect.content);
modButtonUI.modDialog = this;
modButtonUI.Set(item);
modButtons.Add(modButtonUI);
}
ResetOrder();
modTooltip = CreateTooltip();
}
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<TooltipUI>(true);
if ((Object)(object)val == (Object)null)
{
return null;
}
Image component = ((Component)((Component)val).transform.GetChild(0)).GetComponent<Image>();
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.AddComponent<ModButtonTooltip>();
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(<CreateModButtons>d__19))]
private IEnumerable<ModButtonInfo> CreateModButtons()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CreateModButtons>d__19(-2)
{
<>4__this = this
};
}
private void InitializeBasicComponents()
{
((Object)this).name = "ModOptionDialog";
dialog = ((Component)this).GetComponentInChildren<ScreenDialog>();
scrollRect = ((Component)this).GetComponentInChildren<ScrollRect>();
}
private void SetupDialogAndScrollView()
{
Transform val = ((Component)this).transform.Find("Dialog/CloseButton");
Object.DestroyImmediate((Object)(object)((Component)val).GetComponent<GameUISelectableButton>());
Object.DestroyImmediate((Object)(object)((Component)((Transform)scrollRect.content).GetChild(0)).gameObject);
}
private void SetupTitleAndWarning()
{
Transform val = ((Component)dialog).transform.Find("Content/Info and Preview/Instructions");
title = ((Component)val.Find("Instructions label")).GetComponent<TextMeshProUGUI>();
Object.DestroyImmediate((Object)(object)((Component)title).GetComponent<Localize>());
((TMP_Text)title).text = "Change the mod options.";
warning = ((Component)val.Find("Warning layout/Warning label")).GetComponent<TextMeshProUGUI>();
Object.DestroyImmediate((Object)(object)((Component)warning).GetComponent<Localize>());
((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.";
}
private void SetupGridLayout()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
GridLayoutGroup component = ((Component)scrollRect.content).GetComponent<GridLayoutGroup>();
component.constraint = (Constraint)1;
component.cellSize = new Vector2(434f, 100f);
component.constraintCount = 3;
}
private void SetupModButtonTemplate()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
layout = ModButtonUI.CreateModButtonUI(((Component)this).transform, new ModButtonInfo("Placeholder"));
((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.AddComponent<Button>();
((Selectable)closeButton).targetGraphic = (Graphic)(object)((Component)((Component)closeButton).transform.Find("Target Graphic")).GetComponent<Image>();
((Component)closeButton).gameObject.SetActive(true);
closeButton.onClick = new ButtonClickedEvent();
((UnityEvent)closeButton.onClick).AddListener((UnityAction)delegate
{
SoundManager.PlaySfxSignal.Dispatch("UI_Click");
Close();
});
}
}
internal class PatchList
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Func<KeyValuePair<RelicData, ConfigEntry<bool>>, string> <>9__1_0;
public static ScreenActiveCallback <>9__2_0;
internal string <StartGame>b__1_0(KeyValuePair<RelicData, ConfigEntry<bool>> pair)
{
return pair.Key.GetName();
}
internal void <StartLoadingScreen>b__2_0(IScreen screen)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
RunSetupScreen obj = (RunSetupScreen)screen;
MutatorSelectionDialog val = (MutatorSelectionDialog)AccessTools.Field(typeof(RunSetupScreen), "mutatorSelectionDialog").GetValue(obj);
GameUISelectableButton val2 = (GameUISelectableButton)AccessTools.Field(typeof(RunSetupScreen), "pyreHeartButton").GetValue(obj);
if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
{
Plugin.LogSource.LogError((object)"Waaaaaaaat");
return;
}
MutatorSelectionDialog val3 = Object.Instantiate<MutatorSelectionDialog>(val, ((Component)val).transform.parent.parent);
RelicSelectionDialog.Instance = ((Component)val3).gameObject.AddComponent<RelicSelectionDialog>();
((Object)RelicSelectionDialog.Instance).name = "RelicSelectionDialog";
RelicSelectionDialog.Instance.Setup();
Object.DestroyImmediate((Object)(object)((Component)val3).gameObject.GetComponent<MutatorSelectionDialog>());
Transform val4 = Object.Instantiate<Transform>(((Component)val2).transform.parent.parent, ((Component)val2).transform.parent.parent.parent);
((Component)val4).gameObject.AddComponent<SetRelicsButton>();
Object.DestroyImmediate((Object)(object)((Component)val4).gameObject.GetComponent<PyreHeartInfoUI>());
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(AppManager), "DoesThisBuildReportErrors")]
public static void DisableErrorReportingPatch(ref bool __result)
{
__result = false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameStateManager), "StartGame")]
public static void StartGame(RunType runType)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
if ((int)runType == 5 && !Plugin.EnableOnChallenge.Value)
{
return;
}
foreach (KeyValuePair<RelicData, ConfigEntry<bool>> item in Plugin.Entries.OrderBy((KeyValuePair<RelicData, ConfigEntry<bool>> pair) => pair.Key.GetName()))
{
if (item.Value.Value && (!(item.Key is SinsData) || Plugin.ShowEnemyRelics.Value) && (!(item.Key is CovenantData) || Plugin.ShowCovenantRelics.Value) && (!(item.Key is MutatorData) || Plugin.ShowMutatorRelics.Value) && (!(item.Key is PyreArtifactData) || Plugin.ShowPyreArtifactRelics.Value) && (!(item.Key is EndlessMutatorData) || Plugin.ShowEndlessMutatorRelics.Value) && (!(item.Key is EnhancerData) || Plugin.ShowEnhancerRelics.Value))
{
AllGameManagers.Instance.GetSaveManager().AddRelic(item.Key);
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LoadScreen), "StartLoadingScreen")]
public static void StartLoadingScreen(LoadScreen __instance, ref ScreenActiveCallback ___screenActiveCallback)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
Plugin.InitializeConfigs();
if ((int)__instance.name != 42)
{
return;
}
ScreenActiveCallback a = ___screenActiveCallback;
object obj = <>c.<>9__2_0;
if (obj == null)
{
ScreenActiveCallback val = delegate(IScreen screen)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
RunSetupScreen obj2 = (RunSetupScreen)screen;
MutatorSelectionDialog val2 = (MutatorSelectionDialog)AccessTools.Field(typeof(RunSetupScreen), "mutatorSelectionDialog").GetValue(obj2);
GameUISelectableButton val3 = (GameUISelectableButton)AccessTools.Field(typeof(RunSetupScreen), "pyreHeartButton").GetValue(obj2);
if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null)
{
Plugin.LogSource.LogError((object)"Waaaaaaaat");
}
else
{
MutatorSelectionDialog val4 = Object.Instantiate<MutatorSelectionDialog>(val2, ((Component)val2).transform.parent.parent);
RelicSelectionDialog.Instance = ((Component)val4).gameObject.AddComponent<RelicSelectionDialog>();
((Object)RelicSelectionDialog.Instance).name = "RelicSelectionDialog";
RelicSelectionDialog.Instance.Setup();
Object.DestroyImmediate((Object)(object)((Component)val4).gameObject.GetComponent<MutatorSelectionDialog>());
Transform val5 = Object.Instantiate<Transform>(((Component)val3).transform.parent.parent, ((Component)val3).transform.parent.parent.parent);
((Component)val5).gameObject.AddComponent<SetRelicsButton>();
Object.DestroyImmediate((Object)(object)((Component)val5).gameObject.GetComponent<PyreHeartInfoUI>());
}
};
<>c.<>9__2_0 = val;
obj = (object)val;
}
___screenActiveCallback = (ScreenActiveCallback)Delegate.Combine((Delegate?)(object)a, (Delegate?)obj);
}
}
[BepInPlugin("Patty_RelicPicker_MOD", "Relic Picker", "2.0.0")]
internal class Plugin : BaseUnityPlugin
{
internal static readonly OrderedDictionary ClanNameTranslationTerm = new OrderedDictionary
{
{ "NonClass", "Clanless" },
{ "ClassData_titleLoc-604d44e6022d1c24-a3e4db5fc0afb9647906b33012f7b6e3-v2", "Banished" },
{ "ClassData_titleLoc-b946b201735c4048-fed615dbf2f84274ab8b72a7f7056fa8-v2", "Pyreborne" },
{ "ClassData_titleLoc-8338ffb122ab2e96-30528e09008d5c74fb51ff909ff75876-v2", "Luna Coven" },
{ "ClassData_titleLoc-9948d88fb75b25c9-d03f152bb38a72748891caa14769abd1-v2", "Underlegion" },
{ "ClassData_titleLoc-d85783c925521680-a6f5d6167ffd9dc4781b19278b89d2e1-v2", "Lazarus League" },
{ "ClassData_titleLoc-eb038694d9e044bb-b152a27f359a4e04cbcc29055c2f836b-v2", "Hellhorned" },
{ "ClassData_titleLoc-f76bea8450f06f67-55d2f9d7591683f4ca58a33311477d92-v2", "Awoken" },
{ "ClassData_titleLoc-37d27dbaadc5f40f-861c056fdeda9814284a85e9b3f034d0-v2", "Stygian Guard" },
{ "ClassData_titleLoc-2e445261f0cc3308-6f37f31f362b3c44e96df0656095657a-v2", "Umbra" },
{ "ClassData_titleLoc-1438fe314ad47795-95d25698eaac978488921909b1239bbc-v2", "Melting Remnant" }
};
internal static readonly OrderedDictionary RelicRarityTranslationTerm = new OrderedDictionary
{
{ "Compendium_Filter_CardType_All", "All" },
{ "CardRarity_Champion", "Champion" },
{ "CardRarity_Common", "Common" },
{ "CardRarity_Uncommon", "Uncommon" },
{ "CardRarity_Rare", "Rare" }
};
internal static ManualLogSource LogSource { get; private set; }
internal static Harmony PluginHarmony { get; private set; }
internal static Dictionary<RelicData, ConfigEntry<bool>> Entries { get; private set; } = new Dictionary<RelicData, ConfigEntry<bool>>();
internal static ConfigFile Config { get; private set; }
internal static ConfigEntry<bool> EnableOnChallenge { get; private set; }
internal static ConfigEntry<bool> ShowUncollectableRelics { get; private set; }
internal static ConfigEntry<bool> ShowEnemyRelics { get; private set; }
internal static ConfigEntry<bool> ShowCovenantRelics { get; private set; }
internal static ConfigEntry<bool> ShowMutatorRelics { get; private set; }
internal static ConfigEntry<bool> ShowPyreArtifactRelics { get; private set; }
internal static ConfigEntry<bool> ShowEndlessMutatorRelics { get; private set; }
internal static ConfigEntry<bool> ShowEnhancerRelics { get; private set; }
internal static bool InitializedConfigs { get; private set; }
private void Awake()
{
//IL_0038: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_0081: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Expected O, but got Unknown
//IL_00b1: Expected O, but got Unknown
//IL_00c6: 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_00e1: Expected O, but got Unknown
//IL_00e1: Expected O, but got Unknown
//IL_00f6: 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_0111: Expected O, but got Unknown
//IL_0111: Expected O, but got Unknown
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Expected O, but got Unknown
//IL_0141: Expected O, but got Unknown
//IL_0156: 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_0171: Expected O, but got Unknown
//IL_0171: Expected O, but got Unknown
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Expected O, but got Unknown
//IL_01a1: Expected O, but got Unknown
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Expected O, but got Unknown
//IL_01d1: Expected O, but got Unknown
Config = ((BaseUnityPlugin)this).Config;
LogSource = ((BaseUnityPlugin)this).Logger;
try
{
PluginHarmony = Harmony.CreateAndPatchAll(typeof(PatchList), "Patty_RelicPicker_MOD");
}
catch (HarmonyException val)
{
HarmonyException val2 = val;
LogSource.LogError((object)((Exception)(((object)((Exception)(object)val2).InnerException) ?? ((object)val2))).Message);
}
EnableOnChallenge = Config.Bind<bool>(new ConfigDefinition("Basic", "Enable on Challenge Run"), true, new ConfigDescription("Enable to start Challenge modes with the relic you chose in the menu.", (AcceptableValueBase)null, Array.Empty<object>()));
ShowUncollectableRelics = Config.Bind<bool>(new ConfigDefinition("Basic", "Show Uncollectable Relics"), true, new ConfigDescription("Enable to show uncollectable relic (Some can be error). Proceed with caution.", (AcceptableValueBase)null, Array.Empty<object>()));
ShowEnemyRelics = Config.Bind<bool>(new ConfigDefinition("Basic", "Show Enemy Relics"), false, new ConfigDescription("Enable to show enemy relic (Some can be error). Proceed with caution.", (AcceptableValueBase)null, Array.Empty<object>()));
ShowCovenantRelics = Config.Bind<bool>(new ConfigDefinition("Basic", "Show Covenant Relics"), false, new ConfigDescription("Enable to show covenant relic (Some can be error). Proceed with caution.", (AcceptableValueBase)null, Array.Empty<object>()));
ShowMutatorRelics = Config.Bind<bool>(new ConfigDefinition("Basic", "Show Mutator Relics"), false, new ConfigDescription("Enable to show mutator relic (Some can be error). Proceed with caution.", (AcceptableValueBase)null, Array.Empty<object>()));
ShowPyreArtifactRelics = Config.Bind<bool>(new ConfigDefinition("Basic", "Show Pyre Artifacts Relics"), false, new ConfigDescription("Enable to show pyre artifacts relic (Some can be error). Proceed with caution.", (AcceptableValueBase)null, Array.Empty<object>()));
ShowEndlessMutatorRelics = Config.Bind<bool>(new ConfigDefinition("Basic", "Show Endless Mutator Relics"), true, new ConfigDescription("Enable to show endless mutator relic (Some can be error). Proceed with caution.", (AcceptableValueBase)null, Array.Empty<object>()));
ShowEnhancerRelics = Config.Bind<bool>(new ConfigDefinition("Basic", "Show Enhancer Relics"), false, new ConfigDescription("Enable to show enhancer relic (Some can be error). Proceed with caution.", (AcceptableValueBase)null, Array.Empty<object>()));
}
internal static AllGameData GetAllGameData()
{
return AllGameManagers.Instance.GetAllGameData();
}
internal static void InitializeConfigs()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
if (InitializedConfigs || (Object)(object)AllGameManagers.Instance == (Object)null)
{
return;
}
InitializedConfigs = true;
foreach (RelicData allRelicData in GetAllRelicDatas())
{
ConfigDefinition val = new ConfigDefinition("Relic Effects", ((Object)allRelicData).name);
Entries[allRelicData] = Config.Bind<bool>(val, false, new ConfigDescription(allRelicData.GetDescription(), (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
}
}
internal static IEnumerable<RelicData> GetAllRelicDatas()
{
AllGameData allGameData = AllGameManagers.Instance.GetAllGameData();
IEnumerable<RelicData> first = (IEnumerable<RelicData>)((!ShowUncollectableRelics.Value) ? allGameData.CollectAllAccessibleRelicDatas(AllGameManagers.Instance.GetSaveManager()) : allGameData.GetAllCollectableRelicData());
first = first.Union((IEnumerable<RelicData>)allGameData.GetAllSinsDatas());
first = first.Union((IEnumerable<RelicData>)allGameData.GetAllCovenantDatas());
first = first.Union((IEnumerable<RelicData>)allGameData.GetAllMutatorData());
first = first.Union((IEnumerable<RelicData>)allGameData.GetAllPyreArtifactDatas());
List<EndlessMutatorData> second = (List<EndlessMutatorData>)AccessTools.Field(typeof(AllGameData), "endlessMutatorDatas").GetValue(allGameData);
first = first.Union((IEnumerable<RelicData>)second);
first = first.Union((IEnumerable<RelicData>)allGameData.GetAllEnhancerData());
return first.Where(delegate(RelicData relicData)
{
//IL_002e: 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)
if ((Object)(object)relicData == (Object)null)
{
return false;
}
CollectableRelicData val = (CollectableRelicData)(object)((relicData is CollectableRelicData) ? relicData : null);
if (val != null)
{
return AllGameManagers.Instance.GetSaveManager().IsDlcInstalled(val.GetRequiredDLC());
}
MutatorData val2 = (MutatorData)(object)((relicData is MutatorData) ? relicData : null);
return val2 == null || AllGameManagers.Instance.GetSaveManager().IsDlcInstalled(val2.GetRequiredDLC());
});
}
}
public static class PluginInfo
{
public const string GUID = "Patty_RelicPicker_MOD";
public const string Name = "Relic Picker";
public const string Version = "2.0.0";
}
internal class RelicButtonUI : MonoBehaviour
{
private Image icon;
private TextMeshProUGUI titleLabel;
private TextMeshProUGUI descriptionLabel;
private ColorSwapper selectedColorSwapper;
private bool initialized;
public GameUISelectableButton Button { get; private set; }
public bool Chosen { get; private set; }
public RelicData Data { get; private set; }
private void Start()
{
Setup();
}
private void Setup()
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
if (initialized)
{
return;
}
initialized = true;
Button = ((Component)this).GetComponent<GameUISelectableButton>();
icon = ((Component)((Component)this).transform.Find("Icon")).GetComponent<Image>();
titleLabel = ((Component)((Component)this).transform.Find("Name label")).GetComponent<TextMeshProUGUI>();
descriptionLabel = ((Component)((Component)this).transform.Find("Description label")).GetComponent<TextMeshProUGUI>();
selectedColorSwapper = ((Component)((Component)this).transform.Find("Target Graphic")).GetComponent<ColorSwapper>();
((Button)Button).onClick = new ButtonClickedEvent();
((UnityEvent)((Button)Button).onClick).AddListener((UnityAction)delegate
{
ToggleChosenState(!Chosen);
if (Chosen)
{
SoundManager.PlaySfxSignal.Dispatch("UI_Click");
}
else
{
SoundManager.PlaySfxSignal.Dispatch("UI_Cancel");
}
});
}
public void Clear()
{
((Component)this).gameObject.SetActive(false);
Data = null;
}
public void Set(RelicData data)
{
Setup();
Data = data;
icon.sprite = data.GetIcon();
TextMeshProHelper.SetTextSafe((TMP_Text)(object)titleLabel, data.GetName(), true);
TextMeshProHelper.SetTextSafe((TMP_Text)(object)descriptionLabel, data.GetDescription(), true);
ToggleChosenState(Plugin.Entries[Data].Value);
}
public void ToggleChosenState(bool chosen)
{
//IL_0041: 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_005e: 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)
Chosen = chosen;
Plugin.Entries[Data].Value = Chosen;
float num = (chosen ? 1f : 0.5f);
((Graphic)titleLabel).color = ColorUtil.SetAlpha(((Graphic)titleLabel).color, num);
((Graphic)descriptionLabel).color = ColorUtil.SetAlpha(((Graphic)descriptionLabel).color, num);
if ((Object)(object)selectedColorSwapper != (Object)null)
{
selectedColorSwapper.SetAlternativeColor(!chosen, 0f, (Ease)0, 0f);
}
}
}
internal class RelicSelectionDialog : MonoBehaviour
{
[CompilerGenerated]
private sealed class <CreateCustomDropdown>d__44 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public RelicSelectionDialog <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CreateCustomDropdown>d__44(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if ((Object)(object)<>4__this.dropdownPrefab == (Object)null)
{
<>4__this.dropdownPrefab = Object.FindObjectOfType<GameUISelectableDropdown>(true);
}
<>4__this.customDropdown = <>4__this.CreateDropdownWithOptions(<>4__this.preview, null, <>4__this.CustomNames);
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.SetupDropdownButtonListeners(<>4__this.customDropdown);
<>4__this.customDropdown.optionChosenSignal.AddListener((Action<int, string>)delegate(int index, string optionName)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (!(selectedCustom == optionName))
{
selectedCustom = optionName;
((Selectable)<>4__this.factionDropdown).interactable = optionName == "None";
<>4__this.LoadRelics(selectedRarity, selectedFaction, selectedCustom);
}
});
<>4__this.customDropdown.SetIndex(0);
selectedCustom = "None";
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();
}
}
[CompilerGenerated]
private sealed class <CreateDropdownList>d__43 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public RelicSelectionDialog <>4__this;
private IEnumerator <>s__1;
private Transform <transform>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CreateDropdownList>d__43(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__1 = null;
<transform>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Expected O, but got Unknown
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>s__1 = <>4__this.preview.GetEnumerator();
try
{
while (<>s__1.MoveNext())
{
<transform>5__2 = (Transform)<>s__1.Current;
Object.Destroy((Object)(object)((Component)<transform>5__2).gameObject);
<transform>5__2 = null;
}
}
finally
{
if (<>s__1 is IDisposable disposable)
{
disposable.Dispose();
}
}
<>s__1 = null;
Object.DestroyImmediate((Object)(object)((Component)<>4__this.preview).GetComponent<HorizontalLayoutGroup>());
((Component)<>4__this.preview).gameObject.AddComponent<VerticalLayoutGroup>();
if ((Object)(object)<>4__this.dropdownPrefab == (Object)null)
{
<>4__this.dropdownPrefab = Object.FindObjectOfType<GameUISelectableDropdown>(true);
}
<>4__this.factionDropdown = <>4__this.CreateDropdownWithOptions(<>4__this.preview, null, <>4__this.FactionNames);
<>4__this.rarityDropdown = <>4__this.CreateDropdownWithOptions(<>4__this.preview, Plugin.RelicRarityTranslationTerm);
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.SetupDropdownButtonListeners(<>4__this.factionDropdown);
<>4__this.SetupDropdownButtonListeners(<>4__this.rarityDropdown);
<>4__this.factionDropdown.optionChosenSignal.AddListener((Action<int, string>)delegate(int index, string optionName)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (!(selectedFactionString == optionName))
{
selectedFactionString = optionName;
selectedFaction = (ClassData)<>4__this.RelicFactionOptions[optionName];
<>4__this.LoadRelics(selectedRarity, selectedFaction);
}
});
<>4__this.rarityDropdown.optionChosenSignal.AddListener((Action<int, string>)delegate(int index, string optionName)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
if (selectedRarity != (CollectableRarity)<>4__this.RelicRarityOptions[optionName])
{
selectedRarity = (CollectableRarity)<>4__this.RelicRarityOptions[optionName];
<>4__this.LoadRelics(selectedRarity, selectedFaction);
}
});
<>4__this.factionDropdown.SetIndex(1);
<>4__this.rarityDropdown.SetIndex(0);
selectedFaction = (ClassData)<>4__this.RelicFactionOptions[1];
selectedRarity = (CollectableRarity)<>4__this.RelicRarityOptions[0];
<>4__this.LoadRelics(selectedRarity, selectedFaction);
((Component)<>4__this.preview).gameObject.SetActive(true);
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();
}
}
internal static readonly Color BGColor = new Color(0f, 0f, 0f, 0.902f);
private ScreenDialog dialog;
private ScrollRect scrollRect;
private RelicButtonUI layout;
private Button closeButton;
private List<RelicButtonUI> relicButtons = new List<RelicButtonUI>();
private TextMeshProUGUI title;
private TextMeshProUGUI warning;
internal Image bg;
private bool initialized;
private bool initializedOptions;
internal static string allClanName;
internal static string selectedCustom;
internal static string selectedFactionString;
internal static ClassData selectedFaction;
internal static CollectableRarity selectedRarity = (CollectableRarity)0;
internal readonly HashSet<string> FactionNames = new HashSet<string>();
internal readonly HashSet<string> CustomNames = new HashSet<string>();
internal readonly OrderedDictionary RelicFactionOptions = new OrderedDictionary();
internal readonly OrderedDictionary RelicRarityOptions = new OrderedDictionary();
internal readonly OrderedDictionary CustomOptions = new OrderedDictionary();
internal GameUISelectableDropdown dropdownPrefab;
internal GameUISelectableDropdown factionDropdown;
internal GameUISelectableDropdown rarityDropdown;
internal GameUISelectableDropdown customDropdown;
internal Transform preview;
internal static RelicSelectionDialog Instance { get; set; }
private void Awake()
{
Setup();
}
private void OnEnable()
{
Open();
}
private void OnDisable()
{
Close();
}
internal void Open()
{
Setup();
if (!initializedOptions)
{
initializedOptions = true;
((MonoBehaviour)this).StartCoroutine(CreateDropdownList());
((MonoBehaviour)this).StartCoroutine(CreateCustomDropdown());
}
else
{
ResetOrder();
}
((Component)this).transform.SetAsLastSibling();
((ScreenTransition)dialog).SetActive(true, ((Component)this).gameObject, (Action)null, (Action)null);
}
internal void ResetOrder()
{
relicButtons = (from relicButton in relicButtons
orderby Plugin.Entries[relicButton.Data].Value descending, relicButton.Data.Cheat_GetNameEnglish()
select relicButton).ToList();
for (int i = 0; i < relicButtons.Count; i++)
{
RelicButtonUI relicButtonUI = relicButtons[i];
relicButtonUI.ToggleChosenState(Plugin.Entries[relicButtonUI.Data].Value);
((Component)relicButtonUI).transform.SetSiblingIndex(i);
}
}
internal void Close()
{
Setup();
((ScreenTransition)dialog).SetActive(false, ((Component)this).gameObject, (Action)null, (Action)null);
}
internal void Setup()
{
if (!initialized)
{
initialized = true;
bg = ((Component)((Component)this).transform.Find("Dialog Overlay")).GetComponent<Image>();
InitializeComponents();
SetupDialogText();
CreateTemplateButton();
SetupCloseButton();
GenerateRelicEntry();
SetupOptions();
SetupResetButton(Object.FindObjectOfType<UIFooter>());
}
}
private void SetupResetButton(UIFooter uiFooter)
{
//IL_003c: 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_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Expected O, but got Unknown
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Expected O, but got Unknown
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Expected O, but got Unknown
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Expected O, but got Unknown
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Expected O, but got Unknown
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Expected O, but got Unknown
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Expected O, but got Unknown
//IL_031a: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Expected O, but got Unknown
Button val = Object.Instantiate<Button>(closeButton, ((Component)this).transform);
((Object)val).name = "Reset Button";
((Component)val).transform.localPosition = Vector2.op_Implicit(new Vector2(0f, -460f));
Object.DestroyImmediate((Object)(object)((Component)((Selectable)val).targetGraphic).gameObject);
Object.DestroyImmediate((Object)(object)((Component)((Component)val).transform.Find("Image close icon")).gameObject);
TextMeshProUGUI component = ((Component)((Component)uiFooter).transform.Find("Swap Champion Button/Label")).GetComponent<TextMeshProUGUI>();
TextMeshProUGUI val2 = Object.Instantiate<TextMeshProUGUI>(component, ((Component)val).transform);
Object.DestroyImmediate((Object)(object)((Component)val2).GetComponent<Localize>());
((Object)val2).name = "Label";
((TMP_Text)val2).fontSizeMin = ((TMP_Text)val2).fontSizeMax;
((TMP_Text)val2).fontSize = ((TMP_Text)val2).fontSizeMax;
((TMP_Text)val2).text = "Reset Current Page";
((Selectable)val).targetGraphic = (Graphic)(object)Object.Instantiate<Image>(((Component)((Component)uiFooter).transform.Find("Swap Champion Button/Target Graphic")).GetComponent<Image>(), ((Component)val).transform);
((Object)((Selectable)val).targetGraphic).name = "Target Graphic";
((Component)((Selectable)val).targetGraphic).GetComponent<RectTransform>().sizeDelta = new Vector2(300f, 112f);
((Component)((Selectable)val).targetGraphic).transform.SetAsFirstSibling();
val.onClick = new ButtonClickedEvent();
((UnityEvent)val.onClick).AddListener((UnityAction)delegate
{
SoundManager.PlaySfxSignal.Dispatch("UI_Click");
foreach (RelicButtonUI relicButton in relicButtons)
{
relicButton.ToggleChosenState(chosen: false);
}
ResetOrder();
});
RectTransform component2 = ((Component)((Component)val).transform.Find("Hitbox Invis")).GetComponent<RectTransform>();
((Transform)component2).localRotation = Quaternion.identity;
component2.sizeDelta = new Vector2(280f, 0f);
Button val3 = Object.Instantiate<Button>(val, ((Component)this).transform);
((Object)val3).name = "Reset All Button";
((Component)val3).transform.localPosition = Vector2.op_Implicit(new Vector2(-500f, -460f));
((TMP_Text)((Component)((Component)val3).transform.Find("Label")).GetComponent<TextMeshProUGUI>()).text = "Reset All";
val3.onClick = new ButtonClickedEvent();
((UnityEvent)val3.onClick).AddListener((UnityAction)delegate
{
SoundManager.PlaySfxSignal.Dispatch("UI_Click");
foreach (KeyValuePair<RelicData, ConfigEntry<bool>> entry in Plugin.Entries)
{
entry.Value.Value = false;
}
foreach (RelicButtonUI relicButton2 in relicButtons)
{
relicButton2.ToggleChosenState(chosen: false);
}
ResetOrder();
});
RunSetupScreen obj = (RunSetupScreen)AllGameManagers.Instance.GetScreenManager().GetScreen((ScreenName)42);
MutatorSelectionDialog val4 = (MutatorSelectionDialog)AccessTools.Field(typeof(RunSetupScreen), "mutatorSelectionDialog").GetValue(obj);
MutatorSelectionDialog val5 = Object.Instantiate<MutatorSelectionDialog>(val4, ((Component)val4).transform.parent.parent);
ModOptionDialog modOptionDialog = ((Component)val5).gameObject.AddComponent<ModOptionDialog>();
modOptionDialog.relicSelectionDialog = this;
modOptionDialog.Setup();
Button val6 = Object.Instantiate<Button>(val, ((Component)this).transform);
((Object)val6).name = "Advanced Button";
((Component)val6).transform.localPosition = Vector2.op_Implicit(new Vector2(500f, -460f));
((TMP_Text)((Component)((Component)val6).transform.Find("Label")).GetComponent<TextMeshProUGUI>()).text = "Options";
val6.onClick = new ButtonClickedEvent();
((UnityEvent)val6.onClick).AddListener((UnityAction)delegate
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
SoundManager.PlaySfxSignal.Dispatch("UI_Click");
((Graphic)bg).color = new Color(0f, 0f, 0f, 0.502f);
modOptionDialog.Open();
factionDropdown.Close();
rarityDropdown.Close();
customDropdown.Close();
});
}
private void SetupOptions()
{
List<string> source = Plugin.ClanNameTranslationTerm.Keys.Cast<string>().ToList();
List<string> orderedClass = Plugin.ClanNameTranslationTerm.Values.Cast<string>().ToList();
allClanName = LocalizationManager.GetTranslation(Plugin.RelicRarityTranslationTerm.Keys.Cast<string>().First(), true, 0, true, true, (GameObject)null, (string)null, (ILocalizationParameterContext)null);
FactionNames.Add(allClanName);
RelicFactionOptions[allClanName] = null;
string translation = LocalizationManager.GetTranslation(source.First(), true, 0, true, true, (GameObject)null, (string)null, (ILocalizationParameterContext)null);
RelicFactionOptions[translation] = null;
FactionNames.Add(translation);
IReadOnlyList<ClassData> allClassDatas = Plugin.GetAllGameData().GetAllClassDatas();
IOrderedEnumerable<ClassData> first = from data in allClassDatas
where orderedClass.Contains(data.Cheat_GetNameEnglish())
orderby orderedClass.IndexOf(data.Cheat_GetNameEnglish())
select data;
IOrderedEnumerable<ClassData> second = from data in allClassDatas
where !orderedClass.Contains(data.Cheat_GetNameEnglish())
orderby data.GetTitle()
select data;
foreach (ClassData item in first.Union(second))
{
string text = item.GetTitle();
FactionNames.Add(text);
RelicFactionOptions[text] = item;
}
string key = default(string);
foreach (DictionaryEntry item2 in Plugin.RelicRarityTranslationTerm)
{
if (!LocalizationManager.TryGetTranslation((string)item2.Key, ref key, true, 0, true, true, (GameObject)null, (string)null, (ILocalizationParameterContext)null))
{
key = (string)item2.Value;
}
object value = item2.Value;
object obj = value;
switch (obj as string)
{
case "All":
RelicRarityOptions[key] = (object)(CollectableRarity)(-9999);
break;
case "Champion":
RelicRarityOptions[key] = (object)(CollectableRarity)3;
break;
case "Common":
RelicRarityOptions[key] = (object)(CollectableRarity)0;
break;
case "Uncommon":
RelicRarityOptions[key] = (object)(CollectableRarity)1;
break;
case "Rare":
RelicRarityOptions[key] = (object)(CollectableRarity)2;
break;
}
}
SetupCustomOptions();
}
internal void SetupCustomOptions()
{
CustomNames.Add("None");
RelicFactionOptions["None"] = null;
if (Plugin.ShowEnemyRelics.Value)
{
string text = "Enemy";
CustomNames.Add(text);
CustomOptions[text] = null;
}
if (Plugin.ShowCovenantRelics.Value)
{
string text2 = "Covenant";
CustomNames.Add(text2);
CustomOptions[text2] = null;
}
if (Plugin.ShowMutatorRelics.Value)
{
string text3 = "Mutator";
CustomNames.Add(text3);
CustomOptions[text3] = null;
}
if (Plugin.ShowPyreArtifactRelics.Value)
{
string text4 = "Pyre Heart";
CustomNames.Add(text4);
CustomOptions[text4] = null;
}
if (Plugin.ShowEndlessMutatorRelics.Value)
{
string text5 = "Endless Mutator";
CustomNames.Add(text5);
CustomOptions[text5] = null;
}
if (Plugin.ShowEnhancerRelics.Value)
{
string text6 = "Enhancer";
CustomNames.Add(text6);
CustomOptions[text6] = null;
}
}
internal void ResetMenu()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
Object.Destroy((Object)(object)((Component)customDropdown).gameObject);
CustomNames.Clear();
CustomOptions.Clear();
SetupCustomOptions();
((MonoBehaviour)this).StartCoroutine(CreateCustomDropdown());
LoadRelics(selectedRarity, selectedFaction);
}
private GameUISelectableDropdown CreateDropdownWithOptions(Transform parent, OrderedDictionary translatedTerms = null, HashSet<string> customOptions = null)
{
//IL_001b: 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)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Expected O, but got Unknown
GameUISelectableDropdown dropdown = Object.Instantiate<GameUISelectableDropdown>(dropdownPrefab, parent);
List<string> list = default(List<string>);
UsingGenericPoolObject<List<string>> list2 = GenericPools.GetList<string>(ref list);
try
{
if (translatedTerms != null)
{
string item = default(string);
foreach (DictionaryEntry translatedTerm in translatedTerms)
{
if (!LocalizationManager.TryGetTranslation((string)translatedTerm.Key, ref item, true, 0, true, true, (GameObject)null, (string)null, (ILocalizationParameterContext)null))
{
item = (string)translatedTerm.Value;
}
list.Add(item);
}
}
if (customOptions != null)
{
list.AddRange(customOptions);
}
ListExtensions.RemoveDuplicates<string>(list);
dropdown.SetOptions(list);
}
finally
{
((IDisposable)list2).Dispose();
}
((UnityEvent)((Button)dropdown).onClick).AddListener((UnityAction)delegate
{
CoreInputControlMapping val = default(CoreInputControlMapping);
((CoreInput)InputManager.Inst).TryGetSignaledInputMapping(MappingID.op_Implicit((Enum)(object)(Controls)19), ref val);
dropdown.ApplyScreenInput(val, (IGameUIComponent)(object)dropdown, (Controls)19);
});
return dropdown;
}
private void SetupDropdownButtonListeners(GameUISelectableDropdown targetDropdown)
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
GameUISelectableButton[] componentsInChildren = ((Component)targetDropdown).GetComponentsInChildren<GameUISelectableButton>(true);
foreach (GameUISelectableButton button in componentsInChildren)
{
if (!((Object)(object)button == (Object)(object)targetDropdown))
{
((UnityEvent)((Button)button).onClick).AddListener((UnityAction)delegate
{
CoreInputControlMapping val = default(CoreInputControlMapping);
((CoreInput)InputManager.Inst).TryGetSignaledInputMapping(MappingID.op_Implicit((Enum)(object)(Controls)19), ref val);
targetDropdown.ApplyScreenInput(val, (IGameUIComponent)(object)button, (Controls)19);
});
}
}
}
[IteratorStateMachine(typeof(<CreateDropdownList>d__43))]
private IEnumerator CreateDropdownList()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CreateDropdownList>d__43(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<CreateCustomDropdown>d__44))]
private IEnumerator CreateCustomDropdown()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CreateCustomDropdown>d__44(0)
{
<>4__this = this
};
}
private void InitializeComponents()
{
Instance = this;
((Object)((Component)this).gameObject).name = "RelicSelectionDialog";
dialog = ((Component)this).GetComponentInChildren<ScreenDialog>();
scrollRect = ((Component)this).GetComponentInChildren<ScrollRect>();
preview = ((Component)dialog).transform.Find("Content/Info and Preview/Mutators preview");
Transform val = ((Component)this).transform.Find("Dialog/CloseButton");
Object.DestroyImmediate((Object)(object)((Component)val).GetComponent<GameUISelectableButton>());
}
private void SetupDialogText()
{
Transform val = ((Component)dialog).transform.Find("Content/Info and Preview/Instructions");
title = ((Component)val.Find("Instructions label")).GetComponent<TextMeshProUGUI>();
Object.DestroyImmediate((Object)(object)((Component)title).GetComponent<Localize>());
((TMP_Text)title).text = "Choose any relics to customize your run.";
warning = ((Component)val.Find("Warning layout/Warning label")).GetComponent<TextMeshProUGUI>();
Object.DestroyImmediate((Object)(object)((Component)warning).GetComponent<Localize>());
((TMP_Text)warning).text = "Not every relic here has been tested, enabled relic will be sorted at the top. Re-open the menu to sort it";
}
private void CreateTemplateButton()
{
layout = ((Component)((Transform)scrollRect.content).GetChild(0)).gameObject.AddComponent<RelicButtonUI>();
RelicData data = Plugin.GetAllRelicDatas().FirstOrDefault((Func<RelicData, bool>)((RelicData relic) => !string.IsNullOrWhiteSpace(relic.Cheat_GetNameEnglish())));
layout.Set(data);
((Component)layout).gameObject.SetActive(false);
}
private void SetupCloseButton()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
closeButton = ((Component)((Component)this).transform.Find("Dialog/CloseButton")).gameObject.AddComponent<Button>();
((Selectable)closeButton).targetGraphic = (Graphic)(object)((Component)((Component)closeButton).transform.Find("Target Graphic")).GetComponent<Image>();
((Component)closeButton).gameObject.SetActive(true);
closeButton.onClick = new ButtonClickedEvent();
((UnityEvent)closeButton.onClick).AddListener((UnityAction)delegate
{
SoundManager.PlaySfxSignal.Dispatch("UI_Click");
Close();
});
}
private void GenerateRelicEntry()
{
foreach (RelicData item in from relic in Plugin.GetAllRelicDatas()
orderby relic.Cheat_GetNameEnglish()
select relic)
{
if (!string.IsNullOrWhiteSpace(item.Cheat_GetNameEnglish()) && !Plugin.Entries.TryGetValue(item, out var _))
{
CreateRelicConfigEntry(item);
}
}
}
private void LoadRelics(CollectableRarity rarity, ClassData faction, string selectedCustomOption = "")
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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_01ff: Invalid comparison between Unknown and I4
IEnumerable<RelicData> allRelicDatas = Plugin.GetAllRelicDatas();
allRelicDatas = ((selectedCustomOption == "Enemy" && Plugin.ShowEnemyRelics.Value) ? allRelicDatas.Where((RelicData relicData) => relicData is SinsData) : ((selectedCustomOption == "Covenant" && Plugin.ShowCovenantRelics.Value) ? allRelicDatas.Where((RelicData relicData) => relicData is CovenantData) : ((selectedCustomOption == "Mutator" && Plugin.ShowMutatorRelics.Value) ? allRelicDatas.Where((RelicData relicData) => relicData is MutatorData) : ((selectedCustomOption == "Pyre Heart" && Plugin.ShowPyreArtifactRelics.Value) ? allRelicDatas.Where((RelicData relicData) => relicData is PyreArtifactData) : ((selectedCustomOption == "Endless Mutator" && Plugin.ShowEndlessMutatorRelics.Value) ? allRelicDatas.Where((RelicData relicData) => relicData is EndlessMutatorData) : ((!(selectedCustomOption == "Enhancer") || !Plugin.ShowEnhancerRelics.Value) ? allRelicDatas.Where(delegate(RelicData relicData)
{
CollectableRelicData val2 = (CollectableRelicData)(object)((relicData is CollectableRelicData) ? relicData : null);
return val2 != null && (selectedFactionString == allClanName || (Object)(object)val2.GetLinkedClass() == (Object)(object)faction);
}) : allRelicDatas.Where((RelicData relicData) => relicData is EnhancerData)))))));
if ((int)rarity != -9999)
{
allRelicDatas = allRelicDatas.Where(delegate(RelicData relicData)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
CollectableRelicData val = (CollectableRelicData)(object)((relicData is CollectableRelicData) ? relicData : null);
return val != null && val.GetRarity() == rarity;
});
}
CreateRelicButton(allRelicDatas);
}
private void CreateRelicConfigEntry(RelicData relic)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
ConfigDefinition val = new ConfigDefinition("Relic Effects", ((Object)relic).name);
Plugin.Entries[relic] = Plugin.Config.Bind<bool>(val, false, new ConfigDescription(relic.GetDescription(), (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
}
private void CreateRelicButton(IEnumerable<RelicData> relics)
{
foreach (RelicButtonUI relicButton in relicButtons)
{
Object.DestroyImmediate((Object)(object)((Component)relicButton).gameObject);
}
relicButtons.Clear();
foreach (RelicData relic in relics)
{
if (!Plugin.Entries.TryGetValue(relic, out var _))
{
CreateRelicConfigEntry(relic);
}
try
{
RelicButtonUI relicButtonUI = Object.Instantiate<RelicButtonUI>(layout, ((Component)layout).transform.parent);
relicButtonUI.Set(relic);
((Component)relicButtonUI).gameObject.SetActive(true);
relicButtons.Add(relicButtonUI);
}
catch (Exception ex)
{
Plugin.LogSource.LogError((object)(ex.InnerException ?? ex).Message);
}
}
ResetOrder();
}
}
internal class SetRelicsButton : MonoBehaviour
{
private GameUISelectableWithNavigation content;
private TextMeshProUGUI title;
private void Start()
{
content = ((Component)((Component)this).transform.Find("Content")).GetComponent<GameUISelectableWithNavigation>();
RemoveUnneededUIElements();
SetupTitleDisplay();
((Component)this).transform.SetSiblingIndex(1);
SetupRelicPortrait();
SetupSelectionButton();
}
private void RemoveUnneededUIElements()
{
Object.Destroy((Object)(object)((Component)((Component)content).transform.Find("Header")).gameObject);
Object.Destroy((Object)(object)((Component)((Component)content).transform.Find("Ability Health layout")).gameObject);
}
private void SetupTitleDisplay()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)content).transform.Find("Pyre heart name");
val.localPosition = new Vector3(24f, 0f, 0f);
title = ((Component)val.Find("Pyre heart name label")).GetComponent<TextMeshProUGUI>();
((TMP_Text)title).text = "Set Starter Relics";
}
private void SetupRelicPortrait()
{
Image component = ((Component)((Component)content).transform.Find("Frame Portrait/Pyre Heart icon")).GetComponent<Image>();
CollectableRelicData val = AllGameManagers.Instance.GetAllGameData().FindCollectableRelicDataByName("BossCapacity2");
component.sprite = ((RelicData)val).GetIcon();
}
private void SetupSelectionButton()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
GameUISelectableButton component = ((Component)((Component)content).transform.Find("Pyre Heart Button")).GetComponent<GameUISelectableButton>();
((Button)component).onClick = new ButtonClickedEvent();
((UnityEvent)((Button)component).onClick).AddListener(new UnityAction(OnSelectionButtonClicked));
}
private void OnSelectionButtonClicked()
{
SoundManager.PlaySfxSignal.Dispatch("UI_Click");
if ((Object)(object)RelicSelectionDialog.Instance == (Object)null)
{
RelicSelectionDialog.Instance = ((Component)((Component)Object.FindObjectOfType<RunSetupScreen>()).transform.Find("RelicSelectionDialog")).GetComponent<RelicSelectionDialog>();
}
((Behaviour)RelicSelectionDialog.Instance).enabled = true;
((Component)RelicSelectionDialog.Instance).gameObject.SetActive(true);
}
}