using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MTSeedExplorer.Core;
using MTSeedExplorer.UI;
using Microsoft.CodeAnalysis;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MTSeedExplorer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MTSeedExplorer")]
[assembly: AssemblyTitle("MTSeedExplorer")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public static class CellAlignment
{
private static void Align(GameObject cell, TextAnchor anchor)
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
HorizontalLayoutGroup component = cell.GetComponent<HorizontalLayoutGroup>();
if ((Object)(object)component != (Object)null)
{
Object.DestroyImmediate((Object)(object)component);
}
VerticalLayoutGroup component2 = cell.GetComponent<VerticalLayoutGroup>();
if ((Object)(object)component2 != (Object)null)
{
Object.DestroyImmediate((Object)(object)component2);
}
GridLayoutGroup component3 = cell.GetComponent<GridLayoutGroup>();
if ((Object)(object)component3 != (Object)null)
{
Object.DestroyImmediate((Object)(object)component3);
}
HorizontalLayoutGroup val = cell.AddComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val).childControlWidth = false;
((HorizontalOrVerticalLayoutGroup)val).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)val).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)val).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)val).spacing = 0f;
((LayoutGroup)val).padding = new RectOffset(0, 0, 0, 0);
((LayoutGroup)val).childAlignment = anchor;
}
public static void AlignTopLeft(GameObject cell)
{
Align(cell, (TextAnchor)0);
}
public static void AlignTopCenter(GameObject cell)
{
Align(cell, (TextAnchor)1);
}
public static void AlignTopRight(GameObject cell)
{
Align(cell, (TextAnchor)2);
}
public static void AlignMiddleLeft(GameObject cell)
{
Align(cell, (TextAnchor)3);
}
public static void AlignMiddleCenter(GameObject cell)
{
Align(cell, (TextAnchor)4);
}
public static void AlignMiddleRight(GameObject cell)
{
Align(cell, (TextAnchor)5);
}
public static void AlignBottomLeft(GameObject cell)
{
Align(cell, (TextAnchor)6);
}
public static void AlignBottomCenter(GameObject cell)
{
Align(cell, (TextAnchor)7);
}
public static void AlignBottomRight(GameObject cell)
{
Align(cell, (TextAnchor)8);
}
}
namespace MTSeedExplorer
{
[HarmonyPatch(typeof(RelicManager))]
public static class RelicManagerPatches
{
}
[BepInPlugin("628343be-325d-44b9-9d11-13f7934974ab", "MTSeedExplorer", "0.1")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
internal static void Log(string message)
{
Logger.LogInfo((object)message);
}
internal static void LogError(string message)
{
Logger.LogError((object)message);
}
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "628343be-325d-44b9-9d11-13f7934974ab");
Logger.LogInfo((object)"MTSeedExplorer 0.1 loaded.");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "628343be-325d-44b9-9d11-13f7934974ab";
public const string PLUGIN_NAME = "MTSeedExplorer";
public const string PLUGIN_VERSION = "0.1";
}
}
namespace MTSeedExplorer.UI
{
public class SeedExplorerDialog : MonoBehaviour
{
private GameUISelectableDropdown Card1Dropdown;
private GameUISelectableDropdown Card2Dropdown;
private GameUISelectableDropdown Card3Dropdown;
private GameUISelectableDropdown ArtifactDropdown;
private GameUISelectableDropdown UpgradeDropdown;
private Transform dropdownRow;
private RectTransform contentRT;
private SeedExplorer seedExplorer;
private ScreenDialog dialog;
internal ScrollRect scrollRect;
private TextMeshProUGUI title;
private TextMeshProUGUI warning;
private bool isInitialized = false;
private bool _userOpened;
public static SeedExplorerDialog Instantiate(RunSetupScreen runSetupScreen)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
MutatorSelectionDialog val = (MutatorSelectionDialog)AccessTools.Field(typeof(RunSetupScreen), "mutatorSelectionDialog").GetValue(runSetupScreen);
GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, ((Component)val).transform.parent.parent);
Object.DestroyImmediate((Object)(object)val2.GetComponent<MutatorSelectionDialog>());
SeedExplorerDialog seedExplorerDialog = val2.AddComponent<SeedExplorerDialog>();
seedExplorerDialog.dialog = val2.GetComponentInChildren<ScreenDialog>(true);
((ScreenTransition)seedExplorerDialog.dialog).SetActive(false, val2, (Action)null, (Action)null);
return seedExplorerDialog;
}
private void Awake()
{
Init();
}
private void OnEnable()
{
}
private void OnDisable()
{
Close();
}
public void Open(string key = "")
{
DoOpen(key);
}
private void DoOpen(string key)
{
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
seedExplorer = SeedExplorer.GetOrCreateInstance(key);
if (seedExplorer.SeedResults.Count == 0)
{
seedExplorer.ExploreSeeds();
}
((ScreenTransition)dialog).SetActive(true, ((Component)this).gameObject, (Action)null, (Action)null);
BuildResultsTable();
RelabelDropdowns();
LayoutRebuilder.ForceRebuildLayoutImmediate(((Component)dropdownRow).GetComponent<RectTransform>());
GameUISelectableDropdown[] array = (GameUISelectableDropdown[])(object)new GameUISelectableDropdown[5] { Card1Dropdown, Card2Dropdown, Card3Dropdown, ArtifactDropdown, UpgradeDropdown };
GameUISelectableDropdown[] array2 = array;
foreach (GameUISelectableDropdown val in array2)
{
Transform obj = ((Component)val).transform.Find("Value");
RectTransform val2 = (RectTransform)(object)((obj is RectTransform) ? obj : null);
if ((Object)(object)val2 != (Object)null)
{
val2.anchorMin = new Vector2(0f, 0f);
val2.anchorMax = new Vector2(1f, 1f);
val2.offsetMin = new Vector2(4f, val2.offsetMin.y);
val2.offsetMax = new Vector2(-4f, val2.offsetMax.y);
}
}
if ((Object)(object)scrollRect != (Object)null)
{
scrollRect.verticalNormalizedPosition = 1f;
LayoutRebuilder.ForceRebuildLayoutImmediate(scrollRect.content);
}
}
private void Init()
{
if (!isInitialized)
{
isInitialized = true;
scrollRect = ((Component)dialog).GetComponentInChildren<ScrollRect>(true);
((Component)scrollRect).transform.SetParent((Transform)null, false);
SetupDialogHeader();
SetupDialogBody();
RectTransform component = ((Component)((Component)dialog).transform.Find("Content")).GetComponent<RectTransform>();
LayoutRebuilder.ForceRebuildLayoutImmediate(component);
}
}
private void SetupDialogBody()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)dialog).transform.Find("Content");
GameObject val2 = new GameObject("Body", new Type[1] { typeof(RectTransform) });
val2.transform.SetParent(val, false);
LayoutElement val3 = val2.AddComponent<LayoutElement>();
val3.flexibleHeight = 1f;
val3.minHeight = 0f;
((Component)scrollRect).transform.SetParent(val2.transform, false);
RectTransform component = ((Component)scrollRect).GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
scrollRect.vertical = true;
scrollRect.horizontal = false;
RectTransform viewport = scrollRect.viewport;
contentRT = ((Component)((Transform)viewport).Find("Mutator layout")).GetComponent<RectTransform>();
scrollRect.content = contentRT;
contentRT.anchorMin = new Vector2(0f, 1f);
contentRT.anchorMax = new Vector2(1f, 1f);
contentRT.pivot = new Vector2(0.5f, 1f);
contentRT.anchoredPosition = Vector2.zero;
contentRT.sizeDelta = Vector2.zero;
LayoutGroup[] components = ((Component)contentRT).GetComponents<LayoutGroup>();
foreach (LayoutGroup val4 in components)
{
Object.DestroyImmediate((Object)(object)val4);
}
VerticalLayoutGroup val5 = ((Component)contentRT).gameObject.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val5).spacing = 1f;
((HorizontalOrVerticalLayoutGroup)val5).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val5).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)val5).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val5).childForceExpandHeight = false;
ContentSizeFitter val6 = ((Component)contentRT).GetComponent<ContentSizeFitter>() ?? ((Component)contentRT).gameObject.AddComponent<ContentSizeFitter>();
val6.horizontalFit = (FitMode)0;
val6.verticalFit = (FitMode)2;
LayoutRebuilder.ForceRebuildLayoutImmediate(((Component)dialog).GetComponentInChildren<ScrollRect>(true).content);
}
private void BuildResultsTable()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Expected O, but got Unknown
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Expected O, but got Unknown
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Expected O, but got Unknown
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Expected O, but got Unknown
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Expected O, but got Unknown
//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
//IL_03a8: Expected O, but got Unknown
//IL_048e: Unknown result type (might be due to invalid IL or missing references)
//IL_0495: Expected O, but got Unknown
//IL_051e: Unknown result type (might be due to invalid IL or missing references)
//IL_0525: Expected O, but got Unknown
//IL_060b: Unknown result type (might be due to invalid IL or missing references)
//IL_0612: Expected O, but got Unknown
List<Transform> list = new List<Transform>();
foreach (Transform item2 in (Transform)contentRT)
{
Transform item = item2;
list.Add(item);
}
foreach (Transform item3 in list)
{
Object.DestroyImmediate((Object)(object)((Component)item3).gameObject);
}
for (int i = 0; i < seedExplorer.SeedResultsFiltered.Count; i++)
{
SeedExplorer.SeedResult seedResult = seedExplorer.SeedResultsFiltered[i];
string[] array = new string[3] { seedResult.Card1, seedResult.Card2, seedResult.Card3 };
GameObject val = new GameObject("ResultRow", new Type[1] { typeof(RectTransform) });
val.transform.SetParent((Transform)(object)contentRT, false);
Image bg = val.AddComponent<Image>();
((Graphic)bg).color = Color.clear;
EventTrigger val2 = val.AddComponent<EventTrigger>();
Entry val3 = new Entry
{
eventID = (EventTriggerType)0
};
((UnityEvent<BaseEventData>)(object)val3.callback).AddListener((UnityAction<BaseEventData>)delegate
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
((Graphic)bg).color = new Color(1f, 1f, 1f, 0.2f);
});
val2.triggers.Add(val3);
Entry val4 = new Entry
{
eventID = (EventTriggerType)1
};
((UnityEvent<BaseEventData>)(object)val4.callback).AddListener((UnityAction<BaseEventData>)delegate
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((Graphic)bg).color = Color.clear;
});
val2.triggers.Add(val4);
int rowIndex = i;
Entry val5 = new Entry
{
eventID = (EventTriggerType)4
};
((UnityEvent<BaseEventData>)(object)val5.callback).AddListener((UnityAction<BaseEventData>)delegate
{
int i2 = rowIndex;
seedExplorer.StartRun(i2);
});
val2.triggers.Add(val5);
ContentSizeFitter val6 = val.AddComponent<ContentSizeFitter>();
val6.horizontalFit = (FitMode)0;
val6.verticalFit = (FitMode)2;
HorizontalLayoutGroup val7 = val.AddComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val7).spacing = 4f;
((HorizontalOrVerticalLayoutGroup)val7).childControlWidth = false;
((HorizontalOrVerticalLayoutGroup)val7).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val7).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val7).childForceExpandHeight = false;
((LayoutGroup)val7).childAlignment = (TextAnchor)4;
for (int j = 0; j < 3; j++)
{
GameObject val8 = new GameObject($"Cell_{j + 1}", new Type[1] { typeof(RectTransform) });
val8.transform.SetParent(val.transform, false);
LayoutElement val9 = val8.AddComponent<LayoutElement>();
val9.flexibleWidth = 1f;
val9.minWidth = 0f;
GameObject val10 = new GameObject("Label", new Type[1] { typeof(RectTransform) });
val10.transform.SetParent(val8.transform, false);
TextMeshProUGUI val11 = val10.AddComponent<TextMeshProUGUI>();
((TMP_Text)val11).text = ((j < array.Length) ? array[j] : "");
((TMP_Text)val11).fontSize = 20f;
((TMP_Text)val11).alignment = (TextAlignmentOptions)514;
ContentSizeFitter val12 = val10.AddComponent<ContentSizeFitter>();
val12.horizontalFit = (FitMode)2;
val12.verticalFit = (FitMode)2;
LayoutRebuilder.ForceRebuildLayoutImmediate(((TMP_Text)val11).rectTransform);
float preferredHeight = LayoutUtility.GetPreferredHeight(((TMP_Text)val11).rectTransform);
val9.minHeight = 30f;
val9.preferredHeight = 30f;
}
float num = 61f;
GameObject val13 = new GameObject("ArtifactCell", new Type[1] { typeof(RectTransform) });
val13.transform.SetParent(val.transform, false);
LayoutElement val14 = val13.AddComponent<LayoutElement>();
val14.flexibleWidth = 1f;
val14.minWidth = 0f;
val14.minHeight = num;
val14.preferredHeight = num;
VerticalLayoutGroup val15 = val13.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val15).spacing = 1f;
((HorizontalOrVerticalLayoutGroup)val15).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val15).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)val15).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val15).childForceExpandHeight = false;
ContentSizeFitter val16 = val13.AddComponent<ContentSizeFitter>();
val16.horizontalFit = (FitMode)0;
val16.verticalFit = (FitMode)2;
string[] array2 = new string[2] { seedResult.Artifact1, seedResult.Artifact2 };
foreach (string text in array2)
{
GameObject val17 = new GameObject("Label", new Type[1] { typeof(RectTransform) });
val17.transform.SetParent(val13.transform, false);
TextMeshProUGUI val18 = val17.AddComponent<TextMeshProUGUI>();
((TMP_Text)val18).text = text;
((TMP_Text)val18).fontSize = 20f;
((TMP_Text)val18).alignment = (TextAlignmentOptions)514;
ContentSizeFitter val19 = val17.AddComponent<ContentSizeFitter>();
val19.horizontalFit = (FitMode)2;
val19.verticalFit = (FitMode)2;
}
GameObject val20 = new GameObject("UpgradeCell", new Type[1] { typeof(RectTransform) });
val20.transform.SetParent(val.transform, false);
LayoutElement val21 = val20.AddComponent<LayoutElement>();
val21.flexibleWidth = 1f;
val21.minWidth = 0f;
val21.minHeight = num;
val21.preferredHeight = num;
VerticalLayoutGroup val22 = val20.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val22).spacing = 1f;
((HorizontalOrVerticalLayoutGroup)val22).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val22).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)val22).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val22).childForceExpandHeight = false;
ContentSizeFitter val23 = val20.AddComponent<ContentSizeFitter>();
val23.horizontalFit = (FitMode)0;
val23.verticalFit = (FitMode)2;
string[] array3 = new string[2] { seedResult.Upgrade1, seedResult.Upgrade2 };
foreach (string text2 in array3)
{
GameObject val24 = new GameObject("Label", new Type[1] { typeof(RectTransform) });
val24.transform.SetParent(val20.transform, false);
TextMeshProUGUI val25 = val24.AddComponent<TextMeshProUGUI>();
((TMP_Text)val25).text = text2;
((TMP_Text)val25).fontSize = 20f;
((TMP_Text)val25).alignment = (TextAlignmentOptions)514;
ContentSizeFitter val26 = val24.AddComponent<ContentSizeFitter>();
val26.horizontalFit = (FitMode)2;
val26.verticalFit = (FitMode)2;
}
}
}
private void SetupDialogHeader()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Expected O, but got Unknown
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Expected O, but got Unknown
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: 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_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Expected O, but got Unknown
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Expected O, but got Unknown
Transform val = ((Component)dialog).transform.Find("Content");
Object.DestroyImmediate((Object)(object)((Component)val).GetComponent<HorizontalLayoutGroup>());
Object.DestroyImmediate((Object)(object)((Component)val).GetComponent<VerticalLayoutGroup>());
List<Transform> list = new List<Transform>();
foreach (Transform item2 in val)
{
Transform item = item2;
list.Add(item);
}
foreach (Transform item3 in list)
{
Object.DestroyImmediate((Object)(object)((Component)item3).gameObject);
}
VerticalLayoutGroup val2 = ((Component)val).gameObject.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val2).spacing = 0f;
((LayoutGroup)val2).padding = new RectOffset(0, 0, 0, 0);
((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
RectTransform component = ((Component)val).GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(1f, 1f);
component.pivot = new Vector2(0.5f, 1f);
component.anchoredPosition = Vector2.zero;
component.sizeDelta = Vector2.zero;
GameObject val3 = new GameObject("Header", new Type[1] { typeof(RectTransform) });
val3.transform.SetParent(((Component)val).transform, false);
RectTransform component2 = val3.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0f, 1f);
component2.anchorMax = new Vector2(1f, 1f);
component2.pivot = new Vector2(0.5f, 1f);
component2.anchoredPosition = Vector2.zero;
component2.sizeDelta = Vector2.zero;
VerticalLayoutGroup val4 = val3.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val4).spacing = 4f;
((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val4).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val4).childForceExpandHeight = false;
ContentSizeFitter val5 = val3.AddComponent<ContentSizeFitter>();
val5.horizontalFit = (FitMode)0;
val5.verticalFit = (FitMode)2;
int[] array = new int[3] { 2, 5, 5 };
List<Transform> list2 = new List<Transform>();
for (int i = 0; i < 3; i++)
{
List<Transform> list3 = new List<Transform>();
GameObject val6 = new GameObject($"Row{i + 1}", new Type[1] { typeof(RectTransform) });
val6.transform.SetParent(val3.transform, false);
ContentSizeFitter val7 = val6.AddComponent<ContentSizeFitter>();
val7.horizontalFit = (FitMode)0;
val7.verticalFit = (FitMode)2;
HorizontalLayoutGroup val8 = val6.AddComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val8).spacing = 4f;
((HorizontalOrVerticalLayoutGroup)val8).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val8).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val8).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val8).childForceExpandHeight = false;
((LayoutGroup)val8).childAlignment = (TextAnchor)4;
for (int j = 0; j < array[i]; j++)
{
GameObject val9 = new GameObject($"Cell{i + 1}_{j + 1}", new Type[1] { typeof(RectTransform) });
val9.transform.SetParent(val6.transform, false);
LayoutElement val10 = val9.AddComponent<LayoutElement>();
val10.flexibleWidth = 1f;
val10.minWidth = 0f;
list3.Add(val9.transform);
}
list2.Add(val6.transform);
}
SetupInstructionsAndToggle(((IEnumerable)list2[0]).Cast<Transform>().ToList());
SetupDropdownTitles(((IEnumerable)list2[1]).Cast<Transform>().ToList());
dropdownRow = list2[2];
SetupDropdowns(dropdownRow);
component2 = val3.GetComponent<RectTransform>();
LayoutRebuilder.ForceRebuildLayoutImmediate(component2);
LayoutElement val11 = val3.gameObject.AddComponent<LayoutElement>();
val11.preferredHeight = LayoutUtility.GetPreferredHeight(component2);
val11.flexibleHeight = 0f;
}
private void SetupInstructionsAndToggle(List<Transform> cells)
{
LabelCell(cells[0], "Choose starting seed.");
}
private void SetupToggle(Transform target)
{
SettingsDialog val = Object.FindObjectOfType<SettingsDialog>(true);
if ((Object)(object)val == (Object)null)
{
throw new Exception("Unable to find SettingsDialog");
}
Transform val2 = ((Component)val).transform.Find("Content/Content/Audio Section/Background mute toggle/Background mute toggle input");
if ((Object)(object)val2 == (Object)null)
{
throw new Exception("Unable to find toggle button to copy.");
}
GameObject val3 = Object.Instantiate<GameObject>(((Component)val2).gameObject, target, false);
((Object)val3).name = ((Object)target).name + " toggle";
RectTransform component = val3.GetComponent<RectTransform>();
}
public void Close()
{
((ScreenTransition)dialog).SetActive(false, ((Component)this).gameObject, (Action)null, (Action)null);
SoundManager.PlaySfxSignal.Dispatch("UI_Cancel");
((Behaviour)this).enabled = false;
isInitialized = false;
}
internal bool ApplyScreenInput(CoreInputControlMapping mapping, IGameUIComponent triggeredUI, Controls triggeredMappingID)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (!((Component)this).gameObject.activeSelf)
{
return false;
}
if (triggeredUI == null && InputHelper.IsClickInput(triggeredMappingID, mapping))
{
Close();
return true;
}
return true;
}
private void SetupDropdownTitles(List<Transform> cells)
{
LabelCell(cells[0], "Primary");
LabelCell(cells[1], "Secondary");
LabelCell(cells[2], "Unit");
LabelCell(cells[3], "Artifact");
LabelCell(cells[4], "Upgrade");
}
private void LabelCell(Transform cell, string text)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
GameObject val = new GameObject("Label", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(cell, false);
LayoutElement val2 = ((Component)cell).gameObject.AddComponent<LayoutElement>();
val2.flexibleWidth = 1f;
val2.minWidth = 0f;
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = text;
((TMP_Text)val3).fontSize = 24f;
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
ContentSizeFitter val4 = val.AddComponent<ContentSizeFitter>();
val4.horizontalFit = (FitMode)2;
val4.verticalFit = (FitMode)2;
LayoutRebuilder.ForceRebuildLayoutImmediate(((TMP_Text)val3).rectTransform);
float preferredHeight = LayoutUtility.GetPreferredHeight(((TMP_Text)val3).rectTransform);
val2.minHeight = 30f;
val2.preferredHeight = 30f;
}
private void DestroyAllChildren(Transform t)
{
IEnumerable<GameObject> enumerable = from x in ((Component)t).GetComponentsInChildren<Transform>(true)
where (Object)(object)x != (Object)(object)t
select ((Component)x).gameObject;
foreach (GameObject item in enumerable)
{
Object.DestroyImmediate((Object)(object)item);
}
}
private void RelabelDropdowns()
{
LabelDropdown(Card1Dropdown, seedExplorer.PrimaryCardPool);
LabelDropdown(Card2Dropdown, seedExplorer.SecondaryCardPool);
LabelDropdown(Card3Dropdown, seedExplorer.UnitCardPool);
LabelDropdown(ArtifactDropdown, seedExplorer.ArtifactPool);
LabelDropdown(UpgradeDropdown, seedExplorer.UpgradePool);
}
private void SetupDropdowns(Transform row)
{
List<Transform> list = ((IEnumerable)row).Cast<Transform>().ToList();
foreach (Transform item in list)
{
DestroyAllChildren(item);
LayoutElement val = ((Component)item).GetComponent<LayoutElement>() ?? ((Component)item).gameObject.AddComponent<LayoutElement>();
val.minHeight = 70f;
val.preferredHeight = 70f;
}
Card1Dropdown = CreateDropdown(list[0], seedExplorer.PrimaryCardPool);
Card2Dropdown = CreateDropdown(list[1], seedExplorer.SecondaryCardPool);
Card3Dropdown = CreateDropdown(list[2], seedExplorer.UnitCardPool);
ArtifactDropdown = CreateDropdown(list[3], seedExplorer.ArtifactPool);
UpgradeDropdown = CreateDropdown(list[4], seedExplorer.UpgradePool);
RelabelDropdowns();
SetupDropdownButtonListeners(Card1Dropdown);
SetupDropdownButtonListeners(Card2Dropdown);
SetupDropdownButtonListeners(Card3Dropdown);
SetupDropdownButtonListeners(ArtifactDropdown);
SetupDropdownButtonListeners(UpgradeDropdown);
Card1Dropdown.optionChosenSignal.AddListener((Action<int, string>)delegate(int index, string optionName)
{
seedExplorer.UpdateFilter(SeedExplorer.FilterType.PrimaryCard, optionName);
BuildResultsTable();
if ((Object)(object)scrollRect != (Object)null)
{
scrollRect.verticalNormalizedPosition = 1f;
LayoutRebuilder.ForceRebuildLayoutImmediate(scrollRect.content);
}
});
Card2Dropdown.optionChosenSignal.AddListener((Action<int, string>)delegate(int index, string optionName)
{
seedExplorer.UpdateFilter(SeedExplorer.FilterType.SecondaryCard, optionName);
BuildResultsTable();
if ((Object)(object)scrollRect != (Object)null)
{
scrollRect.verticalNormalizedPosition = 1f;
LayoutRebuilder.ForceRebuildLayoutImmediate(scrollRect.content);
}
});
Card3Dropdown.optionChosenSignal.AddListener((Action<int, string>)delegate(int index, string optionName)
{
seedExplorer.UpdateFilter(SeedExplorer.FilterType.UnitCard, optionName);
BuildResultsTable();
if ((Object)(object)scrollRect != (Object)null)
{
scrollRect.verticalNormalizedPosition = 1f;
LayoutRebuilder.ForceRebuildLayoutImmediate(scrollRect.content);
}
});
ArtifactDropdown.optionChosenSignal.AddListener((Action<int, string>)delegate(int index, string optionName)
{
seedExplorer.UpdateFilter(SeedExplorer.FilterType.Artifact, optionName);
BuildResultsTable();
if ((Object)(object)scrollRect != (Object)null)
{
scrollRect.verticalNormalizedPosition = 1f;
LayoutRebuilder.ForceRebuildLayoutImmediate(scrollRect.content);
}
});
UpgradeDropdown.optionChosenSignal.AddListener((Action<int, string>)delegate(int index, string optionName)
{
seedExplorer.UpdateFilter(SeedExplorer.FilterType.Upgrade, optionName);
BuildResultsTable();
if ((Object)(object)scrollRect != (Object)null)
{
scrollRect.verticalNormalizedPosition = 1f;
LayoutRebuilder.ForceRebuildLayoutImmediate(scrollRect.content);
}
});
list.ForEach(delegate(Transform c)
{
((Component)c).gameObject.SetActive(true);
});
}
private static void ShrinkDropdownEntries(GameUISelectableDropdown dd, float entryHeight)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
FieldInfo field = typeof(GameUISelectableDropdown).GetField("dropdownList", BindingFlags.Instance | BindingFlags.NonPublic);
object? value = field.GetValue(dd);
GameObject val = (GameObject)((value is GameObject) ? value : null);
if ((Object)(object)val == (Object)null)
{
return;
}
foreach (Transform item in val.transform)
{
Transform val2 = item;
if (((Object)val2).name.StartsWith("Dropdown entry"))
{
RectTransform component = ((Component)val2).GetComponent<RectTransform>();
component.SetSizeWithCurrentAnchors((Axis)1, entryHeight);
LayoutElement val3 = ((Component)val2).GetComponent<LayoutElement>() ?? ((Component)val2).gameObject.AddComponent<LayoutElement>();
val3.minHeight = entryHeight;
val3.preferredHeight = entryHeight;
val3.flexibleHeight = 0f;
}
}
}
private static void ExpandDropdownEntryWidths(GameUISelectableDropdown dd)
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
FieldInfo field = typeof(GameUISelectableDropdown).GetField("dropdownList", BindingFlags.Instance | BindingFlags.NonPublic);
object? value = field.GetValue(dd);
GameObject val = (GameObject)((value is GameObject) ? value : null);
if ((Object)(object)val == (Object)null)
{
return;
}
VerticalLayoutGroup component = val.GetComponent<VerticalLayoutGroup>();
if ((Object)(object)component != (Object)null)
{
((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true;
}
foreach (Transform item in val.transform)
{
Transform val2 = item;
if (((Object)val2).name.StartsWith("Dropdown entry"))
{
RectTransform component2 = ((Component)val2).GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0f, component2.anchorMin.y);
component2.anchorMax = new Vector2(1f, component2.anchorMax.y);
component2.offsetMin = new Vector2(0f, component2.offsetMin.y);
component2.offsetMax = new Vector2(0f, component2.offsetMax.y);
LayoutElement val3 = ((Component)val2).GetComponent<LayoutElement>() ?? ((Component)val2).gameObject.AddComponent<LayoutElement>();
val3.minWidth = 0f;
val3.flexibleWidth = 1f;
}
}
LayoutRebuilder.ForceRebuildLayoutImmediate(val.GetComponent<RectTransform>());
}
private void DumpDropdownLayout(GameUISelectableDropdown dd)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Expected O, but got Unknown
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: 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)
RectTransform component = ((Component)dd).GetComponent<RectTransform>();
LayoutElement component2 = ((Component)dd).GetComponent<LayoutElement>();
ContentSizeFitter component3 = ((Component)dd).GetComponent<ContentSizeFitter>();
Debug.Log((object)("––– Dump root of " + ((Object)dd).name + " –––"));
Debug.Log((object)$"RT anchors [{component.anchorMin} → {component.anchorMax}] offsets [{component.offsetMin} → {component.offsetMax}] sizeDelta {component.sizeDelta}");
Debug.Log((object)(((Object)(object)component2 != (Object)null) ? $"LE minW:{component2.minWidth}, prefW:{component2.preferredWidth}, flexW:{component2.flexibleWidth}" : "no root LE"));
Debug.Log((object)(((Object)(object)component3 != (Object)null) ? $"CSF H:{component3.horizontalFit}, V:{component3.verticalFit}" : "no root CSF"));
foreach (Transform item in ((Component)dd).transform)
{
Transform val = item;
RectTransform component4 = ((Component)val).GetComponent<RectTransform>();
LayoutElement component5 = ((Component)val).GetComponent<LayoutElement>();
ContentSizeFitter component6 = ((Component)val).GetComponent<ContentSizeFitter>();
Debug.Log((object)(" • Child '" + ((Object)val).name + "'"));
Debug.Log((object)$" RT anchors [{component4.anchorMin} → {component4.anchorMax}] offsets [{component4.offsetMin} → {component4.offsetMax}] sizeDelta {component4.sizeDelta}");
Debug.Log((object)(((Object)(object)component5 != (Object)null) ? $" LE minW:{component5.minWidth}, prefW:{component5.preferredWidth}, flexW:{component5.flexibleWidth}" : " no LE"));
Debug.Log((object)(((Object)(object)component6 != (Object)null) ? $" CSF H:{component6.horizontalFit}, V:{component6.verticalFit}" : " no CSF"));
}
}
private void DumpHierarchy(Transform t, string indent = "")
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
RectTransform component = ((Component)t).GetComponent<RectTransform>();
LayoutElement component2 = ((Component)t).GetComponent<LayoutElement>();
ContentSizeFitter component3 = ((Component)t).GetComponent<ContentSizeFitter>();
Debug.Log((object)($"{indent}{((Object)t).name} ─ anchors [{component.anchorMin}->{component.anchorMax}] " + $"offsets [{component.offsetMin}->{component.offsetMax}] sizeDelta {component.sizeDelta} " + (((Object)(object)component2 != (Object)null) ? $"LE(minW:{component2.minWidth},flexW:{component2.flexibleWidth}) " : "") + (((Object)(object)component3 != (Object)null) ? $"CSF(H:{component3.horizontalFit},V:{component3.verticalFit})" : "")));
foreach (Transform item in t)
{
Transform t2 = item;
DumpHierarchy(t2, indent + " ");
}
}
private void DumpFullDropdown(GameUISelectableDropdown dd)
{
FieldInfo field = typeof(GameUISelectableDropdown).GetField("dropdownList", BindingFlags.Instance | BindingFlags.NonPublic);
object? value = field.GetValue(dd);
GameObject val = (GameObject)((value is GameObject) ? value : null);
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)"dropdownList NULL");
return;
}
Debug.Log((object)("─── FULL HIERARCHY for " + ((Object)dd).name + ".dropdownList ───"));
DumpHierarchy(val.transform);
}
private void LabelDropdown(GameUISelectableDropdown dropdown, List<string> options)
{
dropdown.SetOptions(options.Prepend("<any>").ToList());
TextMeshProUGUI[] componentsInChildren = ((Component)dropdown).GetComponentsInChildren<TextMeshProUGUI>(true);
foreach (TextMeshProUGUI val in componentsInChildren)
{
((TMP_Text)val).fontSize = 20f;
}
ShrinkDropdownEntries(dropdown, 24f);
ExpandDropdownEntryWidths(dropdown);
dropdown.SetIndex(0);
}
private GameUISelectableDropdown CreateDropdown(Transform target, List<string> options)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: 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_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Expected O, but got Unknown
GameUISelectableDropdown val = Object.FindObjectOfType<GameUISelectableDropdown>(true);
GameUISelectableDropdown dropdown = Object.Instantiate<GameUISelectableDropdown>(val);
((Component)dropdown).transform.SetParent(target, false);
RectTransform component = ((Component)dropdown).GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
Object.DestroyImmediate((Object)(object)((Component)dropdown).GetComponent<ContentSizeFitter>());
Object.DestroyImmediate((Object)(object)((Component)dropdown).GetComponent<LayoutElement>());
Transform obj = ((Component)dropdown).transform.Find("Bg");
RectTransform val2 = ((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null);
if ((Object)(object)val2 != (Object)null)
{
val2.anchorMin = Vector2.zero;
val2.anchorMax = Vector2.one;
val2.offsetMin = Vector2.zero;
val2.offsetMax = Vector2.zero;
Image component2 = ((Component)val2).GetComponent<Image>();
if ((Object)(object)component2 != (Object)null)
{
component2.type = (Type)1;
component2.preserveAspect = false;
}
}
LayoutElement val3 = ((Component)dropdown).gameObject.AddComponent<LayoutElement>();
val3.minWidth = 0f;
val3.flexibleWidth = 1f;
val3.minHeight = 70f;
val3.preferredHeight = 70f;
Transform obj2 = ((Component)dropdown).transform.Find("Value");
RectTransform val4 = ((obj2 != null) ? ((Component)obj2).GetComponent<RectTransform>() : null);
if ((Object)(object)val4 != (Object)null)
{
val4.anchorMin = new Vector2(0f, 0f);
val4.anchorMax = new Vector2(1f, 1f);
val4.offsetMin = new Vector2(8f, val4.offsetMin.y);
val4.offsetMax = new Vector2(-24f, val4.offsetMax.y);
}
Transform obj3 = ((Component)dropdown).transform.Find("Bg");
Image val5 = ((obj3 != null) ? ((Component)obj3).GetComponent<Image>() : null);
if ((Object)(object)val5 != (Object)null)
{
val5.preserveAspect = false;
val5.type = (Type)1;
}
((UnityEvent)((Button)dropdown).onClick).AddListener((UnityAction)delegate
{
CoreInputControlMapping val6 = default(CoreInputControlMapping);
((CoreInput)InputManager.Inst).TryGetSignaledInputMapping(MappingID.op_Implicit((Enum)(object)(Controls)19), ref val6);
dropdown.ApplyScreenInput(val6, (IGameUIComponent)(object)dropdown, (Controls)19);
});
return dropdown;
}
private void DumpDropdownAncestors(GameUISelectableDropdown dd)
{
//IL_0065: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)("── Ancestor chain for " + ((Object)dd).name + " ──"));
Transform val = ((Component)dd).transform;
while ((Object)(object)val != (Object)null)
{
RectTransform component = ((Component)val).GetComponent<RectTransform>();
LayoutElement component2 = ((Component)val).GetComponent<LayoutElement>();
HorizontalLayoutGroup component3 = ((Component)val).GetComponent<HorizontalLayoutGroup>();
VerticalLayoutGroup component4 = ((Component)val).GetComponent<VerticalLayoutGroup>();
ContentSizeFitter component5 = ((Component)val).GetComponent<ContentSizeFitter>();
string text = $"{((Object)val).name} | RT anchors[{component.anchorMin}->{component.anchorMax}] offs[{component.offsetMin}->{component.offsetMax}] sizeDelta{component.sizeDelta}";
if ((Object)(object)component2 != (Object)null)
{
text += $" LE(minW:{component2.minWidth},flexW:{component2.flexibleWidth})";
}
if ((Object)(object)component3 != (Object)null)
{
text += $" HLG(childControlW:{((HorizontalOrVerticalLayoutGroup)component3).childControlWidth},forceExpandW:{((HorizontalOrVerticalLayoutGroup)component3).childForceExpandWidth})";
}
if ((Object)(object)component4 != (Object)null)
{
text += $" VLG(childControlW:{((HorizontalOrVerticalLayoutGroup)component4).childControlWidth},forceExpandW:{((HorizontalOrVerticalLayoutGroup)component4).childForceExpandWidth})";
}
if ((Object)(object)component5 != (Object)null)
{
text += $" CSF(H:{component5.horizontalFit},V:{component5.verticalFit})";
}
Debug.Log((object)text);
val = val.parent;
}
}
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);
});
}
}
}
}
public class SeedExplorerFooterButton : GameUISelectableButton
{
public static GameUISelectableButton Instantiate(RunSetupScreen runSetupScreen)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
UIFooter val = Object.FindObjectOfType<UIFooter>();
Transform val2 = ((Component)val).transform.Find("Swap Champion Button");
Transform val3 = Object.Instantiate<Transform>(val2, ((Component)val).transform);
((TMP_Text)((Component)val3.Find("Label")).GetComponent<TextMeshProUGUI>()).text = "Choose Seed";
GameUISelectableButton component = ((Component)val3).GetComponent<GameUISelectableButton>();
((UnityEvent)((Button)component).onClick).AddListener((UnityAction)delegate
{
RunSetupScreen val4 = runSetupScreen;
ChampionData value = Traverse.Create((object)val4).Field("currentlySelectedMainChampion").GetValue<ChampionData>();
string name = ((Object)value).name;
List<string> value2 = Traverse.Create((object)val4).Field("mutatorIds").GetValue<List<string>>();
string text = string.Join(",", value2);
PyreHeartInfoUI value3 = Traverse.Create((object)val4).Field("pyreHeartInfo").GetValue<PyreHeartInfoUI>();
string name2 = ((Object)value3.PyreHeartCharacterData).name;
Transform val5 = ((Component)val4).transform.Find("Run setup main content/Container card previews/Allied Card preview root/Card preview");
string name3 = ((Object)val5.GetChild(0)).name;
string key = string.Join("_", name, name3, name2, text);
SeedExplorerDialog seedExplorerDialog = ModRegistry.GetSeedExplorerDialog(val4);
if ((Object)(object)seedExplorerDialog != (Object)null)
{
seedExplorerDialog.Open(key);
}
});
return component;
}
}
}
namespace MTSeedExplorer.HarmonyPatches
{
[HarmonyPatch(typeof(CardPoolHelper))]
public static class CardPullHelperPatches
{
[HarmonyPostfix]
[HarmonyPatch("GetCardsForClass", new Type[]
{
typeof(CardPool),
typeof(ClassData),
typeof(int),
typeof(CollectableRarity),
typeof(CollectableRarity?),
typeof(SaveManager),
typeof(RarityCondition),
typeof(bool)
})]
public static void GetCardsForClass_Postfix(CardPool cardPool, ref List<CardData> __result)
{
if (SeedExplorer.Instance.ShouldCaptureStartingCardPool && (((Object)cardPool).name == "MegaPool" || ((Object)cardPool).name == "UnitsAllBanner"))
{
SeedExplorer.Instance.OnStartingCardPoolGenerated(__result);
}
}
}
[HarmonyPatch(typeof(LoadScreen))]
public static class LoadScreenPatches
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static ScreenActiveCallback <>9__0_0;
internal void <AddSeedExplorerButton>b__0_0(IScreen screen)
{
RunSetupScreen val = (RunSetupScreen)(object)((screen is RunSetupScreen) ? screen : null);
GameUISelectableButton button = SeedExplorerFooterButton.Instantiate(val);
ModRegistry.RegisterSeedExplorerFooterButton(val, button);
SeedExplorerDialog dialog = SeedExplorerDialog.Instantiate(val);
ModRegistry.RegisterSeedExplorerDialog(val, dialog);
}
}
[HarmonyPostfix]
[HarmonyPatch("StartLoadingScreen")]
public static void AddSeedExplorerButton(LoadScreen __instance, ref ScreenActiveCallback ___screenActiveCallback)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
if ((int)__instance.name != 42)
{
return;
}
ScreenActiveCallback a = ___screenActiveCallback;
object obj = <>c.<>9__0_0;
if (obj == null)
{
ScreenActiveCallback val = delegate(IScreen screen)
{
RunSetupScreen val2 = (RunSetupScreen)(object)((screen is RunSetupScreen) ? screen : null);
GameUISelectableButton button = SeedExplorerFooterButton.Instantiate(val2);
ModRegistry.RegisterSeedExplorerFooterButton(val2, button);
SeedExplorerDialog dialog = SeedExplorerDialog.Instantiate(val2);
ModRegistry.RegisterSeedExplorerDialog(val2, dialog);
};
<>c.<>9__0_0 = val;
obj = (object)val;
}
___screenActiveCallback = (ScreenActiveCallback)Delegate.Combine((Delegate?)(object)a, (Delegate?)obj);
}
}
[HarmonyPatch(typeof(PregeneratedRewardID))]
public static class PregeneratedRewardIDPatches
{
[HarmonyPrefix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static void PregeneratedRewardID_Ctor_Prefix(IRewardGiver giver, int distance, int branch, int index)
{
if (SeedExplorer.Instance.ShouldCaptureStartingArtifactsPregenId)
{
SeedExplorer.Instance.OnStartingArtifactsGenerated(giver, distance, branch, index);
}
}
}
[HarmonyPatch(typeof(RunSetupScreen))]
public static class RunSetupScreenPatches
{
[HarmonyPrefix]
[HarmonyPatch("ApplyScreenInput", new Type[]
{
typeof(CoreInputControlMapping),
typeof(IGameUIComponent),
typeof(Controls)
})]
public static bool ApplyScreenInput_Prefix(RunSetupScreen __instance, CoreInputControlMapping mapping, IGameUIComponent triggeredUI, Controls triggeredMappingID, ref bool __result)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
GameUISelectableButton seedExplorerFooterButton = ModRegistry.GetSeedExplorerFooterButton(__instance);
if ((Object)(object)seedExplorerFooterButton != (Object)null && seedExplorerFooterButton.TryTrigger(mapping, triggeredUI, triggeredMappingID, false, false))
{
__result = true;
return false;
}
SeedExplorerDialog seedExplorerDialog = ModRegistry.GetSeedExplorerDialog(__instance);
if ((Object)(object)seedExplorerDialog != (Object)null && seedExplorerDialog.ApplyScreenInput(mapping, triggeredUI, triggeredMappingID))
{
__result = true;
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch("Start")]
public static bool Start_Prefix(RunSetupScreen __instance)
{
SeedExplorer.ResetAllInstances();
return true;
}
}
[HarmonyPatch(typeof(SaveManager))]
public static class SaveManagerPatches
{
[HarmonyPrefix]
[HarmonyPatch("ResetRandomState")]
public static void ResetRandomState_Prefix(SaveManager __instance)
{
if (SeedExplorer.Instance.ShouldOverrideSeed)
{
int forcedSeed = SeedExplorer.Instance.ForcedSeed;
SaveData value = Traverse.Create((object)__instance).Property("ActiveSaveData", (object[])null).GetValue<SaveData>();
if ((Object)(object)value != (Object)null)
{
((BaseSaveData)value).SetSeed(forcedSeed);
}
SeedExplorer.Instance.ShouldOverrideSeed = false;
}
}
}
}
namespace MTSeedExplorer.Core
{
internal class ModRegistry
{
private static readonly ConditionalWeakTable<RunSetupScreen, GameUISelectableButton> _seedExplorerFooterButtonMap = new ConditionalWeakTable<RunSetupScreen, GameUISelectableButton>();
private static readonly ConditionalWeakTable<RunSetupScreen, SeedExplorerDialog> _seedExplorerDialogMap = new ConditionalWeakTable<RunSetupScreen, SeedExplorerDialog>();
internal static void RegisterSeedExplorerFooterButton(RunSetupScreen screen, GameUISelectableButton button)
{
_seedExplorerFooterButtonMap.Add(screen, button);
}
internal static GameUISelectableButton GetSeedExplorerFooterButton(RunSetupScreen screen)
{
if (_seedExplorerFooterButtonMap.TryGetValue(screen, out var value))
{
return value;
}
return null;
}
internal static void RegisterSeedExplorerDialog(RunSetupScreen screen, SeedExplorerDialog dialog)
{
_seedExplorerDialogMap.Add(screen, dialog);
}
internal static SeedExplorerDialog GetSeedExplorerDialog(RunSetupScreen screen)
{
if (_seedExplorerDialogMap.TryGetValue(screen, out var value))
{
return value;
}
return null;
}
}
public class SeedExplorer
{
public class SeedResult
{
public int Seed;
public string Card1;
public string Card2;
public string Card3;
public string Artifact1;
public string Artifact2;
public string Upgrade1;
public string Upgrade2;
}
public class SeedFilter
{
public string PrimaryCard { get; set; } = null;
public string SecondaryCard { get; set; } = null;
public string UnitCard { get; set; } = null;
public string Artifact { get; set; } = null;
public string Upgrade { get; set; } = null;
}
public enum FilterType
{
PrimaryCard,
SecondaryCard,
UnitCard,
Artifact,
Upgrade
}
public readonly List<string> Options1 = new List<string> { "a1", "b1", "c1", "d1" };
public readonly List<string> Options2 = new List<string> { "a2", "b2", "c2", "d2" };
public readonly List<string> Options3 = new List<string> { "a3", "b3", "c3", "d3" };
public readonly List<string> Options4 = new List<string> { "a4", "b4", "c4", "d4" };
public readonly List<string> Options5 = new List<string> { "a5", "b5", "c5", "d5" };
public readonly List<string[]> Results = new List<string[]>
{
new string[5] { "r1c1", "r1c2", "r1c3", "r1c4", "r1c5" },
new string[5] { "r2c1", "r2c2", "r2c3", "r2c4", "r2c5" },
new string[5] { "r3c1", "r3c2", "r3c3", "r3c4", "r3c5" },
new string[5] { "r1c1", "r1c2", "r1c3", "r1c4", "r1c5" },
new string[5] { "r2c1", "r2c2", "r2c3", "r2c4", "r2c5" },
new string[5] { "r3c1", "r3c2", "r3c3", "r3c4", "r3c5" },
new string[5] { "r1c1", "r1c2", "r1c3", "r1c4", "r1c5" },
new string[5] { "r2c1", "r2c2", "r2c3", "r2c4", "r2c5" },
new string[5] { "r3c1", "r3c2", "r3c3", "r3c4", "r3c5" },
new string[5] { "r1c1", "r1c2", "r1c3", "r1c4", "r1c5" },
new string[5] { "r2c1", "r2c2", "r2c3", "r2c4", "r2c5" },
new string[5] { "r3c1", "r3c2", "r3c3", "r3c4", "r3c5" },
new string[5] { "r1c1", "r1c2", "r1c3", "r1c4", "r1c5" },
new string[5] { "r2c1", "r2c2", "r2c3", "r2c4", "r2c5" },
new string[5] { "r3c1", "r3c2", "r3c3", "r3c4", "r3c5" },
new string[5] { "r1c1", "r1c2", "r1c3", "r1c4", "r1c5" },
new string[5] { "r2c1", "r2c2", "r2c3", "r2c4", "r2c5" },
new string[5] { "r3c1", "r3c2", "r3c3", "r3c4", "r3c5" },
new string[5] { "r1c1", "r1c2", "r1c3", "r1c4", "r1c5" },
new string[5] { "r2c1", "r2c2", "r2c3", "r2c4", "r2c5" },
new string[5] { "r3c1", "r3c2", "r3c3", "r3c4", "r3c5" }
};
public Action<IRewardGiver, int, int, int> OnStartingArtifactsGenerated = delegate
{
};
public SeedFilter Filter { get; set; } = new SeedFilter();
public static SeedExplorer Instance => GetActiveInstance();
public static Dictionary<string, SeedExplorer> Instances { get; set; } = new Dictionary<string, SeedExplorer> {
{
"default",
new SeedExplorer()
} };
public static string ActiveInstanceKey { get; set; } = "default";
private SaveManager saveManager => AllGameManagers.Instance.GetSaveManager();
private SaveData activeSaveData => Traverse.Create((object)saveManager).Property("ActiveSaveData", (object[])null).GetValue<SaveData>();
public bool ShouldOverrideSeed { get; set; }
public bool ShouldCaptureStartingCardPool { get; set; }
public bool ShouldCaptureStartingArtifactsPool { get; private set; }
public bool ShouldCaptureStartingArtifactsPregenId { get; set; }
public int ForcedSeed { get; set; }
public List<SeedResult> SeedResults { get; set; } = new List<SeedResult>();
public List<SeedResult> SeedResultsFiltered { get; set; } = new List<SeedResult>();
public List<string> PrimaryCardPool { get; set; } = new List<string>();
public List<string> SecondaryCardPool { get; set; } = new List<string>();
public List<string> UnitCardPool { get; set; } = new List<string>();
public List<string> ArtifactPool { get; set; } = new List<string>();
public List<string> UpgradePool { get; set; } = new List<string>();
private string startingArtifactsPregenId { get; set; }
private List<List<CardData>> cardPools { get; set; } = new List<List<CardData>>();
public void Init()
{
Plugin.Log("SeedExplorer.Init() called");
}
public void Start(int rowIndex)
{
Plugin.Log($"SeedExplorer.Start() row {rowIndex}");
}
public List<SeedResult> UpdateFilter(FilterType filterType, string s)
{
if (s == "<any>")
{
s = null;
}
switch (filterType)
{
case FilterType.PrimaryCard:
Filter.PrimaryCard = s;
break;
case FilterType.SecondaryCard:
Filter.SecondaryCard = s;
break;
case FilterType.UnitCard:
Filter.UnitCard = s;
break;
case FilterType.Artifact:
Filter.Artifact = s;
break;
case FilterType.Upgrade:
Filter.Upgrade = s;
break;
}
List<Func<SeedResult, bool>> list = new List<Func<SeedResult, bool>>();
if (Filter.PrimaryCard != null)
{
list.Add((SeedResult x) => x.Card1 == Filter.PrimaryCard);
}
if (Filter.SecondaryCard != null)
{
list.Add((SeedResult x) => x.Card2 == Filter.SecondaryCard);
}
if (Filter.UnitCard != null)
{
list.Add((SeedResult x) => x.Card3 == Filter.UnitCard);
}
if (Filter.Artifact != null)
{
list.Add((SeedResult x) => x.Artifact1 == Filter.Artifact || x.Artifact2 == Filter.Artifact);
}
if (Filter.Upgrade != null)
{
list.Add((SeedResult x) => x.Upgrade1 == Filter.Upgrade || x.Upgrade2 == Filter.Upgrade);
}
Func<SeedResult, bool> func = list.Aggregate<Func<SeedResult, bool>, Func<SeedResult, bool>>((SeedResult _) => true, (Func<SeedResult, bool> prev, Func<SeedResult, bool> next) => (SeedResult x) => prev(x) && next(x));
SeedResultsFiltered = SeedResults.Where(func).ToList();
if (SeedResultsFiltered.Count == 0)
{
ExploreUntilFound(func);
}
return SeedResultsFiltered;
}
public static SeedExplorer GetActiveInstance()
{
return Instances[ActiveInstanceKey];
}
public static void ResetAllInstances()
{
Instances = new Dictionary<string, SeedExplorer> {
{
"default",
new SeedExplorer()
} };
ActiveInstanceKey = "default";
}
public static SeedExplorer GetOrCreateInstance(string key)
{
if (!Instances.TryGetValue(key, out var value))
{
Instances.Add(key, value = new SeedExplorer());
}
ActiveInstanceKey = key;
return value;
}
public void OnStartingCardPoolGenerated(List<CardData> cardPool)
{
cardPools.Add(cardPool);
}
private StartingConditions GetStartingConditions()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
RunSetupScreen val = (RunSetupScreen)AllGameManagers.Instance.GetScreenManager().GetScreen((ScreenName)42);
RunSetupClassLevelInfoUI value = Traverse.Create((object)val).Field("mainClassInfo").GetValue<RunSetupClassLevelInfoUI>();
RunSetupClassLevelInfoUI value2 = Traverse.Create((object)val).Field("subClassInfo").GetValue<RunSetupClassLevelInfoUI>();
PyreHeartInfoUI value3 = Traverse.Create((object)val).Field("pyreHeartInfo").GetValue<PyreHeartInfoUI>();
CovenantSelectionUI value4 = Traverse.Create((object)val).Field("covenantSelectionUI").GetValue<CovenantSelectionUI>();
bool value5 = Traverse.Create((object)val).Field("areMutatorsEnabled").GetValue<bool>();
List<string> value6 = Traverse.Create((object)val).Field("mutatorIds").GetValue<List<string>>();
string text = ((!string.IsNullOrEmpty(value.RandomId)) ? value.RandomId : "random");
string text2 = ((!string.IsNullOrEmpty(value2.RandomId)) ? value2.RandomId : "random");
string text3 = "random";
if ((Object)(object)value.ClassData != (Object)null)
{
text = ((GameData)value.ClassData).GetID();
}
if ((Object)(object)value2.ClassData != (Object)null)
{
text2 = ((GameData)value2.ClassData).GetID();
}
StartingConditions result = default(StartingConditions);
((StartingConditions)(ref result)).SetMainClass(text, value.ChampionIndex, "");
((StartingConditions)(ref result)).SetSubClass(text2, value2.ChampionIndex, "");
((StartingConditions)(ref result)).SetClassLevelsAndUnlocks(saveManager.CreateStartingConditionClassLevelsAndUnlocks());
if ((Object)(object)value3.PyreHeartCharacterData != (Object)null)
{
text3 = ((GameData)value3.PyreHeartCharacterData).GetID();
}
((StartingConditions)(ref result)).SetPyreCharacterId(text3, (text3 == "random") ? text3 : "");
((StartingConditions)(ref result)).SetAscensionLevel(value4.CurrentLevel);
if (value5)
{
((StartingConditions)(ref result)).SetMutatorIds((IReadOnlyList<string>)value6);
}
return result;
}
private void PopulatePossibilities()
{
try
{
ShouldCaptureStartingCardPool = true;
ShouldCaptureStartingArtifactsPool = true;
SimulateGameStart();
ArtifactPool = (from x in activeSaveData.GetPregeneratedRelicRewards()
select saveManager.GetAllGameData().FindCollectableRelicData(x.relicDataID) into x
where (Object)(object)x != (Object)null
select ((RelicData)x).Cheat_GetNameEnglish()).ToList();
CardState val = saveManager.GetDeckState().Find((CardState c) => c.IsChampionCard());
CardUpgradeTreeData upgradeTree = ChampionUpgradeRewardData.GetUpgradeTree(val.GetSpawnCharacterData(), saveManager.GetBalanceData());
UpgradePool = (from x in upgradeTree.GetUpgradeTrees()
select x.GetCardUpgrades().First().Cheat_GetNameEnglish()).ToList();
PrimaryCardPool = cardPools[0].Select((CardData x) => x.Cheat_GetNameEnglish()).ToList();
SecondaryCardPool = cardPools[1].Select((CardData x) => x.Cheat_GetNameEnglish()).ToList();
UnitCardPool = (from x in cardPools[2].Union(cardPools[3])
select x.Cheat_GetNameEnglish()).ToList();
}
finally
{
ShouldCaptureStartingArtifactsPool = false;
ShouldCaptureStartingCardPool = false;
}
}
public void ExploreSeeds()
{
PopulatePossibilities();
for (int i = 0; i < 10; i++)
{
ForcedSeed = Random.Range(0, int.MaxValue);
SeedResult item = ExploreSeed(ForcedSeed);
SeedResults.Add(item);
}
SeedResultsFiltered = SeedResults;
}
private void ExploreUntilFound(Func<SeedResult, bool> condition, int timeoutSeconds = 60)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
do
{
ForcedSeed = Random.Range(0, int.MaxValue);
SeedResult item = ExploreSeed(ForcedSeed);
SeedResults.Add(item);
SeedResultsFiltered = SeedResults.Where(condition).ToList();
if (SeedResultsFiltered.Count > 0)
{
return;
}
}
while (!(stopwatch.Elapsed.TotalSeconds > (double)timeoutSeconds));
Plugin.Log($"Couldn't find matching seed in {timeoutSeconds} seconds.");
}
private SeedResult ExploreSeed(int seed)
{
try
{
ShouldOverrideSeed = true;
ShouldCaptureStartingArtifactsPregenId = true;
string startingArtifactsPregenId = "";
OnStartingArtifactsGenerated = delegate(IRewardGiver giver, int distance, int branch, int index)
{
if (distance == 0)
{
RewardNodeData val = (RewardNodeData)(object)((giver is RewardNodeData) ? giver : null);
if ((Object)(object)val != (Object)null && ((Object)val).name == "RewardNodeBlessingOnly")
{
startingArtifactsPregenId = val.GetRewardGiverID();
}
}
};
SimulateGameStart();
List<PregeneratedRelicReward> source = SimulateGenerateArtifacts();
List<CardUpgradeData> list = SimulateChampionUpgrade();
List<CardData> startOfRunShowcaseCards = saveManager.StartOfRunShowcaseCards;
IEnumerable<CollectableRelicData> source2 = (from a in source
where a.id.rewardGiverID == startingArtifactsPregenId
select saveManager.GetAllGameData().FindCollectableRelicData(a.relicDataID)).ToList().Take(2);
List<CardUpgradeData> source3 = list;
List<string> list2 = startOfRunShowcaseCards.Select((CardData c) => c.Cheat_GetNameEnglish()).ToList();
List<string> list3 = source2.Select((CollectableRelicData a) => ((RelicData)a).Cheat_GetNameEnglish()).ToList();
List<string> list4 = source3.Select((CardUpgradeData u) => u.Cheat_GetNameEnglish()).ToList();
return new SeedResult
{
Seed = seed,
Card1 = list2[0],
Card2 = list2[2],
Card3 = list2[4],
Artifact1 = list3[0],
Artifact2 = list3[1],
Upgrade1 = list4[0],
Upgrade2 = list4[1]
};
}
catch (Exception ex)
{
Plugin.Logger.LogError((object)ex);
throw ex;
}
finally
{
ShouldCaptureStartingArtifactsPregenId = false;
}
}
private List<PregeneratedRelicReward> SimulateGenerateArtifacts()
{
return saveManager.GetPregeneratedRelicRewards();
}
private List<CardUpgradeData> SimulateChampionUpgrade()
{
RandomManager.AdvanceToNextNode();
RandomManager.Range(0, 8, (RngId)10);
RewardState val = Traverse.Create((object)activeSaveData).Field("rewardStates").GetValue<List<RewardState>>()
.First((RewardState r) => ((Object)r.RewardData).name == "ChampionUpgradeReward");
RandomManager.ResetRng((RngId)10, RandomManager.GetMurmurHash(((GameData)val.RewardData).GetID() + "rewardMap"));
CardState val2 = saveManager.GetDeckState().Find((CardState c) => c.IsChampionCard());
CardUpgradeTreeData upgradeTree = ChampionUpgradeRewardData.GetUpgradeTree(val2.GetSpawnCharacterData(), saveManager.GetBalanceData());
List<CardUpgradeData> randomChoices = upgradeTree.GetRandomChoices(2, val2);
return randomChoices.ToList();
}
private void SimulateGameStart()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: 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_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
List<CardData> value = new List<CardData>(5);
List<StartOfRunReward> value2 = new List<StartOfRunReward>(5);
GameStateManager gameStateManager = AllGameManagers.Instance.GetGameStateManager();
RelicManager relicManager = AllGameManagers.Instance.GetRelicManager();
StartingConditions startingConditions = GetStartingConditions();
ClassData val = saveManager.GetAllGameData().FindClassData(((StartingConditions)(ref startingConditions)).ClassId);
ClassData val2 = saveManager.GetAllGameData().FindClassData(((StartingConditions)(ref startingConditions)).SubclassId);
string text = (((Object)(object)val != (Object)null) ? val.GetTitle() : null) ?? "RANDOM";
string text2 = (((Object)(object)val2 != (Object)null) ? val2.GetTitle() : null) ?? "RANDOM";
saveManager.ResetSave((RunType?)(RunType)1, "", false, false);
saveManager.SetActiveRunType((RunType)1);
saveManager.SetClassLevelsAndUnlocks(((StartingConditions)(ref startingConditions)).GetUnlockInfoCopy());
saveManager.SetSpChallenge(((StartingConditions)(ref startingConditions)).SpChallengeId);
saveManager.AddMutatorsById(((StartingConditions)(ref startingConditions)).Mutators);
saveManager.LoadClassesFromStartingConditions(startingConditions, false);
saveManager.SetAscensionLevel(((StartingConditions)(ref startingConditions)).AscensionLevel);
saveManager.SetRunDLCs(((StartingConditions)(ref startingConditions)).EnabledDlcs);
saveManager.SetActiveSavePyreCharacter(((StartingConditions)(ref startingConditions)).PyreCharacterId, ((StartingConditions)(ref startingConditions)).IsRandomPyreHeart ? "random" : "", false);
saveManager.SetIsFtueRun(false);
RunState runState = saveManager.GetRunState();
RunData runData = saveManager.GetRunData();
List<RelicState> list = new List<RelicState>();
list.AddRange((IEnumerable<RelicState>)saveManager.GetCovenants());
list.AddRange((IEnumerable<RelicState>)saveManager.GetMutators());
List<PyreArtifactState> collection = Traverse.Create((object)saveManager).Method("GetActiveSavePyreArtifactStates", Array.Empty<object>()).GetValue<IEnumerable<PyreArtifactState>>()
.ToList();
list.AddRange((IEnumerable<RelicState>)collection);
SetupData val3 = default(SetupData);
val3.loopIndex = (saveManager.IsEndlessRun ? (runState.GetLoopIndex() + 1) : 0);
val3.runData = runData;
val3.covenantsAndMutators = list;
val3.enabledDlcs = new List<DLC>(saveManager.GetStartingConditions().GetEnabledDlcs());
SetupData val4 = val3;
runState.Setup(val4);
if (!saveManager.IsEndlessRun && relicManager.GetShouldAddAlliedChampionCardToStartingDeck())
{
saveManager.AddCardToDeck(saveManager.GetSubClass().GetChampionCard(saveManager.GetSubChampionIndex()), (CardStateModifiers)null, false, 0, false, false, true, true);
}
if (!saveManager.IsEndlessRun)
{
runState.AddCardDraftRarityDataToRun(runData.GetCardDraftRarityData());
relicManager.ApplyStartOfRunRelicEffects(ref value, ref value2);
Traverse.Create((object)saveManager).Field("startOfRunShowcaseCards").SetValue((object)value);
Traverse.Create((object)saveManager).Field("startOfRunRewards").SetValue((object)value2);
Traverse.Create((object)saveManager).Method("SetUnlockProgressAtStartOfRun", Array.Empty<object>()).GetValue();
}
saveManager.NeedToShowRunOpeningInfo = true;
saveManager.NeedToShowRunOpeningDrafts = true;
saveManager.NeedToShowOffMutators = saveManager.GetMutatorCount() > 0;
activeSaveData.SetEndlessStartRunDraftCompleted(false);
saveManager.SetupNodes();
}
internal void StartRun(int i)
{
ShouldOverrideSeed = true;
int seed = SeedResultsFiltered[i].Seed;
ForcedSeed = seed;
}
}
}