using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Conductor.Extensions;
using EssenceData;
using EssenceData.code;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using SimpleInjector;
using TrainworksReloaded.Base.Extensions;
using TrainworksReloaded.Core;
using TrainworksReloaded.Core.Extensions;
using TrainworksReloaded.Core.Interfaces;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EssenceData")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+e48487f051770bbec7f50f4f0ad48007eacfec92")]
[assembly: AssemblyProduct("EssenceData")]
[assembly: AssemblyTitle("EssenceData")]
[assembly: AssemblyVersion("0.1.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[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;
}
}
}
[HarmonyPatch(typeof(CharacterData), "GetCharacterCardText")]
internal class CharacterData_GetCharacterCardText_AddFusedMonster_Patch
{
public static void Postfix(ref string text, CardState cardState)
{
List<CardUpgradeState> list = ((cardState != null) ? cardState.GetCardStateModifiers().GetCardUpgrades() : null);
if (IEnumerableUtility.IsNullOrEmpty<CardUpgradeState>(list))
{
return;
}
foreach (CardUpgradeState item in list)
{
if (EssenceExtensions.IsEssenceUpgrade(item))
{
CharacterData sourceEssenceCharacter = EssenceExtensions.GetSourceEssenceCharacter(item);
string text2 = string.Format(LocalizationExtensions.Localize("TextFormat_Fused", (ILocalizationParameterContext)null), sourceEssenceCharacter.GetName());
text = text + Environment.NewLine + text2 + Environment.NewLine;
}
}
}
}
[HarmonyPatch(typeof(CardTooltipContainer), "AddUpgradedCharacterTriggers")]
internal class CardTooltipContainer_AddUpgradedCharacterTriggers_SynthesisTooltipsPatch
{
public static void Postfix(CardStateModifiers cardStateModifiers, CardTooltipContainer __instance)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Expected O, but got Unknown
if (cardStateModifiers == null)
{
return;
}
foreach (CardUpgradeState cardUpgrade in cardStateModifiers.GetCardUpgrades())
{
CharacterData sourceEssenceCharacter = EssenceExtensions.GetSourceEssenceCharacter(cardUpgrade);
if (EssenceExtensions.IsEssenceUpgrade(cardUpgrade) && (Object)(object)sourceEssenceCharacter != (Object)null)
{
TooltipUI obj = ((TooltipContainer)__instance).InstantiateTooltip("synthesis", Plugin.Synthesis, false, false, false);
string text = string.Format(LocalizationExtensions.Localize("CardFrameUI_SynthesisTextFormat", (ILocalizationParameterContext)null), sourceEssenceCharacter.GetName());
if (obj != null)
{
obj.Set(text, LocalizationExtensions.Localize(cardUpgrade.GetUpgradeDescriptionKey(), (ILocalizationParameterContext)new CardEffectLocalizationContext((ILocalizationEffectPower)(object)cardUpgrade.GetSourceCardUpgradeData(), (CharacterState)null, (CardState)null, (IRoomStateModifier)null, (CharacterStatusEffectAdjustments)null)), false);
}
}
}
}
}
[HarmonyPatch(typeof(CardUI), "UpdateTextContent")]
internal class CardUI_UpdateTextContent_ShowSynthesisEffectPatch
{
public static bool EnableShowingSynthesis;
public static bool Prefix(CardState cardState, CardFrameUI ____cardFrame)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
if (!EnableShowingSynthesis || !cardState.IsMonsterCard())
{
return true;
}
CharacterData spawnCharacterData = cardState.GetSpawnCharacterData();
CardUpgradeData val = ((spawnCharacterData != null) ? EssenceExtensions.GetEssence(spawnCharacterData) : null);
string text = default(string);
cardState.GetCardTypeCardText(ref text);
object obj;
if (val == null)
{
obj = null;
}
else
{
string upgradeDescriptionKey = val.GetUpgradeDescriptionKey();
obj = ((upgradeDescriptionKey != null) ? LocalizationExtensions.Localize(upgradeDescriptionKey, (ILocalizationParameterContext)new CardEffectLocalizationContext((ILocalizationEffectPower)(object)val, (CharacterState)null, cardState, (IRoomStateModifier)null, (CharacterStatusEffectAdjustments)null)) : null);
}
if (obj == null)
{
obj = "No essence";
}
string text2 = (string)obj;
text2 = "Effect: " + text2;
____cardFrame.SetTextContent(cardState.GetCardType(), cardState.GetTitle(), text2, text);
return false;
}
}
[HarmonyPatch(typeof(CardState), "SetupBodyUpgradeText")]
public static class SetupBodyUpgradeText_Patch
{
private static readonly MethodInfo FilterMethod = AccessTools.Method(typeof(SetupBodyUpgradeText_Patch), "ExcludeUpgrade", (Type[])null, (Type[])null);
public static bool ExcludeUpgrade(CardUpgradeState cardUpgrade)
{
return EssenceExtensions.IsEssenceUpgrade(cardUpgrade);
}
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Expected O, but got Unknown
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Expected O, but got Unknown
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, il);
val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => (i.opcode == OpCodes.Call || i.opcode == OpCodes.Callvirt) && (i.operand?.ToString().Contains("MoveNext") ?? false)), (string)null)
});
if (val.IsInvalid)
{
Debug.LogError((object)"[SetupBodyUpgradeText_Patch] Still failed to locate MoveNext call. Dumping opcodes for debugging.");
return instructions;
}
Label label = il.DefineLabel();
val.Instruction.labels.Add(label);
val.Start();
val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => (i.opcode == OpCodes.Call || i.opcode == OpCodes.Callvirt) && (i.operand?.ToString().Contains("get_Current") ?? false)), (string)null),
new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.IsStloc(i, (LocalBuilder)null)), (string)null)
});
if (val.IsInvalid)
{
Debug.LogError((object)"[SetupBodyUpgradeText_Patch] Failed to locate get_Current assignment.");
return instructions;
}
val.Advance(1);
CodeInstruction val2 = ConvertStlocToLdloc(val.Instruction);
val.Advance(1);
val.Insert((CodeInstruction[])(object)new CodeInstruction[3]
{
val2,
new CodeInstruction(OpCodes.Call, (object)FilterMethod),
new CodeInstruction(OpCodes.Brtrue, (object)label)
});
return val.InstructionEnumeration();
}
private static CodeInstruction ConvertStlocToLdloc(CodeInstruction stloc)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
if (stloc.opcode == OpCodes.Stloc_0)
{
return new CodeInstruction(OpCodes.Ldloc_0, (object)null);
}
if (stloc.opcode == OpCodes.Stloc_1)
{
return new CodeInstruction(OpCodes.Ldloc_1, (object)null);
}
if (stloc.opcode == OpCodes.Stloc_2)
{
return new CodeInstruction(OpCodes.Ldloc_2, (object)null);
}
if (stloc.opcode == OpCodes.Stloc_3)
{
return new CodeInstruction(OpCodes.Ldloc_3, (object)null);
}
if (stloc.opcode == OpCodes.Stloc_S)
{
return new CodeInstruction(OpCodes.Ldloc_S, stloc.operand);
}
if (stloc.opcode == OpCodes.Stloc)
{
return new CodeInstruction(OpCodes.Ldloc, stloc.operand);
}
throw new InvalidOperationException($"Unexpected store local opcode: {stloc.opcode}");
}
}
namespace EssenceData
{
[BepInPlugin("EssenceData", "EssenceData", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger = new ManualLogSource("EssenceData");
public static TooltipDesignType Synthesis;
public void Awake()
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
Railhead.GetBuilder().Configure("EssenceData", (Action<IConfigurationBuilder>)delegate(IConfigurationBuilder c)
{
ConfigurationExtensions.AddMergedJsonFile(c, new List<string>(92)
{
"json/localizations.json", "json/tooltips.json", "json/unit_synthesis_reward_setup.json", "json/essences/awoken/Animus of Speed.json", "json/essences/awoken/Animus of Will.json", "json/essences/awoken/Awoken Hollow.json", "json/essences/awoken/Edge Prior.json", "json/essences/awoken/Husk Hermit.json", "json/essences/awoken/Shard Channeler.json", "json/essences/awoken/Shattered Shell.json",
"json/essences/awoken/Steelsinger.json", "json/essences/awoken/Thorned Hollow.json", "json/essences/awoken/Vinemother.json", "json/essences/awoken/Wildwood Custodian.json", "json/essences/awoken/Wilting Sapwood.json", "json/essences/clanless/Shield Steward.json", "json/essences/clanless/Spear Steward.json", "json/essences/clanless/Dante.json", "json/essences/hellhorned/Alpha Fiend.json", "json/essences/hellhorned/Apex Imp.json",
"json/essences/hellhorned/Branded Warrior.json", "json/essences/hellhorned/Consumer of Crowns.json", "json/essences/hellhorned/Demon Fiend.json", "json/essences/hellhorned/Deranged Brute.json", "json/essences/hellhorned/Fledgling Imp.json", "json/essences/hellhorned/Horned Warrior.json", "json/essences/hellhorned/Impish Scholar.json", "json/essences/hellhorned/Molting Imp.json", "json/essences/hellhorned/Pyre Chomper.json", "json/essences/hellhorned/Queen's Impling.json",
"json/essences/hellhorned/Railbeater.json", "json/essences/hellhorned/Steelworker.json", "json/essences/hellhorned/Transcendimp.json", "json/essences/hellhorned/Welder Helper.json", "json/essences/remnant/Big Sludge.json", "json/essences/remnant/Bounty Stalker.json", "json/essences/remnant/Devourer of Death.json", "json/essences/remnant/Draff.json", "json/essences/remnant/Dreg.json", "json/essences/remnant/Entombed Explosive.json",
"json/essences/remnant/Formless Child.json", "json/essences/remnant/Lady of the House.json", "json/essences/remnant/Lady of the Reformed.json", "json/essences/remnant/Legion of Wax.json", "json/essences/remnant/Molten Encasement.json", "json/essences/remnant/Paraffin Enforcer.json", "json/essences/remnant/Paraffin Thug.json", "json/essences/remnant/Remnant Host.json", "json/essences/remnant/Votivary.json", "json/essences/remnant/Wickless Baron.json",
"json/essences/remnant/Wickless Tycoon.json", "json/essences/stygian/Coldcaelia.json", "json/essences/stygian/Cuttlehex.json", "json/essences/stygian/Eel Gorgon.json", "json/essences/stygian/Glacial Seal.json", "json/essences/stygian/Guard of the Unnamed.json", "json/essences/stygian/Guardian Stone.json", "json/essences/stygian/Icy Cilophyte.json", "json/essences/stygian/Lodestone Totem.json", "json/essences/stygian/Molluscmage.json",
"json/essences/stygian/Nameless Siren.json", "json/essences/stygian/Offering Monument.json", "json/essences/stygian/Siren of the Sea.json", "json/essences/stygian/Titan Sentry.json", "json/essences/umbra/Alloyed Construct.json", "json/essences/umbra/Antumbra Morsel.json", "json/essences/umbra/Crucible Collector.json", "json/essences/umbra/Crucible Warden.json", "json/essences/umbra/Ember Forge.json", "json/essences/umbra/Magma Morsel.json",
"json/essences/umbra/Morsel Excavator.json", "json/essences/umbra/Morsel Jeweler.json", "json/essences/umbra/Morsel Miner.json", "json/essences/umbra/Morsel-Made.json", "json/essences/umbra/Morselmaker.json", "json/essences/umbra/Morselmaster.json", "json/essences/umbra/Overgorger.json", "json/essences/umbra/Rubble Morsel.json", "json/essences/umbra/Shadoweater.json", "json/essences/umbra/Shadowsiege.json",
"json/essences/wurmkin/Bog Chrysalis.json", "json/essences/wurmkin/Bog Fly.json", "json/essences/wurmkin/Bog Wurmling.json", "json/essences/wurmkin/Bogdeep Cocoon.json", "json/essences/wurmkin/First of Kin.json", "json/essences/wurmkin/Glareminder.json", "json/essences/wurmkin/Glugsider.json", "json/essences/wurmkin/Keeper of Echoes.json", "json/essences/wurmkin/Kinhost Carapace.json", "json/essences/wurmkin/Kinhost Pupa.json",
"json/essences/wurmkin/Kinhost Vessel.json", "json/essences/wurmkin/Shardsoul Carver.json"
});
});
Railend.ConfigurePostAction((Action<Container>)delegate(Container c)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
Synthesis = IEnumerableUtility.GetValueOrDefault<string, TooltipDesignType>((IDictionary<string, TooltipDesignType>)c.GetInstance<IRegister<TooltipDesignType>>(), StringExtensions.GetId("EssenceData", "TooltipDesignTypeEnum", "Synthesis"), (TooltipDesignType)0);
IEnumerableUtility.GetValueOrDefault<string, RewardData>((IDictionary<string, RewardData>)c.GetInstance<IRegister<RewardData>>(), StringExtensions.GetId("EssenceData", "RewardData", "unit_synthesis_reward"), (RewardData)null);
UnitSynthesisRewardData.FilterMask = IEnumerableUtility.GetValueOrDefault<string, CardUpgradeMaskData>((IDictionary<string, CardUpgradeMaskData>)c.GetInstance<IRegister<CardUpgradeMaskData>>(), StringExtensions.GetId("EssenceData", "UpgradeMask", "HasBeenFused"), (CardUpgradeMaskData)null);
UnitSynthesisRewardData.fusedUpgrade = IEnumerableUtility.GetValueOrDefault<string, CardUpgradeData>((IDictionary<string, CardUpgradeData>)c.GetInstance<IRegister<CardUpgradeData>>(), StringExtensions.GetId("EssenceData", "Upgrade", "Fusion"), (CardUpgradeData)null);
});
Logger.LogInfo((object)"Plugin EssenceData is loaded!");
new Harmony("EssenceData").PatchAll();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "EssenceData";
public const string PLUGIN_NAME = "EssenceData";
public const string PLUGIN_VERSION = "0.1.0";
}
}
namespace EssenceData.code
{
public class CardTraitFused : CardTraitState
{
public override PropDescriptions CreateEditorInspectorDescriptions()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
return new PropDescriptions();
}
}
public sealed class UnitSynthesisRewardData : GrantableRewardData
{
public readonly int numCardsToSelect = 2;
[SerializeField]
public static CardUpgradeMaskData? FilterMask;
[SerializeField]
public static CardUpgradeData? fusedUpgrade;
[SerializeField]
[LocalizedTextKey(false, true)]
public string? purgeCardTitleKey = "UnitSynthesisRewardData_purgeTitleKey";
[SerializeField]
[LocalizedTextKey(false, true)]
public string? upgradeUnitTitleKey = "UnitSynthesisRewardData_upgradeUnitTitleKey";
private List<CardState> cardsChosen = new List<CardState>();
public override InteractionType interactionType => (InteractionType)2;
public UnitSynthesisRewardData()
{
((RewardData)this)._rewardTitleKey = "UnitSynthesisRewardData_rewardTitleKey";
((RewardData)this)._rewardDescriptionKey = "UnitSynthesisRewardData_rewardDescriptionKey";
}
public override void GrantReward(GrantParams grantParams)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
((MonoBehaviour)grantParams.coreGameManagers.GetSaveManager()).StartCoroutine(ShowDeckSelection(grantParams));
}
private IEnumerator ShowDeckSelection(GrantParams grantParams)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
cardsChosen.Clear();
for (int i = 0; i < numCardsToSelect; i++)
{
string instructionContent = LocalizationExtensions.Localize(purgeCardTitleKey, (ILocalizationParameterContext)null);
FilterCardStateDelegate func = new FilterCardStateDelegate(OnlyUnfusedMonstersWithEssences);
CardUpgradeData upgrade = null;
CardUI_UpdateTextContent_ShowSynthesisEffectPatch.EnableShowingSynthesis = true;
if (i > 0)
{
CardUI_UpdateTextContent_ShowSynthesisEffectPatch.EnableShowingSynthesis = false;
upgrade = EssenceExtensions.GetEssence(cardsChosen[i - 1].GetSpawnCharacterData());
string format = LocalizationExtensions.Localize(upgradeUnitTitleKey, (ILocalizationParameterContext)null);
string upgradeDescriptionKey = upgrade.GetUpgradeDescriptionKey();
instructionContent = string.Format(format, ((upgradeDescriptionKey != null) ? LocalizationExtensions.Localize(upgradeDescriptionKey, (ILocalizationParameterContext)new CardEffectLocalizationContext((ILocalizationEffectPower)(object)upgrade, (CharacterState)null, cardsChosen[i - 1], (IRoomStateModifier)null, (CharacterStatusEffectAdjustments)null)) : null) ?? "");
func = null;
}
bool cardChosen = false;
bool interactionCompleted = false;
ref Action interactionCompleteCallback = ref grantParams.interactionCompleteCallback;
interactionCompleteCallback = (Action)Delegate.Combine(interactionCompleteCallback, (Action)delegate
{
interactionCompleted = true;
});
((GrantableRewardData)this).DoUIScreenConfirmationFlow((ScreenName)3, grantParams, (Action<IScreen, ScreenSetupConfirmationDelegate>)delegate(IScreen screen, ScreenSetupConfirmationDelegate screenSetupConfirmation)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Expected O, but got Unknown
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Expected O, but got Unknown
IScreen obj = ((screen is DeckScreen) ? screen : null);
((DeckScreen)obj).Setup(new Params
{
mode = (Mode)12,
showCancel = true,
rewardSource = grantParams.source,
cardUpgradeMaskData = FilterMask,
cardTypeFilter = (CardType)1,
filterFunc = func,
totalUses = grantParams.correspondingReward.TotalUses,
sourceRewardState = grantParams.correspondingReward,
forceExcludeCard = ((i > 0) ? cardsChosen[0] : null),
numDeckScreensNeededAfterThis = numCardsToSelect - i - 1,
titleKey = ((RewardData)this)._rewardTitleKey,
overrideInstructionContent = instructionContent,
cardUpgradeData = upgrade,
ignoreUpgradeLimit = true
});
((DeckScreen)obj).AddDeckScreenCardStateChosenDelegate((CardStateChosenDelegate)delegate(CardState returnCardState)
{
if (returnCardState != null)
{
cardsChosen.Add(returnCardState);
cardChosen = true;
}
});
}, (RewardGrantedCallbackTiming)1);
yield return (object)new WaitWhile((Func<bool>)(() => !interactionCompleted));
if (!cardChosen)
{
break;
}
}
if (cardsChosen.Count == numCardsToSelect)
{
InfuseCards(grantParams.coreGameManagers.GetSaveManager());
grantParams.rewardGrantedCallback?.Invoke(default(GrantResult));
grantParams.correspondingReward.ClaimReward(false);
}
}
private void InfuseCards(SaveManager saveManager)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
CardState val = cardsChosen[0];
CardUpgradeData essence = EssenceExtensions.GetEssence(val.GetSpawnCharacterData());
CardState val2 = cardsChosen[1];
CardUpgradeState val3 = new CardUpgradeState();
val3.Setup(essence, false, false);
val2.ApplyPermanentUpgrade(val3, saveManager, true, (string)null);
val3 = new CardUpgradeState();
val3.Setup(fusedUpgrade, false, false);
val2.ApplyPermanentUpgrade(val3, saveManager, true, (string)null);
saveManager.RemoveCardFromDeck(val);
saveManager.ShowCardAddedAnimation(val2, (Action)null);
}
private bool OnlyUnfusedMonstersWithEssences(CardState cardState)
{
if (!cardState.IsMonsterCard())
{
return true;
}
CharacterData spawnCharacterData = cardState.GetSpawnCharacterData();
if ((Object)(object)spawnCharacterData == (Object)null)
{
return true;
}
return (Object)(object)EssenceExtensions.GetEssence(spawnCharacterData) == (Object)null;
}
}
}