using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AlwaysL7.Config;
using AlwaysL7.Patches;
using AlwaysL7.Utils;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Cysharp.Threading.Tasks;
using HarmonyLib;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Adventures;
using LBoL.Core.Battle;
using LBoL.Core.Cards;
using LBoL.Core.SaveData;
using LBoL.Core.Units;
using LBoL.Presentation;
using LBoL.Presentation.I10N;
using LBoL.Presentation.UI;
using LBoL.Presentation.UI.Dialogs;
using LBoL.Presentation.UI.ExtraWidgets;
using LBoL.Presentation.UI.Panels;
using LBoL.Presentation.UI.Widgets;
using LBoL.Presentation.Units;
using LBoLEntitySideloader;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("LBoL.Base")]
[assembly: IgnoresAccessChecksTo("LBoL.ConfigData")]
[assembly: IgnoresAccessChecksTo("LBoL.Core")]
[assembly: IgnoresAccessChecksTo("LBoL.EntityLib")]
[assembly: IgnoresAccessChecksTo("LBoL.Presentation")]
[assembly: IgnoresAccessChecksTo("Untitled.ConfigDataBuilder.Base")]
[assembly: AssemblyCompany("AlwaysL7")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AlwaysL7")]
[assembly: AssemblyTitle("AlwaysL7")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AlwaysL7
{
[BepInPlugin("cyaneko.lbol.mods.alwaysl7", "AlwaysL7", "0.3.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("LBoL.exe")]
public class BepinexPlugin : BaseUnityPlugin
{
private static readonly Harmony harmony = PInfo.harmony;
internal static ManualLogSource log;
internal static ConfigEntry<bool> CustomOverride;
internal static ConfigEntry<GameDifficulty> DifficultyOverride;
internal static ConfigEntry<Requests> RequestsOverride;
internal static ConfigEntry<bool> AnyDifficulty;
internal static ConfigEntry<bool> UnlockCollection;
internal static ConfigEntry<QuickStartMode> QuickStartBehaviour;
internal static ConfigEntry<LoadoutIdentifier[]> QuickStartCharacters;
internal static bool SideloaderAvailable = false;
private void Awake()
{
//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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
log = ((BaseUnityPlugin)this).Logger;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
TomlTypeConverter.AddConverter(typeof(LoadoutIdentifier[]), new TypeConverter
{
ConvertToString = (object obj, Type type) => string.Join(";", (LoadoutIdentifier[])obj),
ConvertToObject = (string str, Type type) => str.Split(";", StringSplitOptions.RemoveEmptyEntries).Select(LoadoutIdentifier.FromString).ToArray()
});
CustomOverride = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Use custom difficulty override", false, "Set your specified difficulty to be the default, instead of the highest possible");
DifficultyOverride = ((BaseUnityPlugin)this).Config.Bind<GameDifficulty>("Difficulty", "Difficulty override", (GameDifficulty)3, "Default difficulty override");
RequestsOverride = ((BaseUnityPlugin)this).Config.Bind<Requests>("Difficulty", "Requests override", Requests.HalfDrug | Requests.LowMaxHp | Requests.StartMisfortune | Requests.LowStageRegen | Requests.LowUpgradeRate | Requests.PayForUpgrade | Requests.NightMana, "Default requests override");
QuickStartBehaviour = ((BaseUnityPlugin)this).Config.Bind<QuickStartMode>("Quick Start", "Mode", QuickStartMode.LastRun, "Determines behaviour of the Quick Start button");
QuickStartCharacters = ((BaseUnityPlugin)this).Config.Bind<LoadoutIdentifier[]>("Quick Start", "Character cycle", new LoadoutIdentifier[10]
{
new LoadoutIdentifier("Reimu", "ReimuUltR"),
new LoadoutIdentifier("Sakuya", "SakuyaUltW"),
new LoadoutIdentifier("Cirno", "CirnoUltU"),
new LoadoutIdentifier("Koishi", "KoishiUltG"),
new LoadoutIdentifier("Marisa", "MarisaUltB"),
new LoadoutIdentifier("Reimu", "ReimuUltW"),
new LoadoutIdentifier("Sakuya", "SakuyaUltU"),
new LoadoutIdentifier("Cirno", "CirnoUltG"),
new LoadoutIdentifier("Koishi", "KoishiUltB"),
new LoadoutIdentifier("Marisa", "MarisaUltR")
}, "Characters to cycle through in rotating mode, identified by name and their internal spellcard ID");
AnyDifficulty = ((BaseUnityPlugin)this).Config.Bind<bool>("Unlocks", "Remove difficulty restrictions", false, "Removes restrictions on all characters, difficulties, requests and jadeboxes");
UnlockCollection = ((BaseUnityPlugin)this).Config.Bind<bool>("Unlocks", "Unlock everything", false, "Sets your profiles to level 10 and reveals all cards & exhibits");
harmony.PatchAll();
SideloaderAvailable = Chainloader.PluginInfos.ContainsKey("neo.lbol.frameworks.entitySideloader");
}
private void OnDestroy()
{
RunQuickstart.MainMenuPanel_Patches.ResetGameObj = null;
RunQuickstart.MainMenuPanel_Patches.QuickStartGameObj = null;
RunQuickstart.SettingPanel_Patches.ResetGameBtn = null;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}
public static class PInfo
{
public const string GUID = "cyaneko.lbol.mods.alwaysl7";
public const string Name = "AlwaysL7";
public const string version = "0.3.2";
public static readonly Harmony harmony = new Harmony("cyaneko.lbol.mods.alwaysl7");
}
internal class SideloaderWrapper
{
[MethodImpl(MethodImplOptions.NoInlining)]
internal static bool TryGetLoadout(string playerName, string usId, out UltimateSkill ultimateSkill, out Exhibit startingExhibit, out IEnumerable<Card> startingLibrary)
{
ultimateSkill = null;
startingExhibit = null;
startingLibrary = null;
if (UniqueTracker.Instance.loadoutInfos.TryGetValue(playerName, out var value))
{
CharLoadoutInfo val = value.Find((CharLoadoutInfo loadout) => loadout.ultimateSkill == usId);
if (val != null)
{
try
{
ultimateSkill = Library.CreateUs(val.ultimateSkill);
startingExhibit = Library.CreateExhibit(val.exhibit);
startingLibrary = val.deck.Select((string c) => Library.CreateCard(c));
return true;
}
catch (Exception arg)
{
BepinexPlugin.log.LogError((object)$"(SideloaderWrapper.TryGetLoadout) error while trying to create loadout:\n{arg}");
}
}
}
return false;
}
}
}
namespace AlwaysL7.Utils
{
public static class Extensions
{
public static T GenericMin<T>(T a, T b) where T : IComparable
{
if (a.CompareTo(b) > 0)
{
return b;
}
return a;
}
public static T GenericMax<T>(T a, T b) where T : IComparable
{
if (a.CompareTo(b) < 0)
{
return b;
}
return a;
}
}
public static class Profile
{
public static bool TryGetLastRunInHistory(out GameRunRecordSaveData record)
{
record = null;
GameMaster instance = Singleton<GameMaster>.Instance;
if (instance.CurrentSaveIndex.HasValue)
{
int value = instance.CurrentSaveIndex.Value;
string path = Path.Combine(GameMaster.PlatformHandler.GetSaveDataFolder(), GameMaster.GetHistoryFileName(value));
List<GameRunRecordSaveData> list;
try
{
if (!File.Exists(path))
{
BepinexPlugin.log.LogInfo((object)"(RunQuickstart.TryGetLastRunInHistory) Run history file does not exist");
return false;
}
list = SaveDataHelper.DeserializeGameRunHistory(File.ReadAllBytes(path));
}
catch (Exception arg)
{
BepinexPlugin.log.LogError((object)$"(RunQuickstart.TryGetLastRunInHistory) Could not read run history file: {arg}");
return false;
}
if (list.Count == 0)
{
BepinexPlugin.log.LogInfo((object)"(RunQuickstart.TryGetLastRunInHistory) Run history is empty");
return false;
}
record = list.Last();
return true;
}
return false;
}
public static bool TryGetNextLoadout(string playerName, string usId, out LoadoutIdentifier loadout)
{
LoadoutIdentifier loadoutIdentifier = new LoadoutIdentifier(playerName, usId);
switch (BepinexPlugin.QuickStartBehaviour.Value)
{
case QuickStartMode.Rotating:
{
LoadoutIdentifier[] value = BepinexPlugin.QuickStartCharacters.Value;
int num = Array.FindIndex(value, (LoadoutIdentifier l) => l.CharacterName == playerName && l.CharacterUlt == usId);
if (-1 != num)
{
loadout = value[(num + 1) % value.Length];
return true;
}
break;
}
case QuickStartMode.LastRun:
loadout = loadoutIdentifier;
return true;
}
loadout = default(LoadoutIdentifier);
return false;
}
public static GameDifficulty GetHighestUnlockedDifficulty(string playerName)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_0072: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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_008e: 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)
if (BepinexPlugin.AnyDifficulty.Value)
{
return (GameDifficulty)3;
}
GameDifficulty val = (GameDifficulty)1;
PlayerUnit val2 = (from p in Library.GetSelectablePlayers()
where ((GameEntity)p).Id == playerName
select p).FirstOrDefault();
if (val2 != null)
{
ProfileSaveData currentProfile = Singleton<GameMaster>.Instance.CurrentProfile;
if (currentProfile != null)
{
GameDifficulty? highestDifficulty = currentProfile.GetHighestDifficulty(((GameEntity)val2).Id);
GameDifficulty? highestPerfectDifficulty = currentProfile.GetHighestPerfectDifficulty(((GameEntity)val2).Id);
if (highestPerfectDifficulty.HasValue)
{
val = Extensions.GenericMax<GameDifficulty>(val, highestPerfectDifficulty.Value);
}
if (highestDifficulty.HasValue)
{
val = Extensions.GenericMax<GameDifficulty>(val, highestDifficulty.Value);
}
}
val = Extensions.GenericMin<GameDifficulty>(val, (GameDifficulty)3);
}
return val;
}
public static PuzzleFlag GetUnlockedRequests()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
if (BepinexPlugin.AnyDifficulty.Value)
{
return (PuzzleFlag)127;
}
int currentProfileLevel = Singleton<GameMaster>.Instance.CurrentProfileLevel;
PuzzleFlag val = (PuzzleFlag)0;
foreach (PuzzleConfig item in PuzzleConfig.AllConfig())
{
if (item.UnlockLevel <= currentProfileLevel && Enum.TryParse<PuzzleFlag>(item.Id, ignoreCase: true, out PuzzleFlag result))
{
val |= result;
}
}
return val;
}
}
}
namespace AlwaysL7.Patches
{
public class ExtraLocalisation
{
public const string UIPrefix = "UI.";
public const string MessageDialogPrefix = "MessageDialog.";
public const string ResetGameButtonName = "ResetGame";
public const string GameResetWarningKey = "ResetGameWarning";
public const string QuickStartButtonName = "QuickStartGame";
public static readonly Dictionary<(Locale, string), string> LocTable = new Dictionary<(Locale, string), string>
{
[((Locale)0, "UI.ResetGame")] = "Reset Run",
[((Locale)0, "UI.QuickStartGame")] = "Quick Start",
[((Locale)0, "MessageDialog.ResetGameWarning")] = "Reset your current run?",
[((Locale)5, "UI.ResetGame")] = "Reiniciar Partida",
[((Locale)5, "UI.QuickStartGame")] = "Partida Rápida",
[((Locale)5, "MessageDialog.ResetGameWarning")] = "¿Reiniciar la partida actual?",
[((Locale)8, "UI.ResetGame")] = "Réinitialiser la Partie",
[((Locale)8, "UI.QuickStartGame")] = "Partie Rapide",
[((Locale)8, "MessageDialog.ResetGameWarning")] = "Êtes-vous sûr de vouloir réinitialiser votre partie actuelle?",
[((Locale)12, "UI.ResetGame")] = "Azzera la Partita",
[((Locale)12, "UI.QuickStartGame")] = "Rapido Partita",
[((Locale)12, "MessageDialog.ResetGameWarning")] = "Azzerare la partita in corso?",
[((Locale)3, "UI.ResetGame")] = "攻略リセット",
[((Locale)3, "UI.QuickStartGame")] = "クイックスタート",
[((Locale)3, "MessageDialog.ResetGameWarning")] = "現在のランの進行状況をリセットしてよいですか?",
[((Locale)10, "UI.ResetGame")] = "게임 리셋",
[((Locale)10, "UI.QuickStartGame")] = "빠른 시작",
[((Locale)10, "MessageDialog.ResetGameWarning")] = "새롭게 게임을 시작하겠습니까?",
[((Locale)6, "UI.ResetGame")] = "Resetuj Przejście",
[((Locale)6, "UI.QuickStartGame")] = "Szybka Gra",
[((Locale)6, "MessageDialog.ResetGameWarning")] = "Czy na pewno chcesz zresetować to przejście?",
[((Locale)7, "UI.ResetGame")] = "Reiniciar Jogo",
[((Locale)7, "UI.QuickStartGame")] = "Jogo Rápido",
[((Locale)7, "MessageDialog.ResetGameWarning")] = "Reiniciar a partida atual?",
[((Locale)4, "UI.ResetGame")] = "Перезагружить поход",
[((Locale)4, "UI.QuickStartGame")] = "Быстрый поход",
[((Locale)4, "MessageDialog.ResetGameWarning")] = "Перезагружить текущий поход?",
[((Locale)9, "UI.ResetGame")] = "Sıfırlamak Turu",
[((Locale)9, "UI.QuickStartGame")] = "Hızlı Tur",
[((Locale)9, "MessageDialog.ResetGameWarning")] = "Şu anki turu yarıda sıfırlamak?",
[((Locale)14, "UI.ResetGame")] = "Скинути Проходження",
[((Locale)14, "UI.QuickStartGame")] = "Швидке Проходження",
[((Locale)14, "MessageDialog.ResetGameWarning")] = "Скинути поточне проходження?",
[((Locale)1, "UI.ResetGame")] = "rosl",
[((Locale)1, "UI.QuickStartGame")] = "一键开局",
[((Locale)1, "MessageDialog.ResetGameWarning")] = "确定要rosl?",
[((Locale)2, "UI.ResetGame")] = "rosl",
[((Locale)2, "UI.QuickStartGame")] = "一鍵開局",
[((Locale)2, "MessageDialog.ResetGameWarning")] = "確定要rosl?"
};
}
[HarmonyPatch]
public class Localisation
{
public static MethodBase TargetMethod()
{
return AccessTools.Method((from t in typeof(Localization).GetNestedTypes(AccessTools.allDeclared)
where t.Name.Contains("<ReloadCommonAsync>")
select t).Single(), "MoveNext", (Type[])null, (Type[])null);
}
public static void PostReloadCommon()
{
foreach (var (tuple2, value) in ExtraLocalisation.LocTable.Where((KeyValuePair<(Locale, string), string> kvp) => kvp.Key.Item1 == Localization.CurrentLocale))
{
Localization.LocalizationTable.Add(tuple2.Item2, value);
}
}
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> AsyncPostfix(IEnumerable<CodeInstruction> instructions, ILGenerator gen)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
return new CodeMatcher(instructions, gen).End().MatchBack(true, (CodeMatch[])(object)new CodeMatch[8]
{
CodeMatch.op_Implicit(new CodeInstruction(OpCodes.Ldarg_0, (object)null)),
CodeMatch.op_Implicit(new CodeInstruction(OpCodes.Ldc_I4_M1, (object)null)),
CodeMatch.op_Implicit(new CodeInstruction(OpCodes.Dup, (object)null)),
CodeMatch.op_Implicit(new CodeInstruction(OpCodes.Stloc_0, (object)null)),
CodeMatch.op_Implicit(new CodeInstruction(OpCodes.Stfld, (object)null)),
CodeMatch.op_Implicit(new CodeInstruction(OpCodes.Ldloca_S, (object)null)),
CodeMatch.op_Implicit(new CodeInstruction(OpCodes.Call, (object)null)),
CodeMatch.op_Implicit(new CodeInstruction(OpCodes.Leave, (object)null))
}).Advance(-1)
.Insert((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Localisation), "PostReloadCommon", (Type[])null, (Type[])null))
})
.InstructionEnumeration();
}
}
[HarmonyPatch]
public class Profile
{
private static void UnlockAllForProfile(ProfileSaveData prof)
{
if (prof != null)
{
if (prof.Exp < ExpHelper.MaxExp)
{
int num = ExpHelper.MaxExp - prof.Exp;
prof.BluePoint += num;
prof.Exp += num;
}
prof.CardsRevealed = (from cfg in CardConfig.AllConfig()
where !cfg.HideMesuem && cfg.DebugLevel == 0
select cfg.Id).ToList();
prof.CardsRevealed.Sort();
prof.ExhibitsRevealed = (from cfg in ExhibitConfig.AllConfig()
where cfg.Revealable && !cfg.IsDebug
select cfg.Id).ToList();
prof.ExhibitsRevealed.Sort();
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPostfix]
public static void UnlockAllOnNewProfile(ProfileSaveData __instance)
{
if (BepinexPlugin.UnlockCollection.Value)
{
UnlockAllForProfile(__instance);
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPostfix]
public static void UnlockAllOnLoadedProfile(ProfileSaveData saveData)
{
if (BepinexPlugin.UnlockCollection.Value)
{
UnlockAllForProfile(saveData);
}
}
}
[HarmonyPatch]
public class RunQuickstart
{
[HarmonyPatch(typeof(GameMaster))]
public class GameMaster_Patches
{
public static IEnumerator CoPostResetGameRun(GameMaster gm)
{
if (gm.CurrentGameRun == null)
{
throw new InvalidOperationException("Not in game-run");
}
yield return UniTaskExtensions.ToCoroutine(UiManager.ShowLoading(0.5f), (Action<Exception>)null);
if (gm.CurrentGameRun.Battle != null)
{
UiManager.LeaveBattle();
}
UiManager.LeaveGameRun();
gm.CurrentGameRun = null;
Environment.Instance.ClearEnvironment();
GameDirector.ClearAll();
GameMaster.UnloadGameRunUi();
GC.Collect();
Resources.UnloadUnusedAssets();
GameRunSaveData gameSave = GameSave;
GameSave = null;
GameRunController val = NewRunFromSave(gameSave);
if (val != null)
{
yield return gm.CoNewGameRun(val);
}
}
[HarmonyPatch("EndGameProcedure")]
[HarmonyPrefix]
public static void OnGameEnd()
{
if ((Object)null != (Object)(object)SettingPanel_Patches.ResetGameBtn)
{
((Selectable)SettingPanel_Patches.ResetGameBtn).interactable = false;
}
}
[HarmonyPatch("LeaveGameRun")]
[HarmonyPrefix]
public static bool OnLeaveRun()
{
if (HookCoLeave)
{
HookCoLeave = false;
GameMaster instance = Singleton<GameMaster>.Instance;
GameDirector.StopLoreChat();
((MonoBehaviour)instance).StopAllCoroutines();
((MonoBehaviour)instance).StartCoroutine(CoPostResetGameRun(instance));
return false;
}
return true;
}
}
[HarmonyPatch(typeof(MainMenuPanel))]
public class MainMenuPanel_Patches
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Action <>9__4_1;
public static UnityAction <>9__4_0;
internal void <PanelAwake>b__4_0()
{
UI_ConfirmationPopup("ResetGameWarning", delegate
{
ResetGameRun(CoMenuResetGameRun);
});
}
internal void <PanelAwake>b__4_1()
{
ResetGameRun(CoMenuResetGameRun);
}
}
public static GameObject ResetGameObj;
public static GameObject QuickStartGameObj;
private static void QuickStartGameRun()
{
GameMaster instance = Singleton<GameMaster>.Instance;
if (instance.CurrentGameRun != null)
{
BepinexPlugin.log.LogError((object)"(QuickStartGameRun) Already in game-run");
return;
}
GameRunController val = NewQuickStartRun();
if (val != null)
{
((MonoBehaviour)instance).StartCoroutine(instance.CoNewGameRun(val));
}
else
{
GameMaster.ShowErrorDialogWithKey("CorruptedGameRunSaveData");
}
}
private static IEnumerator CoMenuResetGameRun(GameRunSaveData save)
{
GameResultPanel grPanel = UiManager.GetPanel<GameResultPanel>();
GameMaster.RequestAbandonGameRun(false);
yield return (object)new WaitWhile((Func<bool>)(() => ((UiBase)grPanel).IsVisible));
GameRunController val = NewRunFromSave(save);
if (val != null)
{
yield return Singleton<GameMaster>.Instance.CoNewGameRun(val);
}
}
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void PanelAwake(MainMenuPanel __instance)
{
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
Transform transform = ((Component)__instance.mainMenuButtonGroup).transform;
if ((Object)null == (Object)(object)transform.Find("ResetGame"))
{
GameObject gameObject = ((Component)__instance.restoreGameButton).gameObject;
Transform[] componentsInChildren = ((Component)transform).GetComponentsInChildren<Transform>(true);
foreach (Transform val in componentsInChildren)
{
RectTransform component = ((Component)val).GetComponent<RectTransform>();
if (!((Object)null != (Object)(object)component))
{
continue;
}
Vector2 offsetMin = component.offsetMin;
Vector2 offsetMax = component.offsetMax;
component.offsetMin += Vector2.up * 120f;
component.offsetMax += Vector2.up * 120f;
if (!(((Object)val).name == ((Object)gameObject).name))
{
continue;
}
object obj = <>c.<>9__4_0;
if (obj == null)
{
UnityAction val2 = delegate
{
UI_ConfirmationPopup("ResetGameWarning", delegate
{
ResetGameRun(CoMenuResetGameRun);
});
};
<>c.<>9__4_0 = val2;
obj = (object)val2;
}
ResetGameObj = CreateButton(gameObject, transform, offsetMin, offsetMax, "ResetGame", positionBeforeOrig: false, (UnityAction)obj);
break;
}
}
if ((Object)null == (Object)(object)transform.Find("QuickStartGame"))
{
GameObject gameObject2 = ((Component)__instance.newGameButton).gameObject;
RectTransform component2 = gameObject2.GetComponent<RectTransform>();
if ((Object)null != (Object)(object)component2)
{
QuickStartGameObj = CreateButton(gameObject2, transform, component2.offsetMin + Vector2.up * 120f, component2.offsetMax + Vector2.up * 120f, "QuickStartGame", positionBeforeOrig: true, new UnityAction(QuickStartGameRun));
}
}
}
[HarmonyPatch("RefreshProfile")]
[HarmonyPostfix]
public static void PanelShow(MainMenuPanel __instance)
{
bool flag = Singleton<GameMaster>.Instance.GameRunSaveData != null;
GameObject resetGameObj = ResetGameObj;
if (resetGameObj != null)
{
resetGameObj.SetActive(flag);
}
GameObject quickStartGameObj = QuickStartGameObj;
if (quickStartGameObj != null)
{
quickStartGameObj.SetActive(!flag);
}
}
}
[HarmonyPatch(typeof(SettingPanel))]
public class SettingPanel_Patches
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Action <>9__2_1;
public static UnityAction <>9__2_0;
internal void <PanelAwake>b__2_0()
{
UI_ConfirmationPopup("ResetGameWarning", delegate
{
ResetGameRun(CoMidRunResetGameRun);
});
}
internal void <PanelAwake>b__2_1()
{
ResetGameRun(CoMidRunResetGameRun);
}
}
public static Button ResetGameBtn;
private static IEnumerator CoMidRunResetGameRun(GameRunSaveData save)
{
GameResultPanel grPanel = UiManager.GetPanel<GameResultPanel>();
GameMaster instance = Singleton<GameMaster>.Instance;
GameDirector instance2 = Singleton<GameDirector>.Instance;
GameRunController currentGameRun = instance.CurrentGameRun;
GameSave = save;
HookCoLeave = true;
((MonoBehaviour)instance).StopAllCoroutines();
((Unit)currentGameRun.Player).Hp = 0;
((Unit)currentGameRun.Player).Status = (UnitStatus)2;
currentGameRun.Status = (GameRunStatus)3;
currentGameRun.GenerateRecords(false, (EnemyGroup)null, (Adventure)null);
BattleController battle = currentGameRun.Battle;
if (battle != null)
{
currentGameRun.LeaveBattle(battle.EnemyGroup);
UiManager.LeaveBattle();
instance2.LeaveBattle(battle);
}
GameDirector.ClearDoremyEnvironment();
((Component)UiManager.GetPanel<BattleManaPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<BossExhibitPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<CardDetailPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<ExhibitInfoPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<GapOptionsPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<HintPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<MapPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<NazrinDetectPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<PlayBoard>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<PopupHud>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<RewardPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<SelectCardPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<ShopPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<ShowCardsPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<SettingPanel>()).gameObject.SetActive(false);
((Behaviour)UiManager.GetPanel<SystemBoard>().mapButton).enabled = false;
((Component)UiManager.GetPanel<SpellPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<UltimateSkillPanel>()).gameObject.SetActive(false);
((Component)UiManager.GetPanel<VnPanel>()).gameObject.SetActive(false);
GameMaster.EndGameProcedure(currentGameRun);
yield return (object)new WaitWhile((Func<bool>)(() => ((UiBase)grPanel).IsVisible));
}
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void PanelAwake(SettingPanel __instance)
{
//IL_0066: 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_0071: Expected O, but got Unknown
Transform transform = __instance.inGameGroup.gameObject.transform;
if (!((Object)null == (Object)(object)transform.Find("ResetGame")))
{
return;
}
GameObject obj = Object.Instantiate<GameObject>(((Component)__instance.reenterStationButton).gameObject, transform);
((Object)obj).name = "ResetGame";
obj.transform.SetSiblingIndex(2);
object obj2 = <>c.<>9__2_0;
if (obj2 == null)
{
UnityAction val = delegate
{
UI_ConfirmationPopup("ResetGameWarning", delegate
{
ResetGameRun(CoMidRunResetGameRun);
});
};
<>c.<>9__2_0 = val;
obj2 = (object)val;
}
PostCreateButton(obj, "ResetGame", (UnityAction)obj2);
ResetGameBtn = obj.GetComponent<Button>();
}
}
private static bool HookCoLeave;
private static GameRunSaveData GameSave;
private static GameObject CreateButton(GameObject orig, Transform parent, Vector2 rtfOffMin, Vector2 rtfOffMax, string key, bool positionBeforeOrig, UnityAction call)
{
//IL_0041: 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)
GameObject obj = Object.Instantiate<GameObject>(orig, parent);
((Object)obj).name = key;
obj.transform.SetSiblingIndex(orig.transform.GetSiblingIndex() + ((!positionBeforeOrig) ? 1 : 0));
RectTransform component = ((Component)obj.transform).GetComponent<RectTransform>();
if ((Object)null != (Object)(object)component)
{
component.offsetMin = rtfOffMin;
component.offsetMax = rtfOffMax;
}
PostCreateButton(obj, key, call);
return obj;
}
private static void PostCreateButton(GameObject btnObj, string key, UnityAction call)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
Object.DestroyImmediate((Object)(object)btnObj.GetComponent<Button>());
Button obj = btnObj.AddComponent<Button>();
((UnityEvent)obj.onClick).AddListener(call);
CommonButtonWidget widget = btnObj.GetComponent<CommonButtonWidget>();
((UnityEvent)obj.onClick).AddListener((UnityAction)delegate
{
AudioManager.Button(widget.audioIndex);
});
LocalizedText componentInChildren = btnObj.GetComponentInChildren<LocalizedText>();
componentInChildren.key = "UI." + key;
componentInChildren.OnLocaleChanged();
}
private static bool TryCreateLoadout(string playerName, string usId, out PlayerUnit ply, out PlayerType plyType, out Exhibit startingExhibit, out IEnumerable<Card> startingDeck)
{
ply = null;
plyType = (PlayerType)0;
startingExhibit = null;
startingDeck = null;
PlayerUnit val = (from p in Library.GetSelectablePlayers()
where ((GameEntity)p).Id == playerName
select p).FirstOrDefault();
if (val == null)
{
BepinexPlugin.log.LogError((object)("(RunQuickstart.TryCreateLoadout) could not create loadout: unknown player " + playerName));
return false;
}
PlayerUnitConfig config = val.Config;
ply = Library.CreatePlayerUnit(((object)val).GetType());
UltimateSkill ultimateSkill = null;
bool flag = config.UltimateSkillA == usId;
bool flag2 = config.UltimateSkillB == usId;
if (!flag && !flag2)
{
if (!BepinexPlugin.SideloaderAvailable || !SideloaderWrapper.TryGetLoadout(playerName, usId, out ultimateSkill, out startingExhibit, out startingDeck))
{
BepinexPlugin.log.LogError((object)("(RunQuickstart.TryCreateLoadout) loadout for " + playerName + " with Us " + usId + " not found"));
return false;
}
}
else
{
plyType = (PlayerType)((!flag) ? 1 : 0);
ultimateSkill = Library.CreateUs(flag ? config.UltimateSkillA : config.UltimateSkillB);
startingExhibit = Library.CreateExhibit(flag ? config.ExhibitA : config.ExhibitB);
startingDeck = (flag ? config.DeckA : config.DeckB).Select((string c) => Library.CreateCard(c));
}
ply.SetUs(ultimateSkill);
return true;
}
private static GameRunController NewQuickStartRun()
{
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: 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_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Expected O, but got Unknown
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
if (!AlwaysL7.Utils.Profile.TryGetLastRunInHistory(out var record))
{
BepinexPlugin.log.LogError((object)"(RunQuickstart.NewQuickStartRun) could not start game run - could not get last run from profile");
UiManager.GetPanel<MainMenuPanel>().RefreshProfile();
return null;
}
if (!AlwaysL7.Utils.Profile.TryGetNextLoadout(record.Player, record.Us, out var loadout))
{
BepinexPlugin.log.LogError((object)"(RunQuickstart.NewQuickStartRun) could not start game run - could not get loadout");
UiManager.GetPanel<MainMenuPanel>().RefreshProfile();
return null;
}
try
{
if (!TryCreateLoadout(loadout.CharacterName, loadout.CharacterUlt, out var ply, out var plyType, out var startingExhibit, out var startingDeck))
{
BepinexPlugin.log.LogError((object)"(RunQuickstart.NewQuickStartRun) could not start game run - loadout creation failed");
UiManager.GetPanel<MainMenuPanel>().RefreshProfile();
return null;
}
GameMaster instance = Singleton<GameMaster>.Instance;
ProfileSaveData currentProfile = instance.CurrentProfile;
if (currentProfile == null)
{
BepinexPlugin.log.LogError((object)"(RunQuickstart.NewQuickStartRun) could not start game run - no profile selected");
UiManager.GetPanel<MainMenuPanel>().RefreshProfile();
return null;
}
StartGameData defaultMode = MainMenuPanel.DefaultMode;
GameDifficulty val = AlwaysL7.Utils.Profile.GetHighestUnlockedDifficulty(loadout.CharacterName);
if (BepinexPlugin.CustomOverride.Value)
{
val = Extensions.GenericMin<GameDifficulty>(val, BepinexPlugin.DifficultyOverride.Value);
}
PuzzleFlag val2 = AlwaysL7.Utils.Profile.GetUnlockedRequests();
if (BepinexPlugin.CustomOverride.Value)
{
val2 = (PuzzleFlag)(val2 & BepinexPlugin.RequestsOverride.Value);
}
return GameRunController.Create(new GameRunStartupParameters
{
Mode = (GameMode)1,
ShowRandomResult = GameMaster.DefaultShowRandomResult,
Seed = null,
Difficulty = val,
Puzzles = val2,
Player = ply,
PlayerType = plyType,
InitExhibit = startingExhibit,
InitMoneyOverride = null,
Deck = startingDeck,
Stages = defaultMode.StagesCreateFunc(),
DebutAdventureType = defaultMode.DebutAdventure,
UserProfile = currentProfile,
UnlockLevel = instance.CurrentProfileLevel,
JadeBoxes = new List<JadeBox>()
});
}
catch (Exception arg)
{
BepinexPlugin.log.LogError((object)$"(RunQuickstart.NewQuickStartRun) could not start game run:\n{arg}");
UiManager.GetPanel<MainMenuPanel>().RefreshProfile();
return null;
}
}
private static GameRunController NewRunFromSave(GameRunSaveData save)
{
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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_00ec: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: 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_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Expected O, but got Unknown
string name = save.Player.Name;
string us = save.Player.Us;
try
{
if (!TryCreateLoadout(name, us, out var ply, out var plyType, out var startingExhibit, out var startingDeck))
{
BepinexPlugin.log.LogError((object)"(RunQuickstart.NewRunFromSave) could not start game run - loadout creation failed");
UiManager.GetPanel<MainMenuPanel>().RefreshProfile();
return null;
}
IEnumerable<JadeBox> jadeBoxes = save.JadeBoxes.Select((JadeBoxSaveData j) => Library.CreateJadeBox(j.Name));
ulong? seed = null;
if (!save.IsAutoSeed)
{
seed = save.RootSeed;
}
StartGameData defaultMode = MainMenuPanel.DefaultMode;
GameMaster instance = Singleton<GameMaster>.Instance;
ProfileSaveData currentProfile = instance.CurrentProfile;
if (currentProfile == null)
{
BepinexPlugin.log.LogError((object)"(RunQuickstart.NewRunFromSave) could not start game run - no profile selected");
UiManager.GetPanel<MainMenuPanel>().RefreshProfile();
return null;
}
return GameRunController.Create(new GameRunStartupParameters
{
Mode = save.Mode,
ShowRandomResult = save.ShowRandomResult,
Seed = seed,
Difficulty = save.Difficulty,
Puzzles = save.Puzzles,
Player = ply,
PlayerType = plyType,
InitExhibit = startingExhibit,
InitMoneyOverride = null,
Deck = startingDeck,
Stages = defaultMode.StagesCreateFunc(),
DebutAdventureType = defaultMode.DebutAdventure,
UserProfile = currentProfile,
UnlockLevel = instance.CurrentProfileLevel,
JadeBoxes = jadeBoxes
});
}
catch (Exception arg)
{
BepinexPlugin.log.LogError((object)$"(RunQuickstart.NewRunFromSave) could not start game run:\n{arg}");
UiManager.GetPanel<MainMenuPanel>().RefreshProfile();
return null;
}
}
private static void ResetGameRun(Func<GameRunSaveData, IEnumerator> coro)
{
GameMaster instance = Singleton<GameMaster>.Instance;
GameRunSaveData gameRunSaveData = instance.GameRunSaveData;
if (gameRunSaveData != null)
{
((MonoBehaviour)instance).StartCoroutine(coro(gameRunSaveData));
}
else
{
GameMaster.ShowErrorDialogWithKey("CorruptedGameRunSaveData");
}
}
public static void UI_ConfirmationPopup(string key, Action confirmAction)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
((UiDialog<MessageContent>)(object)UiManager.GetDialog<MessageDialog>()).Show(new MessageContent
{
TextKey = key,
Icon = (MessageIcon)1,
Buttons = (DialogButtons)1,
OnConfirm = confirmAction
});
}
}
[HarmonyPatch(typeof(StartGamePanel))]
public class StartGameUI
{
[HarmonyPatch("RefreshConfirm")]
[HarmonyPostfix]
public static void UnlockCharacter(StartGamePanel __instance)
{
if (BepinexPlugin.AnyDifficulty.Value && __instance._playerIndex >= 0 && __instance._playerIndex <= __instance._players.Length && __instance._players[__instance._playerIndex].Config.UnlockLevel.HasValue)
{
__instance.characterHintRoot.gameObject.SetActive(false);
((TMP_Text)__instance.characterHint).text = "";
((Selectable)__instance.characterConfirmButton).interactable = true;
}
}
[HarmonyPatch("RefreshDifficultyConfirm")]
[HarmonyPostfix]
public static void UnlockDifficulty(StartGamePanel __instance)
{
if (BepinexPlugin.AnyDifficulty.Value && !__instance.gameModeSwitch.IsOn)
{
__instance.difficultyGroups[__instance._difficultyIndex].SetLocked(false);
__instance._isDifficultyLock = false;
((Selectable)__instance.difficultyConfirmButton).interactable = true;
__instance._confirmTooltip.SetDirect("", (string)null);
}
}
[HarmonyPatch("SetPuzzleStatus")]
[HarmonyPostfix]
public static void UnlockRequests(StartGamePanel __instance)
{
if (!BepinexPlugin.AnyDifficulty.Value)
{
return;
}
for (int i = 0; i < PuzzleFlags.AllPuzzleFlags.Count; i++)
{
foreach (PuzzleToggleWidget value in __instance._puzzleToggles.Values)
{
value.IsLock = false;
}
}
__instance.puzzleSelectAllGroup.SetActive(true);
}
[HarmonyPatch("SetJadeBoxStatus")]
[HarmonyPostfix]
public static void UnlockJadeboxes(StartGamePanel __instance)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (BepinexPlugin.AnyDifficulty.Value)
{
((Selectable)__instance.jadeBoxButton).interactable = true;
((Behaviour)__instance._jadeBoxTooltip).enabled = false;
((Component)__instance.jadeBoxLockImage).gameObject.SetActive(false);
((Graphic)__instance.jadeBoxText).color = Color.white;
}
}
[HarmonyPatch("OnShowing")]
[HarmonyPostfix]
public static void SetFromConfig(StartGamePanel __instance)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
((UnityEvent)__instance.characterConfirmButton.onClick).AddListener((UnityAction)delegate
{
//IL_0059: 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_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected I4, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected I4, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Invalid comparison between I4 and Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
int num = 1;
if (__instance._player != null)
{
GameDifficulty highestUnlockedDifficulty = AlwaysL7.Utils.Profile.GetHighestUnlockedDifficulty(((GameEntity)__instance._player).Id);
int num2 = (int)BepinexPlugin.DifficultyOverride.Value;
num = ((!BepinexPlugin.CustomOverride.Value || num2 > (int)highestUnlockedDifficulty) ? Math.Max(num, (int)highestUnlockedDifficulty) : num2);
}
__instance.SelectDifficulty(num, true);
PuzzleFlag unlockedRequests = AlwaysL7.Utils.Profile.GetUnlockedRequests();
foreach (PuzzleToggleWidget value in __instance._puzzleToggles.Values)
{
PuzzleFlag val = (PuzzleFlag)(value._puzzleFlag & unlockedRequests);
if ((int)val != 0 && (!BepinexPlugin.CustomOverride.Value || (val & BepinexPlugin.RequestsOverride.Value) != 0))
{
value.Toggle.isOn = true;
}
}
});
}
}
}
namespace AlwaysL7.Config
{
public enum QuickStartMode
{
LastRun,
Rotating
}
[Flags]
public enum Requests
{
[Description("Bitter Medicine - Eirin's pills are half as effective.")]
HalfDrug = 1,
[Description("Last Stand - Maximum life is reduced by 10.")]
LowMaxHp = 2,
[Description("Notoriety - Begin the game with Eviction Order shuffled into the library.")]
StartMisfortune = 4,
[Description("No Time To Rest - Gain only half life and money from bosses.")]
LowStageRegen = 8,
[Description("Hyperinflation - You are half as likely to find upgraded cards. Takane's shop prices are 10% higher.")]
LowUpgradeRate = 0x10,
[Description("Training At A Price - Upgrading non-Basic cards at a Gap costs 25 money.")]
PayForUpgrade = 0x20,
[Description("Nighttime Fatigue - At the start of combat, add a Long Night card to the hand.")]
NightMana = 0x40
}
public readonly struct LoadoutIdentifier
{
public readonly string CharacterName;
public readonly string CharacterUlt;
public LoadoutIdentifier(string charName, string charUs)
{
CharacterName = charName;
CharacterUlt = charUs;
}
public override string ToString()
{
return "(" + CharacterName + "," + CharacterUlt + ")";
}
public static LoadoutIdentifier FromString(string s)
{
string charName = string.Empty;
string charUs = string.Empty;
if (s != null)
{
string[] array = s.Trim('(', ')').Replace(" ", string.Empty).Split(',', StringSplitOptions.RemoveEmptyEntries);
if (array.Length == 2)
{
charName = array[0];
charUs = array[1];
}
}
return new LoadoutIdentifier(charName, charUs);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}