using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DiskCardGame; using GBC; using HarmonyLib; using InscryptionAPI.Ascension; using InscryptionAPI.Card; using InscryptionAPI.CardCosts; using InscryptionAPI.Helpers; using InscryptionCommunityPatch.Card; using LifeCost.Cards; using LifeCost.Costs; using LifeCost.Costs.HCost; using LifeCost.Costs.LCost; using LifeCost.Costs.MCost; using LifeCost.Sigils; using LifeCost.Utility; using Microsoft.CodeAnalysis; using Pixelplacement; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyDescription("")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("05fe5e41-204a-49d6-bb88-1d873869dc85")] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("LifeCost")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LifeCost")] [assembly: AssemblyTitle("LifeCost")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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 LifeCost { [BepInPlugin("extraVoid.inscryption.LifeCost", "Life Scrybe", "4.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string APIGUID = "cyantist.inscryption.api"; public const string PluginGuid = "extraVoid.inscryption.LifeCost"; public const string ZGUID = "community.inscryption.patch"; private const string PluginName = "Life Scrybe"; private const string PluginVersion = "4.0.0"; public static string Directory; internal static ManualLogSource Log; internal static ConfigEntry configFairHandActive; internal static ConfigEntry configFairHandCostL; internal static ConfigEntry configFairHandCostM; internal static ConfigEntry configFairHandCostH; private void Awake() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Directory = ((BaseUnityPlugin)this).Info.Location.Replace("LifeCost.dll", ""); new Harmony("extraVoid.inscryption.LifeCost").PatchAll(); configFairHandActive = ((BaseUnityPlugin)this).Config.Bind("Fair Hand", "Active", true, "Should this mod post-fix patch fair hand to include the Money, Life, and Hybrid Costs?"); configFairHandCostL = ((BaseUnityPlugin)this).Config.Bind("Fair Hand", "Life Cost", 4, "The value in which the card should not show up in fair hand."); configFairHandCostM = ((BaseUnityPlugin)this).Config.Bind("Fair Hand", "Money Cost", 2, "The value in which the card should not show up in fair hand."); configFairHandCostH = ((BaseUnityPlugin)this).Config.Bind("Fair Hand", "Hybrid Cost", 2, "The value in which the card should not show up in fair hand."); CostsToAdd.AddCost(); SigilsToAdd.AddSigils(); Teck.AddCard(); Meck.AddCard(); Leck.AddCard(); } private void Start() { Log.LogMessage((object)"Lifecost start event fired"); BackwardsCompatibility.ChangeCardsToLifecost(); } public static void AddStartingDeck() { Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("Dev_Test.png", typeof(Plugin).Assembly, (FilterMode)0); StarterDeckInfo val = ScriptableObject.CreateInstance(); val.title = "NewCost Dev Test"; val.iconSprite = TextureHelper.ConvertTexture(imageAsTexture, (SpriteType)9, (FilterMode)0); val.cards = new List { CardLoader.GetCardByName("lifecost_Leck"), CardLoader.GetCardByName("lifecost_Meck"), CardLoader.GetCardByName("lifecost_Teck") }; StarterDeckManager.Add("extraVoid.inscryption.LifeCost", val, 0); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LifeCost"; public const string PLUGIN_NAME = "LifeCost"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace LifeCost.Utility { public static class ext { public static int LifeCost(this CardInfo info) { int? extendedPropertyAsInt = CardExtensions.GetExtendedPropertyAsInt(info, "LifeCost"); if (!extendedPropertyAsInt.HasValue) { return 0; } return extendedPropertyAsInt.Value; } public static int MoneyCost(this CardInfo info) { int? extendedPropertyAsInt = CardExtensions.GetExtendedPropertyAsInt(info, "MoneyCost"); if (!extendedPropertyAsInt.HasValue) { return 0; } return extendedPropertyAsInt.Value; } public static int LifeMoneyCost(this CardInfo info) { int? extendedPropertyAsInt = CardExtensions.GetExtendedPropertyAsInt(info, "LifeMoneyCost"); if (!extendedPropertyAsInt.HasValue) { return 0; } return extendedPropertyAsInt.Value; } } public static class BackwardsCompatibility { public static void ChangeCardsToLifecost() { CardManager.ModifyCardList += delegate(List cards) { foreach (CardInfo item in cards.Where((CardInfo c) => c.EnergyCost < 0)) { int num = item.EnergyCost * -1; CardExtensions.SetExtendedProperty(item, "LifeMoneyCost", (object)num); CardExtensions.SetEnergyCost(item, (int?)0); } return cards; }; } public static void SetCardsToLifeMoneycost() { CardManager.ModifyCardList += delegate(List cards) { foreach (CardInfo item in cards.Where((CardInfo c) => CardExtensions.GetCustomCost(c, "LifeMoneyCost", false) != 0)) { int customCost = CardExtensions.GetCustomCost(item, "LifeMoneyCost", false); CardExtensions.SetExtendedProperty(item, "LifeMoneyCost", (object)customCost); } return cards; }; } public static void SetCardsToMoneycost() { CardManager.ModifyCardList += delegate(List cards) { foreach (CardInfo item in cards.Where((CardInfo c) => CardExtensions.GetCustomCost(c, "MoneyCost", false) != 0)) { int customCost = CardExtensions.GetCustomCost(item, "MoneyCost", false); CardExtensions.SetExtendedProperty(item, "MoneyCost", (object)customCost); } return cards; }; } public static void SetCardsToLifecost() { CardManager.ModifyCardList += delegate(List cards) { foreach (CardInfo item in cards.Where((CardInfo c) => CardExtensions.GetCustomCost(c, "LifeCost", false) != 0)) { int customCost = CardExtensions.GetCustomCost(item, "LifeCost", false); CardExtensions.SetExtendedProperty(item, "LifeCost", (object)customCost); } return cards; }; } public static void FixCardsToLifeMoneycost() { CardManager.ModifyCardList += delegate(List cards) { foreach (CardInfo item in cards.Where((CardInfo c) => c.LifeMoneyCost() != 0)) { int num = item.LifeMoneyCost(); CardExtensions.SetCustomCost(item, "LifeMoneyCost", num); } return cards; }; } public static void FixCardsToMoneycost() { CardManager.ModifyCardList += delegate(List cards) { foreach (CardInfo item in cards.Where((CardInfo c) => c.MoneyCost() != 0)) { int num = item.MoneyCost(); CardExtensions.SetCustomCost(item, "MoneyCost", num); } return cards; }; } public static void FixCardsToLifecost() { CardManager.ModifyCardList += delegate(List cards) { foreach (CardInfo item in cards.Where((CardInfo c) => c.LifeCost() != 0)) { int num = item.LifeCost(); CardExtensions.SetCustomCost(item, "LifeCost", num); } return cards; }; } } public static class CardUtils { private static Assembly _assembly; public static Assembly CurrentAssembly { get { Assembly result; if ((result = _assembly) == null) { result = (_assembly = Assembly.GetExecutingAssembly()); } return result; } } public static Texture2D getImage(string path) { return TextureHelper.GetImageAsTexture(path, CurrentAssembly, (FilterMode)0); } public static Sprite getSprite(string path) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) new Sprite(); Texture2D image = getImage(path); return Sprite.Create(image, new Rect(0f, 0f, (float)((Texture)image).width, (float)((Texture)image).height), new Vector2(0.5f, 0.5f)); } public static LineSet SetAbilityInfoDialogue(string dialogue) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown return new LineSet(new List { new Line { text = dialogue } }); } public static AbilityInfo CreateAbilityWithDefaultSettings(string rulebookName, string rulebookDescription, Type behavior, Texture2D text_a1, Sprite text_a2, string LearnDialogue, bool withDialogue = false, int powerLevel = 0, bool leshyUsable = false, bool part1Modular = true, bool stack = false) { AbilityInfo val = AbilityManager.New("extraVoid.inscryption.LifeCost", rulebookName, rulebookDescription, behavior, (Texture)(object)text_a1); if (withDialogue) { val.abilityLearnedDialogue = SetAbilityInfoDialogue(LearnDialogue); } val.powerLevel = powerLevel; val.activated = true; if (part1Modular) { val.metaCategories = new List { (AbilityMetaCategory)1, (AbilityMetaCategory)0 }; } else { val.metaCategories = new List { (AbilityMetaCategory)0 }; } val.pixelIcon = text_a2; val.canStack = stack; return val; } public static CardInfo CreateCardWithDefaultSettings(string InternalName, string DisplayName, int attack, int health, Texture2D texture_base, Texture2D texture_emission, List cardMetaCategories, List tribes, List traits, List abilities, Texture2D texture_pixel = null, int bloodCost = 0, int boneCost = 0, int energyCost = 0) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected I4, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) CardInfo val = CardManager.New("lifecost", InternalName, DisplayName, attack, health, "A puddle that errods all that touches it."); CardExtensions.SetPortrait(val, texture_base, texture_emission, (FilterMode?)null); if ((Object)(object)texture_pixel != (Object)null) { CardExtensions.SetPixelPortrait(val, texture_pixel, (FilterMode?)null); } val.metaCategories = cardMetaCategories; val.tribes = tribes; val.traits = traits; for (int i = 0; i < abilities.Count; i++) { CardExtensions.AddAbilities(val, (Ability[])(object)new Ability[1] { (Ability)(int)abilities[i] }); } val.temple = (CardTemple)0; val.cardComplexity = (CardComplexity)2; CardExtensions.SetBloodCost(val, (int?)bloodCost); CardExtensions.SetBonesCost(val, (int?)boneCost); CardExtensions.SetEnergyCost(val, (int?)energyCost); return val; } } } namespace LifeCost.Sigils { public class lifecost_ActivateEnergyGamble : LifeActiveAbilityCost { public static Ability ability; public override Ability Ability => ability; public override int EnergyCost => 6; public override IEnumerator Activate() { yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence(); yield return (object)new WaitForSeconds(0.15f); bool flag = !SaveManager.SaveFile.IsPart2; int amount = Random.Range(0, 3); if (amount == 0) { yield return ((AbilityBehaviour)this).LearnAbility(0.25f); yield return (object)new WaitForSeconds(0.1f); yield break; } Random random = new Random(); bool whoGetsit = random.Next(2) == 0; if (flag) { float waitTime2 = 0.1f; Singleton.Instance.SwitchToView((View)7, false, true); yield return (object)new WaitForSeconds(waitTime2); ((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect(); yield return PayCost.ShowDamageSequence(amount, amount, whoGetsit); yield return (object)new WaitForSeconds(waitTime2); Singleton.Instance.SwitchToView((View)4, false, true); Singleton.Instance.Controller.LockState = (ViewLockState)0; } else { float waitTime2 = 0.5f; yield return (object)new WaitForSeconds(waitTime2); ((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect(); yield return PayCost.ShowDamageSequence(amount, amount, whoGetsit); yield return (object)new WaitForSeconds(waitTime2); } yield return ((AbilityBehaviour)this).LearnAbility(0.25f); yield return (object)new WaitForSeconds(0.1f); } } public class lifecost_ActivateLifeRandomStatsUp : LifeActiveAbilityCost { public static Ability ability; private const string MOD_ID = "extraVoid.inscryption.LifeCost_statsUp"; public override Ability Ability => ability; public override int LifeMoneyCost => 5; public override IEnumerator Activate() { yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence(); yield return (object)new WaitForSeconds(0.15f); CardModificationInfo mod = ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "extraVoid.inscryption.LifeCost_statsUp"); bool isPart = !SaveManager.SaveFile.IsPart2; if (mod == null) { mod = new CardModificationInfo(); mod.singletonId = "extraVoid.inscryption.LifeCost_statsUp"; ((AbilityBehaviour)this).Card.AddTemporaryMod(mod); } yield return (object)new WaitForSeconds(0.5f); int StatsUp = Random.Range(0, 6); if (isPart) { Singleton.Instance.SwitchToView((View)4, false, true); for (int index2 = 0; index2 < StatsUp; index2++) { if (Random.Range(1, 100) > 50) { yield return (object)new WaitForSeconds(0.2f); CardModificationInfo obj = mod; obj.healthAdjustment++; ((AbilityBehaviour)this).Card.OnStatsChanged(); ((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect(); } else { yield return (object)new WaitForSeconds(0.2f); CardModificationInfo obj2 = mod; obj2.attackAdjustment++; ((AbilityBehaviour)this).Card.OnStatsChanged(); ((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect(); } } yield return (object)new WaitForSeconds(0.1f); Singleton.Instance.Controller.LockState = (ViewLockState)0; } else { for (int index2 = 0; index2 < StatsUp; index2++) { if (Random.Range(1, 100) > 50) { yield return (object)new WaitForSeconds(0.2f); CardModificationInfo obj3 = mod; obj3.healthAdjustment++; ((AbilityBehaviour)this).Card.OnStatsChanged(); ((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect(); } else { yield return (object)new WaitForSeconds(0.2f); CardModificationInfo obj4 = mod; obj4.attackAdjustment++; ((AbilityBehaviour)this).Card.OnStatsChanged(); ((Card)((AbilityBehaviour)this).Card).Anim.StrongNegationEffect(); } } } yield return ((AbilityBehaviour)this).LearnAbility(0.25f); yield return (object)new WaitForSeconds(0.1f); } } public class lifecost_ActivateCashConverter : LifeActiveAbilityCost { public static Ability ability; public override Ability Ability => ability; public override int MoneyCost => 4; public override IEnumerator Activate() { yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence(); yield return (object)new WaitForSeconds(0.15f); if (!SaveManager.SaveFile.IsPart2) { float waitTime2 = 0.1f; Singleton.Instance.SwitchToView((View)7, false, true); yield return (object)new WaitForSeconds(waitTime2); yield return PayCost.ShowDamageSequence(1, 1, toPlayer: false); yield return (object)new WaitForSeconds(waitTime2); Singleton.Instance.SwitchToView((View)7, false, true); Singleton.Instance.Controller.LockState = (ViewLockState)0; } else { float waitTime2 = 0.5f; yield return (object)new WaitForSeconds(waitTime2); yield return PayCost.ShowDamageSequence(1, 1, toPlayer: false); yield return (object)new WaitForSeconds(waitTime2); } yield return ((AbilityBehaviour)this).LearnAbility(0.25f); yield return (object)new WaitForSeconds(0.1f); } } public class lifecost_ActivateLifeConverter : LifeActiveAbilityCost { public static Ability ability; public override Ability Ability => ability; public override int LifeCost => 2; public override IEnumerator Activate() { yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence(); yield return (object)new WaitForSeconds(0.15f); if (!SaveManager.SaveFile.IsPart2) { if (Chainloader.PluginInfos.ContainsKey("extraVoid.inscryption.LifeCost")) { Singleton.Instance.SwitchToView((View)7, false, true); yield return (object)new WaitForSeconds(0.25f); RunState run = RunState.Run; run.currency += 2; yield return Singleton.Instance.DropWeightsIn(2); yield return (object)new WaitForSeconds(0.75f); Singleton.Instance.SwitchToView((View)4, false, true); Singleton.Instance.Controller.LockState = (ViewLockState)0; } else { Singleton.Instance.SwitchToView((View)7, false, true); yield return (object)new WaitForSeconds(0.25f); RunState run2 = RunState.Run; run2.currency += 2; yield return Singleton.Instance.ShowGain(2, true, false); yield return (object)new WaitForSeconds(0.25f); Singleton.Instance.SwitchToView((View)4, false, true); Singleton.Instance.Controller.LockState = (ViewLockState)0; } } else { SaveData data = SaveData.Data; data.currency += 2; ((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect(); } yield return ((AbilityBehaviour)this).LearnAbility(0.25f); yield return (object)new WaitForSeconds(0.1f); } } public class lifecost_ActivateStatsUpLife : LifeActiveAbilityCost { public static Ability ability; private const string MOD_ID = "extraVoid.inscryption.LifeCost_statsUp"; public override Ability Ability => ability; public override int LifeCost => 3; public override IEnumerator Activate() { bool flag = !SaveManager.SaveFile.IsPart2; if (flag) { Singleton.Instance.SwitchToView((View)4, false, true); } CardModificationInfo val = ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "extraVoid.inscryption.LifeCost_statsUp"); if (val == null) { val = new CardModificationInfo(); val.singletonId = "extraVoid.inscryption.LifeCost_statsUp"; ((AbilityBehaviour)this).Card.AddTemporaryMod(val); } CardModificationInfo obj = val; obj.attackAdjustment++; CardModificationInfo obj2 = val; obj2.healthAdjustment++; ((AbilityBehaviour)this).Card.OnStatsChanged(); yield return (object)new WaitForSeconds(0.25f); if (flag) { Singleton.Instance.Controller.LockState = (ViewLockState)0; } } } public class lifecost_ActiveStatsUpMoney : LifeActiveAbilityCost { public static Ability ability; private const string MOD_ID = "extraVoid.inscryption.LifeCost_statsUp"; public override Ability Ability => ability; public override int MoneyCost => 5; public override IEnumerator Activate() { CardModificationInfo val = ((AbilityBehaviour)this).Card.TemporaryMods.Find((CardModificationInfo x) => x.singletonId == "extraVoid.inscryption.LifeCost_statsUp"); if (val == null) { val = new CardModificationInfo(); val.singletonId = "extraVoid.inscryption.LifeCost_statsUp"; ((AbilityBehaviour)this).Card.AddTemporaryMod(val); } CardModificationInfo obj = val; obj.attackAdjustment++; CardModificationInfo obj2 = val; obj2.healthAdjustment++; ((AbilityBehaviour)this).Card.OnStatsChanged(); Singleton.Instance.SwitchToView((View)4, false, true); yield return (object)new WaitForSeconds(0.25f); Singleton.Instance.Controller.LockState = (ViewLockState)0; } } [HarmonyPatch] public abstract class LifeActiveAbilityCost : ActivatedAbilityBehaviour { public virtual int LifeMoneyCost { get; } public virtual int LifeCost { get; } public virtual int MoneyCost { get; } public override int EnergyCost { get; } public override int BonesCost { get; } private bool CanAffordLife() { return Singleton.Instance.Balance + 4 >= LifeCost; } private bool CanAffordMoney() { int num = ((!SaveManager.SaveFile.IsPart2) ? RunState.Run.currency : SaveData.Data.currency); return num >= MoneyCost; } private bool CanAffordHybrid() { Plugin.Log.LogMessage((object)"Lifecost active ability patch firing 3"); int num = ((!SaveManager.SaveFile.IsPart2) ? RunState.Run.currency : SaveData.Data.currency); int num2 = Singleton.Instance.Balance + 4; return num + num2 >= LifeMoneyCost; } public IEnumerator OnActivatedAbility() { if (((ActivatedAbilityBehaviour)this).CanAfford() && CanAffordLife() && CanAffordMoney() && CanAffordHybrid() && ((ActivatedAbilityBehaviour)this).CanActivate()) { if (((ActivatedAbilityBehaviour)this).EnergyCost > 0) { yield return Singleton.Instance.SpendEnergy(((ActivatedAbilityBehaviour)this).EnergyCost); if ((Object)(object)Singleton.Instance != (Object)null) { CardSlot val = Singleton.Instance.GetSlots(true).Find((CardSlot x) => (Object)(object)x.Card != (Object)null && x.Card.HasAbility((Ability)66)); if ((Object)(object)val != (Object)null) { ConduitEnergy component = ((Component)val.Card).GetComponent(); if ((Object)(object)component != (Object)null && component.CompletesCircuit()) { yield return Singleton.Instance.AddEnergy(((ActivatedAbilityBehaviour)this).EnergyCost); } } } } if (((ActivatedAbilityBehaviour)this).BonesCost > 0) { yield return Singleton.Instance.SpendBones(((ActivatedAbilityBehaviour)this).BonesCost); } if (LifeCost > 0) { if (SaveManager.SaveFile.IsPart2) { yield return PayCost.extractCostPart2_lifeOnly(LifeCost); } else { yield return PayCost.extractCostPart1_lifeOnly(LifeCost); } } if (MoneyCost > 0) { if (SaveManager.SaveFile.IsPart2) { yield return PayCost.extractCostPart2_MoneyOnly(MoneyCost); } else { int currency = RunState.Run.currency; yield return PayCost.extractCostPart1_MoneyOnly(MoneyCost, currency); } } if (LifeMoneyCost > 0) { if (SaveManager.SaveFile.IsPart2) { int currency2 = SaveData.Data.currency; yield return PayCost.extractCostPart2_hybrid(LifeMoneyCost, currency2); } else { int currency3 = RunState.Run.currency; yield return PayCost.extractCostPart1_hybrid(LifeMoneyCost, currency3); } } yield return (object)new WaitForSeconds(0.1f); yield return ((AbilityBehaviour)this).PreSuccessfulTriggerSequence(); yield return ((ActivatedAbilityBehaviour)this).Activate(); ProgressionData.SetMechanicLearned((MechanicsConcept)61); } else { ((Card)((AbilityBehaviour)this).Card).Anim.LightNegationEffect(); AudioController.Instance.PlaySound2D("toneless_negate", (MixerGroup)10, 0.2f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false); yield return (object)new WaitForSeconds(0.25f); } } } internal class SigilsToAdd { public static void AddSigils() { AddActivateEnergyGamble(); AddActivateLifeConverter(); AddActivateLifeRandomStatsUp(); AddActiveCashConverter(); AddActiveStatsUpLife(); AddActiveStatsUpMoney(); } private static void AddActivateEnergyGamble() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecost_ActivateEnergyGamble.png", typeof(Plugin).Assembly, (FilterMode)0); Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecost_ActivateEnergyGamble_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0); int powerLevel = 0; bool leshyUsable = true; bool part1Modular = false; bool stack = false; lifecost_ActivateEnergyGamble.ability = CardUtils.CreateAbilityWithDefaultSettings("Max Energy Gamble", "Pay 6 energy to put 0 to 3 damage on someone's side of the scale", typeof(lifecost_ActivateEnergyGamble), imageAsTexture, imageAsSprite, "Money for Blood", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack).ability; } private static void AddActivateLifeRandomStatsUp() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecost_ActivateLifeRandomStatsUp.png", typeof(Plugin).Assembly, (FilterMode)0); Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecost_ActivateLifeRandomStatsUp_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0); int powerLevel = 2; bool leshyUsable = true; bool part1Modular = false; bool stack = false; AbilityInfo obj = CardUtils.CreateAbilityWithDefaultSettings("Die Roll", "Pay 5 Life/Foils to gain between 0 and 6 increase in stats, distributed randomly", typeof(lifecost_ActivateLifeRandomStatsUp), imageAsTexture, imageAsSprite, "Sing it once, Sing it twice, take a chance and roll the dice!", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack); obj.activated = true; lifecost_ActivateLifeRandomStatsUp.ability = obj.ability; } private static void AddActiveCashConverter() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecost_CashConverter.png", typeof(Plugin).Assembly, (FilterMode)0); Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecost_CashConverter_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0); int powerLevel = 2; bool leshyUsable = true; bool part1Modular = false; bool stack = false; lifecost_ActivateCashConverter.ability = CardUtils.CreateAbilityWithDefaultSettings("Cash Converter", "Pay 4 foils to put 1 damage on your opponent's side of the scale", typeof(lifecost_ActivateCashConverter), imageAsTexture, imageAsSprite, "Money for Blood", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack).ability; } private static void AddActivateLifeConverter() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecost_LifeConverter.png", typeof(Plugin).Assembly, (FilterMode)0); Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecost_LifeConverter_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0); int powerLevel = 3; bool leshyUsable = true; bool part1Modular = false; bool stack = false; lifecost_ActivateLifeConverter.ability = CardUtils.CreateAbilityWithDefaultSettings("Life Converter", "Pay 2 life to gain 1 foils", typeof(lifecost_ActivateLifeConverter), imageAsTexture, imageAsSprite, "Blood for money", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack).ability; } private static void AddActiveStatsUpLife() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecost_ActivateStatsUpLife.png", typeof(Plugin).Assembly, (FilterMode)0); Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecost_ActivateStatsUpLife_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0); int powerLevel = 3; bool leshyUsable = true; bool part1Modular = true; bool stack = false; AbilityInfo obj = CardUtils.CreateAbilityWithDefaultSettings("Vamperic Strength", "Pay 3 life to increase the power and health of this card by 1", typeof(lifecost_ActivateStatsUpLife), imageAsTexture, imageAsSprite, "Hurting oneself can lead to an increase in strength.", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack); obj.activated = true; lifecost_ActivateStatsUpLife.ability = obj.ability; } private static void AddActiveStatsUpMoney() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("lifecostActivateStatsUpMoney.png", typeof(Plugin).Assembly, (FilterMode)0); Sprite imageAsSprite = TextureHelper.GetImageAsSprite("lifecostActivateStatsUpMoney_a2.png", typeof(Plugin).Assembly, (SpriteType)11, (FilterMode)0); int powerLevel = 3; bool leshyUsable = true; bool part1Modular = false; bool stack = false; lifecost_ActiveStatsUpMoney.ability = CardUtils.CreateAbilityWithDefaultSettings("Greedy Strength", "Pay 5 currency to increase the power and health of this card by 1", typeof(lifecost_ActiveStatsUpMoney), imageAsTexture, imageAsSprite, "One can be hired to do many tasks", withDialogue: true, powerLevel, leshyUsable, part1Modular, stack).ability; } } } namespace LifeCost.Costs { internal class CostsToAdd { public static void AddCost() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("CostChoiceBack.png", typeof(CostsToAdd).Assembly, (FilterMode)0); FullCardCost val = CardCostManager.Register("extraVoid.inscryption.LifeCost", "LifeMoneyCost", typeof(LifeMoneyCost), (Func)LifeCost.Costs.HCost.Textures.Texture_3D, (Func)LifeCost.Costs.HCost.Textures.Texture_Pixel); CardCostManager.SetCostTier(val, (Func)LifeCost.Costs.HCost.CostTier.CostTierH); val.ResourceType = (ResourceType)42; CardCostManager.SetFoundAtChoiceNodes(val, true, (Texture)(object)imageAsTexture); FullCardCost val2 = CardCostManager.Register("extraVoid.inscryption.LifeCost", "LifeCost", typeof(LifeCost.Costs.LCost.LifeCost), (Func)LifeCost.Costs.LCost.Textures.Texture_3D, (Func)LifeCost.Costs.LCost.Textures.Texture_Pixel); CardCostManager.SetCostTier(val2, (Func)LifeCost.Costs.LCost.CostTier.CostTierL); val2.ResourceType = val.ResourceType; FullCardCost val3 = CardCostManager.Register("extraVoid.inscryption.LifeCost", "MoneyCost", typeof(MoneyCost), (Func)LifeCost.Costs.MCost.Textures.Texture_3D, (Func)LifeCost.Costs.MCost.Textures.Texture_Pixel); CardCostManager.SetCostTier(val3, (Func)LifeCost.Costs.MCost.CostTier.CostTierM); val3.ResourceType = val.ResourceType; if (Plugin.configFairHandActive.Value) { CardCostManager.SetCanBePlayedByTurn2WithHand(val, (Func, bool>)LifeCost.Costs.HCost.CardCanBePlayedByTurn2WithHand.CanBePlayed); CardCostManager.SetCanBePlayedByTurn2WithHand(val2, (Func, bool>)LifeCost.Costs.LCost.CardCanBePlayedByTurn2WithHand.CanBePlayed); CardCostManager.SetCanBePlayedByTurn2WithHand(val3, (Func, bool>)LifeCost.Costs.MCost.CardCanBePlayedByTurn2WithHand.CanBePlayed); } } } internal class PayCost { public static IEnumerator extractCostPart1_hybrid(int costToPay, int currentCurrency) { float waitTime = 0.1f; List list2; if (costToPay > currentCurrency) { Singleton.Instance.SwitchToView((View)7, false, true); costToPay -= currentCurrency; yield return (object)new WaitForSeconds(waitTime); list2 = Singleton.Instance.TakeWeights(RunState.Run.currency); foreach (Rigidbody rigidbody2 in list2) { yield return (object)new WaitForSeconds(waitTime); float num = (float)list2.IndexOf(rigidbody2) * 0.05f; Tween.Position(((Component)rigidbody2).transform, ((Component)rigidbody2).transform.position + Vector3.up * 0.5f, 0.075f, num, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true); Tween.Position(((Component)rigidbody2).transform, new Vector3(0f, 5.5f, 4f), 0.3f, 0.125f + num, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true); Object.Destroy((Object)(object)((Component)rigidbody2).gameObject, 0.5f); } RunState.Run.currency = 0; yield return (object)new WaitForSeconds(waitTime); yield return ShowDamageSequence(costToPay, costToPay, toPlayer: true); Singleton.Instance.SwitchToView((View)0, false, true); Singleton.Instance.Controller.LockState = (ViewLockState)0; yield break; } Singleton.Instance.SwitchToView((View)7, false, true); yield return (object)new WaitForSeconds(waitTime); list2 = Singleton.Instance.TakeWeights(costToPay); foreach (Rigidbody rigidbody2 in list2) { yield return (object)new WaitForSeconds(waitTime); float num2 = (float)list2.IndexOf(rigidbody2) * 0.05f; Tween.Position(((Component)rigidbody2).transform, ((Component)rigidbody2).transform.position + Vector3.up * 0.5f, 0.075f, num2, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true); Tween.Position(((Component)rigidbody2).transform, new Vector3(0f, 5.5f, 4f), 0.3f, 0.125f + num2, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true); Object.Destroy((Object)(object)((Component)rigidbody2).gameObject, 0.5f); } yield return (object)new WaitForSeconds(waitTime); RunState.Run.currency = currentCurrency - costToPay; Singleton.Instance.SwitchToView((View)0, false, true); Singleton.Instance.Controller.LockState = (ViewLockState)0; } public static IEnumerator extractCostPart1_lifeOnly(int costToPay) { float waitTime = 0.1f; Singleton.Instance.SwitchToView((View)7, false, true); yield return (object)new WaitForSeconds(waitTime); yield return ShowDamageSequence(costToPay, costToPay, toPlayer: true); yield return (object)new WaitForSeconds(waitTime); Singleton.Instance.SwitchToView((View)0, false, true); Singleton.Instance.Controller.LockState = (ViewLockState)0; } public static IEnumerator extractCostPart1_MoneyOnly(int costToPay, int currentCurrency) { float waitTime = 0.1f; Singleton.Instance.SwitchToView((View)7, false, true); yield return (object)new WaitForSeconds(waitTime); List list = Singleton.Instance.TakeWeights(costToPay); foreach (Rigidbody rigidbody in list) { yield return (object)new WaitForSeconds(waitTime); float num = (float)list.IndexOf(rigidbody) * 0.05f; Tween.Position(((Component)rigidbody).transform, ((Component)rigidbody).transform.position + Vector3.up * 0.5f, 0.075f, num, Tween.EaseIn, (LoopType)0, (Action)null, (Action)null, true); Tween.Position(((Component)rigidbody).transform, new Vector3(0f, 5.5f, 4f), 0.3f, 0.125f + num, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true); Object.Destroy((Object)(object)((Component)rigidbody).gameObject, 0.5f); } yield return (object)new WaitForSeconds(waitTime); RunState.Run.currency = currentCurrency - costToPay; Singleton.Instance.SwitchToView((View)0, false, true); Singleton.Instance.Controller.LockState = (ViewLockState)0; } public static IEnumerator ShowDamageSequence(int damage, int numWeights, bool toPlayer, float waitAfter = 0.125f, GameObject alternateWeightPrefab = null, float waitBeforeCalcDamage = 0f, bool changeView = false) { if (damage > 1 && (Object)(object)Singleton.Instance != (Object)null) { if ((Object)(object)P03AnimationController.Instance != (Object)null && (int)P03AnimationController.Instance.CurrentFace == 0) { P03AnimationController.Instance.SwitchToFace((Face)(toPlayer ? 4 : 3), false, true); } else if ((Object)(object)Singleton.Instance.Scales != (Object)null) { Singleton.Instance.SetLookTarget(((Component)Singleton.Instance.Scales).transform, Vector3.up * 2f); } } if ((Object)(object)Singleton.Instance.Scales != (Object)null) { if (changeView) { Singleton.Instance.SwitchToView((View)7, false, false); yield return (object)new WaitForSeconds(0.1f); } yield return Singleton.Instance.Scales.AddDamage(damage, numWeights, toPlayer, alternateWeightPrefab); if (waitBeforeCalcDamage > 0f) { yield return (object)new WaitForSeconds(waitBeforeCalcDamage); } if (toPlayer) { LifeManager instance = Singleton.Instance; instance.PlayerDamage += damage; } else { LifeManager instance2 = Singleton.Instance; instance2.OpponentDamage += damage; } yield return (object)new WaitForSeconds(waitAfter); } if ((Object)(object)Singleton.Instance != (Object)null) { if ((Object)(object)P03AnimationController.Instance != (Object)null && ((int)P03AnimationController.Instance.CurrentFace == 3 || (int)P03AnimationController.Instance.CurrentFace == 4)) { P03AnimationController.Instance.PlayFaceStatic(); P03AnimationController.Instance.SwitchToFace((Face)0, false, false); } else { Singleton.Instance.ClearLookTarget(); } } } public static IEnumerator extractCostPart2_hybrid(int costToPay, int currentCurrency) { float waitTime = 0.5f; if (costToPay > currentCurrency) { costToPay -= currentCurrency; yield return (object)new WaitForSeconds(waitTime); AudioController.Instance.PlaySound2D("chipDelay_2", (MixerGroup)0, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false); yield return foilToZero(); yield return (object)new WaitForSeconds(waitTime); yield return ShowDamageSequence(costToPay, costToPay, toPlayer: true); } else { AudioController.Instance.PlaySound2D("chipDelay_2", (MixerGroup)0, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false); yield return foilSpend(costToPay); } } public static IEnumerator extractCostPart2_lifeOnly(int costToPay) { float waitTime = 0.5f; yield return (object)new WaitForSeconds(waitTime); yield return ShowDamageSequence(costToPay, costToPay, toPlayer: true); yield return (object)new WaitForSeconds(waitTime); } public static IEnumerator extractCostPart2_MoneyOnly(int costToPay) { float waitTime = 0.5f; yield return (object)new WaitForSeconds(waitTime); AudioController.Instance.PlaySound2D("chipDelay_2", (MixerGroup)0, 1f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false); yield return foilSpend(costToPay); yield return (object)new WaitForSeconds(waitTime); } public static IEnumerator foilSetup() { Plugin.Log.LogWarning((object)"Life cost set up"); Plugin.Log.LogWarning((object)SaveData.Data.currency); yield break; } public static IEnumerator foilCleanUp() { Plugin.Log.LogWarning((object)"Life cost clean up"); Plugin.Log.LogWarning((object)SaveData.Data.currency); yield break; } public static IEnumerator foilSpend(int amount) { Plugin.Log.LogWarning((object)("Spending foils: " + SaveData.Data.currency)); yield return SaveData.Data.currency = SaveData.Data.currency - amount; Plugin.Log.LogWarning((object)("current foils: " + SaveData.Data.currency)); } public static IEnumerator foilToZero() { SaveData data = SaveData.Data; int num = 0; data.currency = 0; yield return num; } } } namespace LifeCost.Costs.MCost { internal class CardCanBePlayedByTurn2WithHand { public static bool CanBePlayed(int amount, CardInfo card, List hand) { return amount <= Plugin.configFairHandCostM.Value; } } internal class CostTier { public static int CostTierM(int amount) { return Mathf.FloorToInt((float)amount / 5f); } } public class MoneyCost : CustomCardCost { public ResourceType ResourceType = (ResourceType)42; public override string CostName => "MoneyCost"; public override bool CostSatisfied(int cardCost, PlayableCard card) { int num = ((!SaveManager.SaveFile.IsPart2) ? RunState.Run.currency : SaveData.Data.currency); if (cardCost > num) { return false; } return true; } public override string CostUnsatisfiedHint(int cardCost, PlayableCard card) { if (SaveManager.SaveFile.IsPart2) { return "You do not have enough [c:gray]Foils[c:] to play that. You gain [c:gray]Foils[c:] by dealing overkill damage."; } string item = "You lack the foils to play that [c:gray]" + ((Card)card).Info.DisplayedNameLocalized + "[c:]."; string item2 = $"[c:gray]{((Card)card).Info.DisplayedNameLocalized}[c:] requires you pay it's cost in [c:gray]foils[c:], that which you have [c:gray]{RunState.Run.currency}[c:]."; string item3 = $"That [c:gray]{((Card)card).Info.DisplayedNameLocalized}[c:] has the cost of [c:gray]{cardCost}[c:] foils, which you do not have."; List list = new List(); list.Add(item); list.Add(item2); list.Add(item3); return list[Random.Range(0, list.Count)]; } public override IEnumerator OnPlayed(int cardCost, PlayableCard card) { if (SaveManager.SaveFile.IsPart2) { yield return PayCost.extractCostPart2_MoneyOnly(cardCost); } else { yield return PayCost.extractCostPart1_MoneyOnly(cardCost, RunState.Run.currency); } } } internal class Textures { public static Texture2D Texture_3D(int cardCost, CardInfo info, PlayableCard card) { return TextureHelper.GetImageAsTexture($"MoneyCost_{cardCost}.png", typeof(Plugin).Assembly, (FilterMode)0); } public static Texture2D Texture_Pixel(int cardCost, CardInfo info, PlayableCard card) { return Part2CardCostRender.CombineIconAndCount(cardCost, TextureHelper.GetImageAsTexture("MoneyCost_pixel.png", typeof(Plugin).Assembly, (FilterMode)0)); } } } namespace LifeCost.Costs.HCost { internal class CardCanBePlayedByTurn2WithHand { public static bool CanBePlayed(int amount, CardInfo card, List hand) { return amount <= Plugin.configFairHandCostH.Value; } } internal class CostTier { public static int CostTierH(int amount) { return Mathf.FloorToInt((float)amount / 3f); } } public class LifeMoneyCost : CustomCardCost { public ResourceType ResourceType = (ResourceType)42; public override string CostName => "LifeMoneyCost"; public override bool CostSatisfied(int cardCost, PlayableCard card) { int num = ((!SaveManager.SaveFile.IsPart2) ? RunState.Run.currency : SaveData.Data.currency); int num2 = num + Singleton.Instance.Balance + 4; if (cardCost > num2) { return false; } return true; } public override string CostUnsatisfiedHint(int cardCost, PlayableCard card) { if (SaveManager.SaveFile.IsPart2) { return "You do not have enough [c:bG]Life[c:] or [c:gray]Foils[c:] to play that. Damage your opponent to gain more [c:bG]Life[c:]."; } return "Your [c:bG]Scales[c:] are too tipped and you lack the [c:gray]Foils[c:] to play " + ((Card)card).Info.DisplayedNameLocalized + "."; } public override IEnumerator OnPlayed(int cardCost, PlayableCard card) { if (SaveManager.SaveFile.IsPart2) { yield return PayCost.extractCostPart2_hybrid(cardCost, SaveData.Data.currency); } else { yield return PayCost.extractCostPart1_hybrid(cardCost, RunState.Run.currency); } } } internal class Textures { public static Texture2D Texture_3D(int cardCost, CardInfo info, PlayableCard card) { return TextureHelper.GetImageAsTexture($"LifeMoneyCost_{cardCost}.png", typeof(Plugin).Assembly, (FilterMode)0); } public static Texture2D Texture_Pixel(int cardCost, CardInfo info, PlayableCard card) { return Part2CardCostRender.CombineIconAndCount(cardCost, TextureHelper.GetImageAsTexture("LifeMoneyCost_pixel.png", typeof(Plugin).Assembly, (FilterMode)0)); } } } namespace LifeCost.Costs.LCost { internal class CardCanBePlayedByTurn2WithHand { public static bool CanBePlayed(int amount, CardInfo card, List hand) { return amount <= Plugin.configFairHandCostL.Value; } } internal class CostTier { public static int CostTierL(int amount) { return Mathf.FloorToInt((float)amount); } } public class LifeCost : CustomCardCost { public ResourceType ResourceType = (ResourceType)42; public override string CostName => "LifeCost"; public override bool CostSatisfied(int cardCost, PlayableCard card) { int num = Singleton.Instance.Balance + 4; if (cardCost > num) { return false; } return true; } public override string CostUnsatisfiedHint(int cardCost, PlayableCard card) { if (SaveManager.SaveFile.IsPart2) { return "You do not have enough [c:bG]Life[c:] on your scales to play that. Damage your opponent to gain more [c:bG]Life[c:]."; } string item = "Your [c:bG]Scales[c:] are too tipped to play [c:bG]" + ((Card)card).Info.DisplayedNameLocalized + "[c:]."; string item2 = "[c:bG]" + ((Card)card).Info.DisplayedNameLocalized + "[c:] requires you to pay in life, in which you can not fullfill without killing yourself."; string item3 = "You would kill yourself if you played [c:bG]" + ((Card)card).Info.DisplayedNameLocalized + "[c:]. Your [c:bG]Scales[c:] are too tipped"; List list = new List(); list.Add(item); list.Add(item2); list.Add(item3); return list[Random.Range(0, list.Count)]; } public override IEnumerator OnPlayed(int cardCost, PlayableCard card) { if (SaveManager.SaveFile.IsPart2) { yield return PayCost.extractCostPart2_lifeOnly(cardCost); } else { yield return PayCost.extractCostPart1_lifeOnly(cardCost); } } } internal class Textures { public static Texture2D Texture_3D(int cardCost, CardInfo info, PlayableCard card) { return TextureHelper.GetImageAsTexture($"LifeCost_{cardCost}.png", typeof(Plugin).Assembly, (FilterMode)0); } public static Texture2D Texture_Pixel(int cardCost, CardInfo info, PlayableCard card) { return Part2CardCostRender.CombineIconAndCount(cardCost, TextureHelper.GetImageAsTexture("LifeCost_pixel.png", typeof(Plugin).Assembly, (FilterMode)0)); } } } namespace LifeCost.Cards { public static class Leck { public static void AddCard() { string displayName = "Leck"; string description = "The Lost Beast, in the shape of a tooth, showing up only in error."; int attack = 5; int health = 1; int bloodCost = 0; int boneCost = 0; int energyCost = 0; List cardMetaCategories = new List(); List tribes = new List(); List abilities = new List(); List traits = new List(); Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("teck.png", typeof(Plugin).Assembly, (FilterMode)0); Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("pixel_teck.png", typeof(Plugin).Assembly, (FilterMode)0); Texture2D imageAsTexture3 = TextureHelper.GetImageAsTexture("teck_e.png", typeof(Plugin).Assembly, (FilterMode)0); Texture2D texture_base = imageAsTexture; Texture2D texture_emission = imageAsTexture3; Texture2D texture_pixel = imageAsTexture2; CardInfo val = CardUtils.CreateCardWithDefaultSettings("lifecost_Leck", displayName, attack, health, texture_base, texture_emission, cardMetaCategories, tribes, traits, abilities, texture_pixel, bloodCost, boneCost, energyCost); val.description = description; CardExtensions.SetCustomCost(val, "LifeCost", 4); CardManager.Add("lifecost", val); } } public static class Meck { public static void AddCard() { string displayName = "Meck"; string description = "The Lost Beast, in the shape of a tooth, showing up only in error."; int attack = 1; int health = 1; int bloodCost = 0; int boneCost = 0; int energyCost = 0; List cardMetaCategories = new List(); List tribes = new List(); List abilities = new List(); List traits = new List(); Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("teck.png", typeof(Plugin).Assembly, (FilterMode)0); Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("pixel_teck.png", typeof(Plugin).Assembly, (FilterMode)0); Texture2D imageAsTexture3 = TextureHelper.GetImageAsTexture("teck_e.png", typeof(Plugin).Assembly, (FilterMode)0); Texture2D texture_base = imageAsTexture; Texture2D texture_emission = imageAsTexture3; Texture2D texture_pixel = imageAsTexture2; CardInfo val = CardUtils.CreateCardWithDefaultSettings("lifecost_Meck", displayName, attack, health, texture_base, texture_emission, cardMetaCategories, tribes, traits, abilities, texture_pixel, bloodCost, boneCost, energyCost); val.description = description; CardExtensions.SetCustomCost(val, "MoneyCost", 1); CardManager.Add("lifecost", val); } } public static class Teck { public static void AddCard() { string displayName = "Teck"; string description = "The Lost Beast, in the shape of a tooth, showing up only in error."; int attack = 1; int health = 1; int bloodCost = 0; int boneCost = 0; int energyCost = 0; List cardMetaCategories = new List(); List tribes = new List(); List abilities = new List(); List traits = new List(); Texture2D imageAsTexture = TextureHelper.GetImageAsTexture("teck.png", typeof(Plugin).Assembly, (FilterMode)0); Texture2D imageAsTexture2 = TextureHelper.GetImageAsTexture("pixel_teck.png", typeof(Plugin).Assembly, (FilterMode)0); Texture2D imageAsTexture3 = TextureHelper.GetImageAsTexture("teck_e.png", typeof(Plugin).Assembly, (FilterMode)0); Texture2D texture_base = imageAsTexture; Texture2D texture_emission = imageAsTexture3; Texture2D texture_pixel = imageAsTexture2; CardInfo val = CardUtils.CreateCardWithDefaultSettings("lifecost_Teck", displayName, attack, health, texture_base, texture_emission, cardMetaCategories, tribes, traits, abilities, texture_pixel, bloodCost, boneCost, energyCost); val.description = description; CardExtensions.SetCustomCost(val, "LifeMoneyCost", 1); CardManager.Add("lifecost", val); } } } namespace LifeCost.Act2Experiment { internal class Act2Temple { [HarmonyPatch(typeof(CollectionUI), "Start")] public class AddLifeTab { public static void Postfix(ref CollectionUI __instance) { if (!Chainloader.PluginInfos.ContainsKey("mrfantastik.inscryption.infact2")) { AddTab(__instance); } } public static void AddTab(CollectionUI instance) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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) GameObject val = Object.Instantiate(((Component)((Component)instance).gameObject.transform.Find("MainPanel").Find("Tabs").Find("Tab_4")).gameObject); ((Object)val).name = "Tab_5"; val.transform.parent = ((Component)instance).gameObject.transform.Find("MainPanel").Find("Tabs"); val.transform.localPosition = new Vector3(-0.718f, 0.175f, 0f); ((TabbedUIPanel)instance).tabButtons.Add(val.GetComponent()); val.GetComponent().inputKey = (KeyCode)53; val.GetComponent().OnButtonDown = ((Component)((Component)instance).gameObject.transform.Find("MainPanel").Find("Tabs").Find("Tab_4")).gameObject.GetComponent().OnButtonDown; val.GetComponent().size = new Vector2(0.55f, 0.44f); ((Component)val.gameObject.transform.Find("Icon")).gameObject.GetComponent().sprite = CardUtils.getSprite("life_temple_tab.png"); } } [HarmonyPatch(typeof(CollectionUI), "CreatePages")] public class SortLifeCards { public static void Postfix(ref CollectionUI __instance, ref List> __result, ref List cards) { if (!Chainloader.PluginInfos.ContainsKey("mrfantastik.inscryption.infact2")) { __result = Test(__instance, __result, cards); } } public static List> Test(CollectionUI Instance, List> Result, List cards) { //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected I4, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Expected I4, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected I4, but got Unknown cards.Sort(delegate(CardInfo a, CardInfo b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_000e: Expected I4, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) int num10 = a.temple - b.temple; if (num10 != 0) { return num10; } int num11 = (a.metaCategories.Contains((CardMetaCategory)3) ? 1 : 0); int num12 = (b.metaCategories.Contains((CardMetaCategory)3) ? 1 : 0) - num11; if (num12 != 0) { return num12; } int num13 = a.CostTier - b.CostTier; if (num13 != 0) { return num13; } int num14 = a.BonesCost - b.BonesCost; if (num14 != 0) { return num14; } int num15 = ((a.GemsCost.Count == 1) ? ((int)a.GemsCost[0]) : 0); num15 = ((b.GemsCost.Count == 1) ? ((int)b.GemsCost[0]) : 0); int num16 = num15 - num15; if (num16 != 0) { return num16; } int num17 = a.DisplayedNameEnglish.CompareTo(b.DisplayedNameEnglish); return (num17 == 0) ? ((Object)a).name.CompareTo(((Object)b).name) : num17; }); cards = new List(cards); List toRemove = new List(); for (int i = 1; i < cards.Count; i++) { if (((Object)cards[i]).name == ((Object)cards[i - 1]).name) { toRemove.Add(cards[i]); } } cards.RemoveAll((CardInfo x) => toRemove.Contains(x)); List> list = new List>(); List AllBoons = new List(); int num = 0; for (int j = 0; j < cards.Count; j++) { int num2 = num / 8; if (num2 >= list.Count) { list.Add(new List()); } bool flag = false; if ((Object)(object)cards[j] != (Object)null && (cards[j].LifeCost() != 0 || cards[j].LifeMoneyCost() != 0 || cards[j].MoneyCost() != 0)) { flag = true; } if (flag) { num++; AllBoons.Add(cards[j]); list[num2].Add(cards[j]); } } cards.RemoveAll((CardInfo x) => AllBoons.Contains(x)); List> list2 = new List>(); list2.Add(new List()); Instance.tabPageIndices = new int[5]; for (int k = 0; k < Instance.tabPageIndices.Length; k++) { Instance.tabPageIndices[k] = 0; } for (int l = 0; l < cards.Count; l++) { List list3 = list2[list2.Count - 1]; if (l == 0) { int num3 = (int)cards[l].temple; for (int m = 0; m < num3; m++) { list2.Add(new List()); Instance.tabPageIndices[m + 1] = list2.IndexOf(list3) + 1; list3 = list2[list2.Count - 1]; } } list3.Add(cards[l]); bool flag2 = l == cards.Count - 1; if (flag2) { continue; } int num4 = (int)cards[l].temple; int num5 = (int)cards[l + 1].temple; int num6 = num5 - num4 - 1; for (int n = 0; n < num6; n++) { list2.Add(new List()); Instance.tabPageIndices[num4 + 1 + n] = list2.IndexOf(list3) + 1; list3 = list2[list2.Count - 1]; } bool flag3 = !flag2 && num4 != num5; if (list3.Count >= 8 || flag3) { list2.Add(new List()); if (flag3) { Instance.tabPageIndices[num5] = list2.IndexOf(list3) + 1; } } } for (int num7 = 0; num7 < Instance.tabPageIndices.Length; num7++) { if (num7 > 0 && Instance.tabPageIndices[num7] == 0) { list2.Add(new List()); Instance.tabPageIndices[num7] = list2.Count - 1; } } list2[list2.Count - 1] = list[0]; int num8 = list2.Count - 1; if (list.Count > 0) { for (int num9 = 1; num9 < list.Count; num9++) { list2.Add(list[num9]); } } Instance.tabPageIndices[4] = num8; return list2; } } } }