using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using CustomSideDeck.Info;
using DiskCardGame;
using GBC;
using HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Card;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using InscryptionAPI.Helpers.Extensions;
using InscryptionAPI.Saves;
using Microsoft.CodeAnalysis;
using Pixelplacement;
using UnityEngine;
[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("CustomSideDeck")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Change the side deck to something other than squirrels!")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: AssemblyInformationalVersion("2.3.0")]
[assembly: AssemblyProduct("CustomSideDeck")]
[assembly: AssemblyTitle("CustomSideDeck")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.3.0.0")]
[module: UnverifiableCode]
[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;
}
}
}
namespace CustomSideDeck
{
[BepInPlugin("tvflabs.inscryption.CustomSideDeck", "CustomSideDeck", "2.3.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Part1CardDrawPiles_SideDeckData_Patch
{
public static void Postfix(ref List<CardInfo> __result, Part1CardDrawPiles __instance)
{
List<CardInfo> sideDeckCards = SideDeckCards;
__result = sideDeckCards;
}
}
[HarmonyPatch(typeof(AscensionSaveData), "GetActiveChallengePoints")]
public class AscensionSaveData_GetActiveChallengePoints_Patch
{
public static void Postfix(ref int __result, AscensionSaveData __instance)
{
if (CurrentSideDeck != null)
{
__result += CurrentSideDeck.challengePoints;
}
}
}
[HarmonyPatch(typeof(Part1CardDrawPiles), "Start")]
public class Part1CardDrawPiles_Start_Patch
{
public static void Postfix(Part1CardDrawPiles __instance)
{
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Expected O, but got Unknown
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("CSD_squirrel_back.png", (FilterMode)0);
if (CurrentSideDeck.cardBack != null)
{
if (CurrentSideDeck.cardBack == "squirrel")
{
imageAsTexture = TextureHelper.GetImageAsTexture("CSD_squirrel_back.png", (FilterMode)0);
flag = true;
}
else if (CurrentSideDeck.cardBack == "bee")
{
imageAsTexture = TextureHelper.GetImageAsTexture("CSD_bee_back.png", (FilterMode)0);
flag = true;
}
else if (CurrentSideDeck.cardBack == "waterborne" || CurrentSideDeck.cardBack == "aquasquirrel" || CurrentSideDeck.cardBack == "aqua" || CurrentSideDeck.cardBack == "submerge")
{
imageAsTexture = TextureHelper.GetImageAsTexture("CSD_aquasquirrel_back.png", (FilterMode)0);
flag = true;
}
else if (CurrentSideDeck.cardBack == "blank")
{
imageAsTexture = TextureHelper.GetImageAsTexture("CSD_card_back_template.png", (FilterMode)0);
flag = true;
}
if (!flag && !(CurrentSideDeck.cardBack == "generated") && !(CurrentSideDeck.cardBack == "gen"))
{
DirectoryInfo directoryInfo = new DirectoryInfo(Paths.PluginPath);
FileInfo[] files = directoryInfo.GetFiles(CurrentSideDeck.cardBack, SearchOption.AllDirectories);
if (files.Length != 0)
{
string fullName = files[0].FullName;
if ((Object)(object)TextureHelper.GetImageAsTexture(fullName, (FilterMode)0) != (Object)null)
{
imageAsTexture = TextureHelper.GetImageAsTexture(fullName, (FilterMode)0);
flag = true;
}
}
}
}
if ((plugin.generateCardBacks.Value || (CurrentSideDeck.cardBack != null && (CurrentSideDeck.cardBack == "generated" || CurrentSideDeck.cardBack == "gen"))) && !flag)
{
imageAsTexture = TextureHelper.GetImageAsTexture("CSD_card_back_template.png", (FilterMode)0);
Texture2D texture = CardLoader.GetCardByName(CurrentSideDeck.defaultCard).portraitTex.texture;
if ((Object)(object)texture != (Object)null)
{
Color32[] pixels = texture.GetPixels32();
Color32[] pixels2 = imageAsTexture.GetPixels32();
for (int i = 0; i < pixels.Length; i++)
{
if (pixels[i].a > 0)
{
Color32 val = Color32.op_Implicit(Color.Lerp(Color32.op_Implicit(pixels2[(i % ((Texture)texture).width + 5) * (i / ((Texture)texture).width + 49)]), Color32.op_Implicit(pixels[i]), ((float)(int)pixels[i].a - 8f) / 255f));
imageAsTexture.SetPixel(i % ((Texture)texture).width + 5, i / ((Texture)texture).width + 49, Color32.op_Implicit(new Color32(val.r, val.g, val.b, byte.MaxValue)));
}
}
imageAsTexture.Apply();
}
}
Transform val2 = ((CardDrawPiles3D)__instance).SidePile.cardbackPrefab.transform.Find("BendableCard");
GameObject gameObject = ((Component)val2.Find("Mesh")).gameObject;
SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)gameObject.GetComponentByName("SkinnedMeshRenderer");
((Renderer)val3).materials[1].mainTexture = (Texture)(object)imageAsTexture;
}
}
[HarmonyPatch(typeof(AscensionStartScreen), "ContinueGameSequence")]
public class AscensionStartScreen_ContinueGameSequence_Patch
{
public static void Postfix()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Invalid comparison between Unknown and I4
if (alreadyInitialized)
{
return;
}
if (Chainloader.PluginInfos.ContainsKey("zorro.inscryption.infiniscryption.sidedecks"))
{
foreach (CardInfo item in CardManager.AllCardsCopy)
{
if (CardExtensions.HasCardMetaCategory(item, GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.sidedecks", "SideDeck")) && (!CardExtensions.GetExtendedPropertyAsBool(item, "CSDIsSideDeck").HasValue || !CardExtensions.GetExtendedPropertyAsBool(item, "CSDIsSideDeck").Value) && (int)item.temple == 0)
{
CardExtensions.SetExtendedProperty(item, "CSDIsSideDeck", (object)"true");
CardExtensions.SetExtendedProperty(item, "CSDSideDeckType", (object)"Basic");
if (CardExtensions.GetExtendedPropertyAsInt(item, "SideDeckValue").HasValue)
{
CardExtensions.SetExtendedProperty(item, "CSDChallengePoints", (object)(-CardExtensions.GetExtendedPropertyAsInt(item, "SideDeckValue")));
}
}
}
}
foreach (CardInfo item2 in CardManager.AllCardsCopy)
{
if (!CardExtensions.GetExtendedPropertyAsBool(item2, "CSDIsSideDeck").HasValue || !CardExtensions.GetExtendedPropertyAsBool(item2, "CSDIsSideDeck").Value)
{
continue;
}
SideDeckInfo sideDeckInfo;
if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "basic")
{
sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Basic", new List<string>(), new List<string>(), ((Object)item2).name);
}
else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "setcount")
{
sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "SetCount", new List<string>(), new List<string>(), ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards").GetValueOrDefault(10));
}
else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "configurable")
{
List<string> list = new List<string>();
for (int i = 0; i < CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumOptions").GetValueOrDefault(); i++)
{
list.Add(CardExtensions.GetExtendedProperty(item2, $"CSDOption{i + 1}"));
}
sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Configurable", new List<string>(), list, ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards").GetValueOrDefault(10));
}
else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "advanced")
{
List<string> list2 = new List<string>();
for (int j = 0; j < CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumOptions").GetValueOrDefault(); j++)
{
list2.Add(CardExtensions.GetExtendedProperty(item2, $"CSDOption{j + 1}"));
}
List<string> list3 = new List<string>();
for (int k = 0; k < CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards").GetValueOrDefault(1); k++)
{
list3.Add(CardExtensions.GetExtendedProperty(item2, $"CSDCard{k + 1}"));
}
sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Advanced", list3, list2, ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards").GetValueOrDefault(10));
}
else
{
sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Basic", new List<string>(), new List<string>(), ((Object)item2).name);
}
sideDeckInfo.cardBack = CardExtensions.GetExtendedProperty(item2, "CSDCardBack");
sideDeckInfo.isAqua = CardExtensions.GetExtendedPropertyAsBool(item2, "CSDIsAqua").HasValue && CardExtensions.GetExtendedPropertyAsBool(item2, "CSDIsAqua").Value;
sideDeckInfo.challengePoints = (CardExtensions.GetExtendedPropertyAsInt(item2, "CSDChallengePoints").HasValue ? CardExtensions.GetExtendedPropertyAsInt(item2, "CSDChallengePoints").Value : 0);
sideDeckInfo.canEditDuringRun = CardExtensions.GetExtendedPropertyAsBool(item2, "CSDCanEditDuringRun").HasValue && CardExtensions.GetExtendedPropertyAsBool(item2, "CSDCanEditDuringRun").Value;
CardExtensions.SetExtendedProperty(item2, "CSDAssociatedSideDeck", (object)sideDeckInfo.internalName);
}
alreadyInitialized = true;
}
}
[HarmonyPatch(typeof(DeckReviewSequencer), "OnEnterDeckView")]
public class DeckReviewSequencer_OnEnterDeckView_Patch
{
public static bool Prefix(DeckReviewSequencer __instance)
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Expected O, but got Unknown
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Expected O, but got Unknown
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Expected O, but got Unknown
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
if (CurrentSideDeck.canEditDuringRun && (CurrentSideDeck.csdType == "Configurable" || CurrentSideDeck.csdType == "Advanced"))
{
if ((Object)(object)mainDeckPile == (Object)null || (Object)(object)sideDeckPile == (Object)null || (Object)(object)mainDeckInteractable == (Object)null || (Object)(object)sideDeckInteractable == (Object)null)
{
mainDeckObject = new GameObject("MainDeck");
GameObject val = new GameObject("SelectionInteractable");
val.transform.parent = mainDeckObject.transform;
Component obj = mainDeckObject.AddComponent(typeof(CardPile));
mainDeckPile = (CardPile)(object)((obj is CardPile) ? obj : null);
Component obj2 = val.AddComponent(typeof(GenericMainInputInteractable));
mainDeckInteractable = (GenericMainInputInteractable)(object)((obj2 is GenericMainInputInteractable) ? obj2 : null);
sideDeckObject = new GameObject("SideDeck");
GameObject val2 = new GameObject("SelectionInteractable");
val2.transform.parent = sideDeckObject.transform;
Component obj3 = sideDeckObject.AddComponent(typeof(CardPile));
sideDeckPile = (CardPile)(object)((obj3 is CardPile) ? obj3 : null);
Component obj4 = val2.AddComponent(typeof(GenericMainInputInteractable));
sideDeckInteractable = (GenericMainInputInteractable)(object)((obj4 is GenericMainInputInteractable) ? obj4 : null);
CardPile component = GameObject.Find("PlayerDeckPile").GetComponent<CardPile>();
CardPile component2 = GameObject.Find("SquirrelPile").GetComponent<CardPile>();
mainDeckPile.CardBackPrefab = component.cardbackPrefab;
sideDeckPile.CardBackPrefab = component2.cardbackPrefab;
mainDeckPile.tapSoundEvent = component.tapSoundEvent;
sideDeckPile.tapSoundEvent = component2.tapSoundEvent;
mainDeckPile.shadow = component.shadow;
sideDeckPile.shadow = component2.shadow;
((MainInputInteractable)mainDeckInteractable).CursorSelectStarted = (Action<MainInputInteractable>)Delegate.Combine(((MainInputInteractable)mainDeckInteractable).CursorSelectStarted, (Action<MainInputInteractable>)delegate
{
OnMainDeckSelected(__instance);
});
((MainInputInteractable)sideDeckInteractable).CursorSelectStarted = (Action<MainInputInteractable>)Delegate.Combine(((MainInputInteractable)sideDeckInteractable).CursorSelectStarted, (Action<MainInputInteractable>)delegate
{
OnSideDeckSelected(__instance);
});
mainDeckInteractable.cursorType = (CursorType)4;
sideDeckInteractable.cursorType = (CursorType)4;
mainDeckInteractable.is2D = false;
sideDeckInteractable.is2D = false;
((MainInputInteractable)mainDeckInteractable).ParentInteractables.Add((MainInputInteractable)(object)mainDeckPile);
((MainInputInteractable)sideDeckInteractable).ParentInteractables.Add((MainInputInteractable)(object)sideDeckPile);
((InteractableBase)mainDeckInteractable).coll = (Collider)(object)val.AddComponent<BoxCollider>();
((InteractableBase)sideDeckInteractable).coll = (Collider)(object)val2.AddComponent<BoxCollider>();
Collider coll = ((InteractableBase)mainDeckInteractable).coll;
((BoxCollider)((coll is BoxCollider) ? coll : null)).center = new Vector3(0f, 0.5f, 0f);
Collider coll2 = ((InteractableBase)sideDeckInteractable).coll;
((BoxCollider)((coll2 is BoxCollider) ? coll2 : null)).center = new Vector3(0f, 0.5f, 0f);
Collider coll3 = ((InteractableBase)mainDeckInteractable).coll;
((BoxCollider)((coll3 is BoxCollider) ? coll3 : null)).extents = new Vector3(0.7f, 0.5f, 1f);
Collider coll4 = ((InteractableBase)sideDeckInteractable).coll;
((BoxCollider)((coll4 is BoxCollider) ? coll4 : null)).extents = new Vector3(0.7f, 0.5f, 1f);
Collider coll5 = ((InteractableBase)mainDeckInteractable).coll;
((BoxCollider)((coll5 is BoxCollider) ? coll5 : null)).size = new Vector3(1.4f, 1f, 2f);
Collider coll6 = ((InteractableBase)sideDeckInteractable).coll;
((BoxCollider)((coll6 is BoxCollider) ? coll6 : null)).size = new Vector3(1.4f, 1f, 2f);
((InteractableBase)mainDeckInteractable).SetEnabled(false);
((InteractableBase)sideDeckInteractable).SetEnabled(false);
}
deckReviewState = "ChoosePile";
entering = true;
((MonoBehaviour)__instance).StartCoroutine(SpawnDeckPiles(__instance));
return false;
}
deckReviewState = "";
return true;
}
}
[HarmonyPatch(typeof(DeckReviewSequencer), "OnExitDeckView")]
public class DeckReviewSequencer_OnExitDeckView_Patch
{
public static bool Prefix(DeckReviewSequencer __instance)
{
if (CurrentSideDeck.canEditDuringRun && (CurrentSideDeck.csdType == "Configurable" || CurrentSideDeck.csdType == "Advanced"))
{
((InteractableBase)mainDeckInteractable).SetEnabled(false);
((InteractableBase)sideDeckInteractable).SetEnabled(false);
if (deckReviewState == "ChoosePile" && !exiting)
{
exiting = true;
((MonoBehaviour)__instance).StartCoroutine(CleanUpDeckPiles(selectedMainPile: true, selectedSidePile: true, __instance));
}
return false;
}
return true;
}
}
[AscensionScreenSort(/*Could not decode attribute arguments.*/)]
public class SideDeckSelectionScreen : AscensionRunSetupScreenBase
{
private int numCardsToShow = 7;
private List<SideDeckInfo> validSideDecks = new List<SideDeckInfo>();
private GameObject selectedBorder;
public static SideDeckSelectionScreen Instance;
public int scrollIndex = 0;
public override string headerText => "Select Side Deck";
public override bool showCardDisplayer => true;
public override bool showCardPanel => true;
public override void InitializeScreen(GameObject partialScreen)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Resources.Load<GameObject>("prefabs/gbcui/pixelselectionborder");
GameObject val2 = Object.Instantiate<GameObject>(val, ((Component)base.cards[0]).gameObject.transform);
val2.GetComponent<SpriteRenderer>().color = GameColors.Instance.brightNearWhite;
val2.AddComponent<PixelSnapElement>();
selectedBorder = val2;
Instance = this;
}
public override void CardClicked(PixelSelectableCard card)
{
if ((Object)(object)card != (Object)null && (Object)(object)((Card)card).Info != (Object)null)
{
CurrentSideDeck = SideDeckManager.GetSideDeckByName(CardExtensions.GetExtendedProperty(((Card)card).Info, "CSDAssociatedSideDeck"));
ShowPage();
}
}
public override void OnEnable()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Invalid comparison between Unknown and I4
((AscensionRunSetupScreenBase)this).OnEnable();
if (!alreadyInitialized)
{
if (Chainloader.PluginInfos.ContainsKey("zorro.inscryption.infiniscryption.sidedecks"))
{
foreach (CardInfo item in CardManager.AllCardsCopy)
{
if (CardExtensions.HasCardMetaCategory(item, GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.sidedecks", "SideDeck")) && (!CardExtensions.GetExtendedPropertyAsBool(item, "CSDIsSideDeck").HasValue || !CardExtensions.GetExtendedPropertyAsBool(item, "CSDIsSideDeck").Value) && (int)item.temple == 0)
{
CardExtensions.SetExtendedProperty(item, "CSDIsSideDeck", (object)"true");
CardExtensions.SetExtendedProperty(item, "CSDSideDeckType", (object)"Basic");
if (CardExtensions.GetExtendedPropertyAsInt(item, "SideDeckValue").HasValue)
{
CardExtensions.SetExtendedProperty(item, "CSDChallengePoints", (object)(-CardExtensions.GetExtendedPropertyAsInt(item, "SideDeckValue")));
}
}
}
}
foreach (CardInfo item2 in CardManager.AllCardsCopy)
{
if (!CardExtensions.GetExtendedPropertyAsBool(item2, "CSDIsSideDeck").HasValue || !CardExtensions.GetExtendedPropertyAsBool(item2, "CSDIsSideDeck").Value)
{
continue;
}
SideDeckInfo sideDeckInfo;
if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "basic")
{
sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Basic", new List<string>(), new List<string>(), ((Object)item2).name);
}
else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "setcount")
{
sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "SetCount", new List<string>(), new List<string>(), ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards").GetValueOrDefault(10));
}
else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "configurable")
{
List<string> list = new List<string>();
for (int i = 0; i < CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumOptions").GetValueOrDefault(); i++)
{
list.Add(CardExtensions.GetExtendedProperty(item2, $"CSDOption{i + 1}"));
}
sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Configurable", new List<string>(), list, ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards").GetValueOrDefault(10));
}
else if (CardExtensions.GetExtendedProperty(item2, "CSDSideDeckType").ToLower() == "advanced")
{
List<string> list2 = new List<string>();
for (int j = 0; j < CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumOptions").GetValueOrDefault(); j++)
{
list2.Add(CardExtensions.GetExtendedProperty(item2, $"CSDOption{j + 1}"));
}
List<string> list3 = new List<string>();
for (int k = 0; k < CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards").GetValueOrDefault(1); k++)
{
list3.Add(CardExtensions.GetExtendedProperty(item2, $"CSDCard{k + 1}"));
}
sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Advanced", list3, list2, ((Object)item2).name, CardExtensions.GetExtendedPropertyAsInt(item2, "CSDNumCards").GetValueOrDefault(10));
}
else
{
sideDeckInfo = SideDeckManager.New(CardExtensions.GetModPrefix(item2), ((Object)item2).name, "Basic", new List<string>(), new List<string>(), ((Object)item2).name);
}
sideDeckInfo.cardBack = CardExtensions.GetExtendedProperty(item2, "CSDCardBack");
sideDeckInfo.isAqua = CardExtensions.GetExtendedPropertyAsBool(item2, "CSDIsAqua").HasValue && CardExtensions.GetExtendedPropertyAsBool(item2, "CSDIsAqua").Value;
sideDeckInfo.challengePoints = (CardExtensions.GetExtendedPropertyAsInt(item2, "CSDChallengePoints").HasValue ? CardExtensions.GetExtendedPropertyAsInt(item2, "CSDChallengePoints").Value : 0);
sideDeckInfo.canEditDuringRun = CardExtensions.GetExtendedPropertyAsBool(item2, "CSDCanEditDuringRun").HasValue && CardExtensions.GetExtendedPropertyAsBool(item2, "CSDCanEditDuringRun").Value;
CardExtensions.SetExtendedProperty(item2, "CSDAssociatedSideDeck", (object)sideDeckInfo.internalName);
}
alreadyInitialized = true;
}
validSideDecks.Clear();
if (!AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)12))
{
validSideDecks.Add(SideDeckManager.GetSideDeckByName(CardExtensions.GetExtendedProperty(CardLoader.GetCardByName("Squirrel"), "CSDAssociatedSideDeck")));
validSideDecks.Add(SideDeckManager.GetSideDeckByName(CardExtensions.GetExtendedProperty(CardLoader.GetCardByName("Bee"), "CSDAssociatedSideDeck")));
}
if (AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)12) || plugin.showAquasquirrelsWhenChallengeDisabled.Value)
{
validSideDecks.Add(SideDeckManager.GetSideDeckByName(CardExtensions.GetExtendedProperty(CardLoader.GetCardByName("AquaSquirrel"), "CSDAssociatedSideDeck")));
}
foreach (SideDeckInfo sideDecks in SideDeckManager.sideDecksList)
{
if (!validSideDecks.Contains(sideDecks))
{
if (!AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)12) && !sideDecks.isAqua)
{
validSideDecks.Add(sideDecks);
}
if ((AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)12) || plugin.showAquasquirrelsWhenChallengeDisabled.Value) && sideDecks.isAqua)
{
validSideDecks.Add(sideDecks);
}
}
}
if (AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)12) && plugin.generateAquaVersions.Value)
{
foreach (SideDeckInfo sideDecks2 in SideDeckManager.sideDecksList)
{
if (validSideDecks.Contains(sideDecks2))
{
continue;
}
bool flag = false;
if ((Object)(object)CardLoader.GetCardByName(sideDecks2.defaultCard) != (Object)null && !CardLoader.GetCardByName(sideDecks2.defaultCard).HasAbility((Ability)13))
{
flag = true;
}
if (!flag)
{
foreach (string card in sideDecks2.cards)
{
if ((Object)(object)CardLoader.GetCardByName(card) != (Object)null && !CardLoader.GetCardByName(card).HasAbility((Ability)13))
{
flag = true;
break;
}
}
}
if (!flag)
{
foreach (string card2 in sideDecks2.cards)
{
if ((Object)(object)CardLoader.GetCardByName(card2) != (Object)null && !CardLoader.GetCardByName(card2).HasAbility((Ability)13))
{
flag = true;
break;
}
}
}
if (flag)
{
validSideDecks.Add(sideDecks2);
}
}
}
CurrentSideDeck = validSideDecks[0];
scrollIndex = 0;
ShowPage();
((AscensionRunSetupScreenBase)this).CardClicked(base.cards[0]);
}
public void ShowPage()
{
List<CardInfo> list = new List<CardInfo>();
foreach (SideDeckInfo validSideDeck in validSideDecks)
{
CardInfo cardByName = CardLoader.GetCardByName(validSideDeck.defaultCard);
if (AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)12) && plugin.generateAquaVersions.Value && !validSideDeck.isAqua)
{
string text = cardByName.DisplayedNameLocalized;
if (char.IsUpper(text[0]))
{
text = ((text.Length <= 1) ? text.ToLower() : (char.ToLower(text[0]) + text.Substring(1)));
}
CardExtensions.SetDisplayedName(cardByName, "Aqua" + text);
if (!cardByName.HasAbility((Ability)13))
{
CardExtensions.AddAbilities(cardByName, (Ability[])(object)new Ability[1] { (Ability)13 });
}
}
list.Add(cardByName);
}
((AscensionRunSetupScreenBase)this).ShowCards(list.GetRange(scrollIndex, Math.Min(list.Count - scrollIndex, numCardsToShow)));
selectedBorder.SetActive(false);
foreach (PixelSelectableCard card in base.cards)
{
if ((Object)(object)card != (Object)null && ((Behaviour)card).enabled && (Object)(object)((Card)card).Info != (Object)null && CardExtensions.GetExtendedProperty(((Card)card).Info, "CSDAssociatedSideDeck") != null && CardExtensions.GetExtendedProperty(((Card)card).Info, "CSDAssociatedSideDeck") == CurrentSideDeck.internalName)
{
selectedBorder.transform.SetParent(((Component)card).transform.Find("Base/PixelSnap"), false);
selectedBorder.SetActive(true);
break;
}
}
string text2 = "<color=#eef4c6>0</color> Challenge Points";
if (CurrentSideDeck.challengePoints != 0)
{
text2 = ((CurrentSideDeck.challengePoints <= 0) ? ("<color=#eef4c6>" + CurrentSideDeck.challengePoints + "</color> Challenge Points") : ("<color=#eef4c6>+" + CurrentSideDeck.challengePoints + "</color> Challenge Points"));
}
SequentialPixelTextLines component = GameObjectExtensions.FindChild(((Component)this).gameObject, "Header").GetComponent<SequentialPixelTextLines>();
component.ShowText(0.1f, new string[2]
{
"CURRENT SIDE DECK: " + text2,
"Total Challenge Points: <color=#eef4c6>" + AscensionSaveData.Data.GetActiveChallengePoints() + "</color>"
}, true);
}
public override void LeftButtonClicked(MainInputInteractable button)
{
if (scrollIndex > 0)
{
scrollIndex = Math.Max(0, scrollIndex - numCardsToShow);
ShowPage();
}
}
public override void RightButtonClicked(MainInputInteractable button)
{
if (scrollIndex < validSideDecks.Count - numCardsToShow)
{
scrollIndex += numCardsToShow;
ShowPage();
}
}
}
[AscensionScreenSort(/*Could not decode attribute arguments.*/)]
public class SideDeckConfigurationScreen : AscensionRunSetupScreenBase
{
private int numCardsToShow = 5;
public static SideDeckConfigurationScreen Instance;
public bool isAdvanced = false;
public List<CardInfo> confCards;
public int scrollIndex = 0;
public override string headerText => "Configure Side Deck";
public override bool showCardDisplayer => true;
public override bool showCardPanel => true;
public override void InitializeScreen(GameObject partialScreen)
{
Instance = this;
}
public override void CardClicked(PixelSelectableCard card)
{
if (!((Object)(object)card != (Object)null) || !((Object)(object)((Card)card).Info != (Object)null))
{
return;
}
int index = confCards.IndexOf(((Card)card).Info);
string extendedProperty = CardExtensions.GetExtendedProperty(((Card)card).Info, "ConfIndex");
confCards.RemoveAt(index);
for (int i = 0; i <= CurrentSideDeck.options.Count; i++)
{
if (((Object)((Card)card).Info).name == CurrentSideDeck.options[i])
{
if (i == CurrentSideDeck.options.Count - 1)
{
((Card)card).SetInfo(CardExtensions.SetExtendedProperty(CardLoader.GetCardByName(CurrentSideDeck.options[0]), "ConfIndex", (object)extendedProperty));
}
else
{
((Card)card).SetInfo(CardExtensions.SetExtendedProperty(CardLoader.GetCardByName(CurrentSideDeck.options[i + 1]), "ConfIndex", (object)extendedProperty));
}
break;
}
}
confCards.Insert(index, ((Card)card).Info);
int num = 0;
foreach (CardInfo confCard in confCards)
{
SetConfCard(((Object)confCard).name, num);
num++;
}
ShowPage();
}
public override void OnEnable()
{
int num = 0;
if (CurrentSideDeck.csdType == "Advanced")
{
isAdvanced = true;
for (int i = 1; i <= CurrentSideDeck.cards.Count; i++)
{
if (!Utility.IsNullOrWhiteSpace(CurrentSideDeck.cards[i - 1]) && (CurrentSideDeck.cards[i - 1] == "conf" || CurrentSideDeck.cards[i - 1] == "c"))
{
num++;
}
}
}
else if (CurrentSideDeck.options.Count > 0)
{
num = CurrentSideDeck.numCards;
}
if (CurrentSideDeck.options.Count == 0 || num == 0)
{
((MainInputInteractable)base.continueButton).CursorSelectStart();
((MainInputInteractable)base.continueButton).CursorSelectEnd();
return;
}
((AscensionRunSetupScreenBase)this).OnEnable();
confCards = new List<CardInfo>();
if (isAdvanced)
{
for (int j = 1; j <= num; j++)
{
confCards.Add(CardLoader.GetCardByName(CurrentSideDeck.options[0]));
}
}
else
{
for (int k = 1; k <= CurrentSideDeck.numCards; k++)
{
confCards.Add(CardLoader.GetCardByName(CurrentSideDeck.options[0]));
}
}
int num2 = 0;
foreach (CardInfo confCard in confCards)
{
SetConfCard(((Object)confCard).name, num2);
num2++;
}
ShowPage();
}
public void ShowPage()
{
((AscensionRunSetupScreenBase)this).ShowCards(confCards.GetRange(scrollIndex, Math.Min(confCards.Count - scrollIndex, numCardsToShow)));
string text = "<color=#eef4c6>0</color> Challenge Points";
if (CurrentSideDeck.challengePoints != 0)
{
text = ((CurrentSideDeck.challengePoints <= 0) ? ("<color=#eef4c6>" + CurrentSideDeck.challengePoints + "</color> Challenge Points") : ("<color=#eef4c6>+" + CurrentSideDeck.challengePoints + "</color> Challenge Points"));
}
SequentialPixelTextLines component = GameObjectExtensions.FindChild(((Component)this).gameObject, "Header").GetComponent<SequentialPixelTextLines>();
component.ShowText(0.1f, new string[2]
{
"CURRENT SIDE DECK: " + text,
"Total Challenge Points: <color=#eef4c6>" + AscensionSaveData.Data.GetActiveChallengePoints() + "</color>"
}, true);
}
public override void LeftButtonClicked(MainInputInteractable button)
{
if (scrollIndex > 0)
{
scrollIndex = Math.Max(0, scrollIndex - numCardsToShow);
ShowPage();
}
}
public override void RightButtonClicked(MainInputInteractable button)
{
if (scrollIndex < confCards.Count - numCardsToShow)
{
scrollIndex += numCardsToShow;
ShowPage();
}
}
}
private Harmony harmony = new Harmony("tvflabs.inscryption.CustomSideDeck");
private const string PluginGuid = "tvflabs.inscryption.CustomSideDeck";
private const string PluginName = "CustomSideDeck";
private const string PluginVersion = "2.3.0";
private const string PluginPrefix = "CustomSideDeck";
private static Plugin plugin;
private static bool alreadyInitialized;
private ConfigEntry<bool> generateCardBacks;
private ConfigEntry<bool> generateAquaVersions;
private ConfigEntry<bool> showAquasquirrelsWhenChallengeDisabled;
private static string deckReviewState = "";
private static CardPile mainDeckPile = null;
private static CardPile sideDeckPile = null;
private static GenericMainInputInteractable mainDeckInteractable = null;
private static GenericMainInputInteractable sideDeckInteractable = null;
private static GameObject mainDeckObject = null;
private static GameObject sideDeckObject = null;
private static Vector3 defaultMainPilePos = new Vector3(-1.09f, 5.0196f, 1.36f);
private static Vector3 defaultSidePilePos = new Vector3(1.71f, 5.0199f, 1.36f);
private static bool entering = false;
private static bool exiting = false;
private static List<CardInfo> sideDeckCards = new List<CardInfo>();
public static List<CardInfo> SideDeckCards
{
get
{
List<CardInfo> list = new List<CardInfo>();
if (CurrentSideDeck.csdType != "Advanced")
{
for (int i = 0; i < CurrentSideDeck.numCards; i++)
{
if (CurrentSideDeck.options.Count > 0)
{
list.Add(CardLoader.GetCardByName(GetConfCards()[i]));
}
else
{
list.Add(CardLoader.GetCardByName(CurrentSideDeck.defaultCard));
}
}
}
else
{
int num = 0;
foreach (string card in CurrentSideDeck.cards)
{
if (card == "conf")
{
list.Add(CardLoader.GetCardByName(GetConfCards()[num]));
num++;
}
else if (card == "def" || card == "self")
{
CardLoader.GetCardByName(CurrentSideDeck.defaultCard);
}
else
{
list.Add(CardLoader.GetCardByName(card));
}
}
}
if (AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)12) && !CurrentSideDeck.isAqua)
{
foreach (CardInfo item in list)
{
string text = item.DisplayedNameLocalized;
if (char.IsUpper(text[0]))
{
text = ((text.Length <= 1) ? text.ToLower() : (char.ToLower(text[0]) + text.Substring(1)));
}
CardExtensions.SetDisplayedName(item, "Aqua" + text);
if (!item.HasAbility((Ability)13))
{
CardExtensions.AddAbilities(item, (Ability[])(object)new Ability[1] { (Ability)13 });
}
}
}
return list;
}
}
public static SideDeckInfo CurrentSideDeck
{
get
{
string value = ModdedSaveManager.SaveData.GetValue("tvflabs.inscryption.CustomSideDeck", "CurrentSideDeck");
if (string.IsNullOrEmpty(value))
{
return SideDeckManager.GetSideDeckByName("_Squirrel");
}
return SideDeckManager.GetSideDeckByName(value);
}
set
{
ModdedSaveManager.SaveData.SetValue("tvflabs.inscryption.CustomSideDeck", "CurrentSideDeck", (object)value.internalName);
}
}
private void Awake()
{
plugin = this;
generateCardBacks = ((BaseUnityPlugin)this).Config.Bind<bool>("CSDConfig", "GenerateDefaultCardBacks", false, "How the mod should handle side deck card backs for side decks that don't add their own custom card back. If enabled, automatically generates a unique card back based on the side deck's main card's portrait. Otherwise, the default squirrel back will be used.");
generateAquaVersions = ((BaseUnityPlugin)this).Config.Bind<bool>("CSDConfig", "GenerateAquaVersions", false, "Whether to automatically add an Aqua version of all custom side decks. Buggy, not recommended.");
showAquasquirrelsWhenChallengeDisabled = ((BaseUnityPlugin)this).Config.Bind<bool>("CSDConfig", "ShowAquaSideDecksWhenSquirrelFishChallengeDisabled", false, "Whether or not Aquasquirrels and custom side decks marked as `CSDIsAqua` should be shown as options even when the Squirrel Fish challenge isn't on.");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded CustomSideDeck!");
harmony.PatchAll();
AscensionScreenManager.RegisterScreen<SideDeckSelectionScreen>();
AscensionScreenManager.RegisterScreen<SideDeckConfigurationScreen>();
RegisterSideDecks();
}
private void RegisterSideDecks()
{
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("Squirrel"), "CSDIsSideDeck", (object)"true");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("Squirrel"), "CSDSideDeckType", (object)"Basic");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("Squirrel"), "CSDCardBack", (object)"squirrel");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("Squirrel"), "CSDChallengePoints", (object)"0");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("Bee"), "CSDIsSideDeck", (object)"true");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("Bee"), "CSDSideDeckType", (object)"Basic");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("Bee"), "CSDCardBack", (object)"bee");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("Bee"), "CSDChallengePoints", (object)"-20");
CardExtensions.SetPixelPortrait(CardLoader.GetCardByName("Bee"), TextureHelper.GetImageAsSprite("pixelportrait_bee.png", (SpriteType)1, (FilterMode)0));
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("AquaSquirrel"), "CSDIsSideDeck", (object)"true");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("AquaSquirrel"), "CSDSideDeckType", (object)"Basic");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("AquaSquirrel"), "CSDCardBack", (object)"aquasquirrel");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("AquaSquirrel"), "CSDIsAqua", (object)"true");
CardExtensions.SetExtendedProperty(CardLoader.GetCardByName("AquaSquirrel"), "CSDChallengePoints", (object)"0");
CardExtensions.SetPixelPortrait(CardLoader.GetCardByName("AquaSquirrel"), TextureHelper.GetImageAsSprite("pixelportrait_aquasquirrel.png", (SpriteType)1, (FilterMode)0));
}
public static List<string> GetConfCards()
{
List<string> list = new List<string>();
if (CurrentSideDeck.csdType != "Advanced")
{
if (CurrentSideDeck.options.Count > 0)
{
for (int i = 0; i < CurrentSideDeck.numCards; i++)
{
list.Add(ModdedSaveManager.SaveData.GetValue("tvflabs.inscryption.CustomSideDeck", $"ConfCard{i}"));
}
}
}
else
{
int num = 0;
foreach (string card in CurrentSideDeck.cards)
{
if (card == "conf")
{
list.Add(ModdedSaveManager.SaveData.GetValue("tvflabs.inscryption.CustomSideDeck", $"ConfCard{num}"));
num++;
}
}
}
return list;
}
public static void SetConfCard(string card, int cardNum)
{
ModdedSaveManager.SaveData.SetValue("tvflabs.inscryption.CustomSideDeck", $"ConfCard{cardNum}", (object)card);
}
private static void OnMainDeckSelected(DeckReviewSequencer deckReviewSequencer)
{
deckReviewState = "MainDeck";
((InteractableBase)mainDeckInteractable).SetEnabled(false);
((InteractableBase)sideDeckInteractable).SetEnabled(false);
((MonoBehaviour)deckReviewSequencer).StartCoroutine(CleanUpDeckPiles(selectedMainPile: true, selectedSidePile: false, deckReviewSequencer));
Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
CustomCoroutine.WaitThenExecute(0.2f, (Action)delegate
{
deckReviewSequencer.ArrayDeck(((CardCollectionInfo)SaveManager.SaveFile.CurrentDeck).Cards, (Action<SelectableCard>)null, false);
}, false);
}
private static void OnSideDeckSelected(DeckReviewSequencer deckReviewSequencer)
{
deckReviewState = "EditSideDeck";
((MonoBehaviour)deckReviewSequencer).StartCoroutine(CleanUpDeckPiles(selectedMainPile: false, selectedSidePile: true, deckReviewSequencer));
((InteractableBase)mainDeckInteractable).SetEnabled(false);
((InteractableBase)sideDeckInteractable).SetEnabled(false);
Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
sideDeckCards.Clear();
foreach (string confCard in GetConfCards())
{
sideDeckCards.Add(CardLoader.GetCardByName(confCard));
}
CustomCoroutine.WaitThenExecute(0.2f, (Action)delegate
{
deckReviewSequencer.ArrayDeck(sideDeckCards, (Action<SelectableCard>)OnSideDeckCardSelected, false);
}, false);
}
private static void OnSideDeckCardSelected(SelectableCard card)
{
string name = ((Object)((Card)card).Info).name;
if ((Object)(object)card != (Object)null && (Object)(object)((Card)card).Info != (Object)null)
{
int index = sideDeckCards.IndexOf(((Card)card).Info);
string extendedProperty = CardExtensions.GetExtendedProperty(((Card)card).Info, "ConfIndex");
sideDeckCards.RemoveAt(index);
for (int i = 0; i <= CurrentSideDeck.options.Count; i++)
{
if (((Object)((Card)card).Info).name == CurrentSideDeck.options[i])
{
if (i == CurrentSideDeck.options.Count - 1)
{
((Card)card).SetInfo(CardExtensions.SetExtendedProperty(CardLoader.GetCardByName(CurrentSideDeck.options[0]), "ConfIndex", (object)extendedProperty));
}
else
{
((Card)card).SetInfo(CardExtensions.SetExtendedProperty(CardLoader.GetCardByName(CurrentSideDeck.options[i + 1]), "ConfIndex", (object)extendedProperty));
}
break;
}
}
sideDeckCards.Insert(index, ((Card)card).Info);
int num = 0;
foreach (CardInfo sideDeckCard in sideDeckCards)
{
SetConfCard(((Object)sideDeckCard).name, num);
num++;
}
((Card)card).SetInfo(sideDeckCards[index]);
}
((Card)card).Anim.LightNegationEffect();
}
private static IEnumerator SpawnDeckPiles(DeckReviewSequencer deckReviewSequencer)
{
Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
((Component)mainDeckPile).transform.position = defaultMainPilePos;
((Component)sideDeckPile).transform.position = defaultSidePilePos;
((MonoBehaviour)deckReviewSequencer).StartCoroutine(mainDeckPile.SpawnCards(((CardCollectionInfo)SaveManager.SaveFile.CurrentDeck).Cards.Count, 0.5f));
((MonoBehaviour)deckReviewSequencer).StartCoroutine(sideDeckPile.SpawnCards(GetNumConfCards(), 0.5f));
yield return (object)new WaitUntil((Func<bool>)(() => !mainDeckPile.DoingCardOperation && !sideDeckPile.DoingCardOperation));
yield return (object)new WaitForSeconds(0.5f);
Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
((InteractableBase)mainDeckInteractable).SetEnabled(true);
((InteractableBase)sideDeckInteractable).SetEnabled(true);
entering = false;
}
private static IEnumerator CleanUpDeckPiles(bool selectedMainPile, bool selectedSidePile, DeckReviewSequencer deckReviewSequencer)
{
Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)1;
Tween.Position(((Component)mainDeckPile).transform, defaultMainPilePos + Vector3.back * 3.5f, selectedMainPile ? 0.15f : 0.2f, selectedMainPile ? 0.15f : 0f, Tween.EaseLinear, (LoopType)0, (Action)null, (Action)delegate
{
if (!selectedMainPile)
{
mainDeckPile.DestroyCardsImmediate();
}
}, true);
Tween.Position(((Component)sideDeckPile).transform, defaultSidePilePos + Vector3.back * 3.5f, selectedSidePile ? 0.15f : 0.2f, selectedSidePile ? 0.15f : 0f, Tween.EaseLinear, (LoopType)0, (Action)null, (Action)delegate
{
if (!selectedSidePile)
{
sideDeckPile.DestroyCardsImmediate();
}
}, true);
if (selectedMainPile)
{
((MonoBehaviour)deckReviewSequencer).StartCoroutine(mainDeckPile.DestroyCards(0.2f));
}
if (selectedSidePile)
{
((MonoBehaviour)deckReviewSequencer).StartCoroutine(sideDeckPile.DestroyCards(0.2f));
}
yield return (object)new WaitUntil((Func<bool>)(() => !mainDeckPile.DoingCardOperation && !sideDeckPile.DoingCardOperation));
Singleton<ViewManager>.Instance.Controller.LockState = (ViewLockState)0;
exiting = false;
}
private static int GetNumConfCards()
{
int num = 0;
bool flag = false;
if (CurrentSideDeck.csdType == "Advanced")
{
flag = true;
for (int i = 1; i <= CurrentSideDeck.cards.Count; i++)
{
if (!Utility.IsNullOrWhiteSpace(CurrentSideDeck.cards[i - 1]) && (CurrentSideDeck.cards[i - 1] == "conf" || CurrentSideDeck.cards[i - 1] == "c"))
{
num++;
}
}
}
else if (CurrentSideDeck.options.Count > 0)
{
num = CurrentSideDeck.numCards;
}
return num;
}
}
internal class SideDeckIcon : MainInputInteractable
{
public SideDeckInfo Info;
private Plugin.SideDeckSelectionScreen ScreenParent => ((Component)this).GetComponentInParent<Plugin.SideDeckSelectionScreen>();
public override bool CollisionIs2D => true;
public override void OnCursorEnter()
{
((AscensionRunSetupScreenBase)ScreenParent).DisplayCardInfo((CardInfo)null, Localization.Translate(Info.displayName), Info.description + $"\nContains {Info.cards.Count} cards", false);
}
public override void OnCursorExit()
{
((AscensionRunSetupScreenBase)ScreenParent).ClearMessage();
}
}
public static class SideDeckManager
{
public static List<SideDeckInfo> sideDecksList = new List<SideDeckInfo>();
public static SideDeckInfo New(string modPrefix, string name, string csdType, List<string> cards, List<string> options, string defaultCard, int numCards = 10, string cardBack = null, string pixelCardBack = null, bool isAqua = false, int challengePoints = 0, bool canEditDuringRun = false)
{
SideDeckInfo sideDeckInfo = new SideDeckInfo();
sideDeckInfo.internalName = modPrefix + "_" + name;
sideDeckInfo.numCards = numCards;
sideDeckInfo.defaultCard = defaultCard;
sideDeckInfo.cards = new List<string>();
sideDeckInfo.options = new List<string>();
sideDeckInfo.csdType = csdType;
sideDeckInfo.isAqua = isAqua;
sideDeckInfo.challengePoints = challengePoints;
sideDeckInfo.canEditDuringRun = canEditDuringRun;
foreach (string card in cards)
{
sideDeckInfo.cards.Add(card);
}
foreach (string option in options)
{
sideDeckInfo.options.Add(option);
}
sideDecksList.Add(sideDeckInfo);
return sideDeckInfo;
}
public static SideDeckInfo GetSideDeckByName(string name)
{
return sideDecksList.Find((SideDeckInfo sideDeck) => sideDeck.internalName == name);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "CustomSideDeck";
public const string PLUGIN_NAME = "CustomSideDeck";
public const string PLUGIN_VERSION = "2.3.0";
}
}
namespace CustomSideDeck.Info
{
public class SideDeckInfo
{
public string internalName;
public string displayName;
public string description;
public string csdType;
public int numCards;
public string defaultCard;
public List<string> cards;
public List<string> options;
public string cardBack;
public string pixelCardBack;
public bool isAqua;
public int challengePoints;
public bool canEditDuringRun;
}
}