Decompiled source of P03 In Kaycees Mod v5.0.31
Infiniscryption.P03KayceeRun.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DigitalRuby.LightningBolt; using DiskCardGame; using DiskCardGame.CompositeRules; using GBC; using HarmonyLib; using Infiniscryption.Achievements; using Infiniscryption.P03KayceeRun.BattleMods; using Infiniscryption.P03KayceeRun.Cards; using Infiniscryption.P03KayceeRun.Cards.Multiverse; using Infiniscryption.P03KayceeRun.Cards.Stickers; using Infiniscryption.P03KayceeRun.CustomRules; using Infiniscryption.P03KayceeRun.Encounters; using Infiniscryption.P03KayceeRun.Faces; using Infiniscryption.P03KayceeRun.Helpers; using Infiniscryption.P03KayceeRun.Items; using Infiniscryption.P03KayceeRun.Patchers; using Infiniscryption.P03KayceeRun.Quests; using Infiniscryption.P03KayceeRun.Sequences; using Infiniscryption.P03SigilLibrary.Sigils; using Infiniscryption.PackManagement; using Infiniscryption.Spells.Patchers; using Infiniscryption.Spells.Sigils; using InscryptionAPI.Ascension; using InscryptionAPI.Card; using InscryptionAPI.Dialogue; using InscryptionAPI.Encounters; using InscryptionAPI.Guid; using InscryptionAPI.Helpers; using InscryptionAPI.Helpers.Extensions; using InscryptionAPI.Items; using InscryptionAPI.Items.Extensions; using InscryptionAPI.Regions; using InscryptionAPI.Resource; using InscryptionAPI.Saves; using InscryptionAPI.Slots; using InscryptionAPI.Sound; using InscryptionAPI.TalkingCards; using InscryptionAPI.TalkingCards.Create; using InscryptionAPI.TalkingCards.Helpers; using InscryptionAPI.Triggers; using Pixelplacement; using Pixelplacement.TweenSystem; using Sirenix.Serialization.Utilities; using Sirenix.Utilities; using Steamworks; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Infiniscryption.P03KayceeRun")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("P03 in Kaycee's Mod")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Infiniscryption.P03KayceeRun")] [assembly: AssemblyTitle("Infiniscryption.P03KayceeRun")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] public static class Tools { public static Assembly _assembly; public static GameObject Particle; public static Assembly CurrentAssembly => _assembly ?? (_assembly = Assembly.GetExecutingAssembly()); public static Texture2D LoadTexture(string name) { if (name == null) { return null; } return TextureHelper.GetImageAsTexture(name + (name.EndsWith(".png") ? "" : ".png"), CurrentAssembly, (FilterMode)0); } } namespace Infiniscryption.PackManagerP03Plugin { [BepInPlugin("zorro.inscryption.infiniscryption.deckeditor.p03plugin", "Deck Editor Patch - IT'S OKAY IF THIS PLUGIN FAILS TO LOAD!!", "2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class DeckEditorCompatPlugin : BaseUnityPlugin { public const string P03PluginGuid = "zorro.inscryption.infiniscryption.p03kayceerun"; public const string PluginGuid = "zorro.inscryption.infiniscryption.deckeditor.p03plugin"; public const string PluginName = "Deck Editor Patch - IT'S OKAY IF THIS PLUGIN FAILS TO LOAD!!"; public const string PluginVersion = "2.0"; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown Harmony val = new Harmony("zorro.inscryption.infiniscryption.deckeditor.p03plugin"); MethodInfo method = typeof(DeckEditor).GetMethod("GetAllAbilities", BindingFlags.Static | BindingFlags.NonPublic); MethodInfo method2 = typeof(DeckEditorCompatPlugin).GetMethod("AddAllKnownAbilities", BindingFlags.Static | BindingFlags.Public); ((BaseUnityPlugin)this).Logger.LogDebug((object)$"Deck editor fixer: Target Method {method}, Patch method {method2}"); val.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void AddAllKnownAbilities(ref List<Ability> __result) { __result = AbilityManager.AllAbilities.Select((FullAbility fab) => fab.Info.ability).ToList(); } } [BepInPlugin("zorro.inscryption.infiniscryption.packmanager.p03plugin", "Infiniscryption Pack Manager - P03 Plugin", "2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PackPlugin : BaseUnityPlugin { public const string P03PluginGuid = "zorro.inscryption.infiniscryption.p03kayceerun"; public const string PackPluginGuid = "zorro.inscryption.infiniscryption.packmanager"; public const string PluginGuid = "zorro.inscryption.infiniscryption.packmanager.p03plugin"; public const string PluginName = "Infiniscryption Pack Manager - P03 Plugin"; public const string PluginVersion = "2.0"; internal static ManualLogSource Log; public static CardTemple ScreenState { get { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) string value = ModdedSaveManager.SaveData.GetValue("zorro.inscryption.infiniscryption.p03kayceerun", "ScreenState"); return (CardTemple)((!string.IsNullOrEmpty(value)) ? ((int)(CardTemple)Enum.Parse(typeof(CardTemple), value)) : 0); } } private void Awake() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; PackInfo packInfo = PackManager.GetDefaultPackInfo((CardTemple)2); ((PackInfoBase)packInfo).ValidFor.Add((PackMetacategory)0); CardManager.ModifyCardList += delegate(List<CardInfo> cards) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 if ((int)ScreenState == 0 && PackManager.GetActivePacks().Contains(packInfo)) { foreach (CardInfo card in cards) { if ((int)card.temple == 2 && !card.metaCategories.Contains((CardMetaCategory)3) && card.metaCategories.Contains((CardMetaCategory)1)) { CardExtensions.AddMetaCategories(card, (CardMetaCategory[])(object)new CardMetaCategory[1]); } } } return cards; }; PackManager.TempleMetacategories[(CardTemple)2].Add(GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "NeutralRegionCards")); PackManager.TempleMetacategories[(CardTemple)2].Add(GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "WizardRegionCards")); PackManager.TempleMetacategories[(CardTemple)2].Add(GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "TechRegionCards")); PackManager.TempleMetacategories[(CardTemple)2].Add(GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "NatureRegionCards")); PackManager.TempleMetacategories[(CardTemple)2].Add(GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "UndeadRegionCards")); PackManager.AddProtectedMetacategory(GuidManager.GetEnumValue<CardMetaCategory>("zorro.inscryption.infiniscryption.p03kayceerun", "NewBeastTransformers")); PackManager.AddProtectedMetacategory(CustomCards.MultiverseAbility); PackInfo packInfo2 = PackManager.GetPackInfo("P03KCMXP1"); ((PackInfoBase)packInfo2).Title = "Kaycee's P03 Expansion Pack #1"; ((PackInfoBase)packInfo2).Description = "The first expansion pack from the developers of 'P03 in Kaycees Mod' adds [count] new cards across all four regions of Botopia."; ((PackInfoBase)packInfo2).ValidFor.Clear(); ((PackInfoBase)packInfo2).ValidFor.Add((PackMetacategory)1); ((PackInfoBase)packInfo2).SetTexture(TextureHelper.GetImageAsTexture("expansion1.png", typeof(PackPlugin).Assembly, (FilterMode)0)); PackInfo packInfo3 = PackManager.GetPackInfo("P03KCMXP2"); ((PackInfoBase)packInfo3).Title = "Kaycee's P03 Expansion Pack #2"; ((PackInfoBase)packInfo3).Description = "The second official expansion pack, with [count] firey new cards that command an explosive reaction!"; ((PackInfoBase)packInfo3).ValidFor.Clear(); ((PackInfoBase)packInfo3).ValidFor.Add((PackMetacategory)1); ((PackInfoBase)packInfo3).SetTexture(TextureHelper.GetImageAsTexture("PKCMexpansion2pack.png", typeof(PackPlugin).Assembly, (FilterMode)0)); EncounterPackInfo defaultPackInfo = PackManager.GetDefaultPackInfo<EncounterPackInfo>((CardTemple)2); ((PackInfoBase)defaultPackInfo).Title = "Inscryption: Rogue Bots of Botopia"; ((PackInfoBase)defaultPackInfo).Description = "Botopia has become overrun with rogue bots! These [count] encounters have been rebalanced for Kaycee's Mod."; ((PackInfoBase)defaultPackInfo).ValidFor.Clear(); ((PackInfoBase)defaultPackInfo).ValidFor.Add((PackMetacategory)1); ((PackInfoBase)defaultPackInfo).SetTexture(TextureHelper.GetImageAsTexture("p03_encounter_pack.png", typeof(PackPlugin).Assembly, (FilterMode)0)); EncounterPackInfo packInfo4 = PackManager.GetPackInfo<EncounterPackInfo>("P03KCMXP1"); ((PackInfoBase)packInfo4).Title = "Kaycee's P03 Encounter Expansion #1"; ((PackInfoBase)packInfo4).Description = "[count] additional encounters that feature cards from the first official P03 expansion pack."; ((PackInfoBase)packInfo4).ValidFor.Clear(); ((PackInfoBase)packInfo4).ValidFor.Add((PackMetacategory)1); ((PackInfoBase)packInfo4).SetTexture(TextureHelper.GetImageAsTexture("p03_encounter_pack1.png", typeof(PackPlugin).Assembly, (FilterMode)0)); EncounterPackInfo packInfo5 = PackManager.GetPackInfo<EncounterPackInfo>("P03KCMXP2"); ((PackInfoBase)packInfo5).Title = "Kaycee's P03 Encounter Expansion #2"; ((PackInfoBase)packInfo5).Description = "[count] additional encounters that feature cards from the second official P03 expansion pack."; ((PackInfoBase)packInfo5).ValidFor.Clear(); ((PackInfoBase)packInfo5).ValidFor.Add((PackMetacategory)1); ((PackInfoBase)packInfo5).SetTexture(TextureHelper.GetImageAsTexture("p03_encounter_pack2.png", typeof(PackPlugin).Assembly, (FilterMode)0)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Infiniscryption Pack Manager - P03 Plugin is loaded!"); } } } namespace Infiniscryption.P03KayceeRun { [BepInPlugin("zorro.inscryption.infiniscryption.p03kayceerun", "Infiniscryption P03 in Kaycee's Mod", "5.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class P03Plugin : BaseUnityPlugin { public const string PluginGuid = "zorro.inscryption.infiniscryption.p03kayceerun"; public const string PluginName = "Infiniscryption P03 in Kaycee's Mod"; public const string PluginVersion = "5.0"; public const string CardPrefx = "P03KCM"; internal static P03Plugin Instance; internal static ManualLogSource Log; internal static bool Initialized; internal string DebugCode => ((BaseUnityPlugin)this).Config.Bind<string>("P03KayceeMod", "DebugCode", "nothing", new ConfigDescription("A special code to use for debugging purposes only. Don't change this unless your name is DivisionByZorro or he told you how it works.", (AcceptableValueBase)null, Array.Empty<object>())).Value; internal bool SkipCanvasFace => ((BaseUnityPlugin)this).Config.Bind<bool>("P03KayceeMod", "SkipCanvasFace", true, new ConfigDescription("If True, skips the creation of the face for the Unfinished Boss. You can change this if you really want to change his face.", (AcceptableValueBase)null, Array.Empty<object>())).Value; internal string SecretCardComponents => ((BaseUnityPlugin)this).Config.Bind<string>("P03KayceeMod", "SecretCardComponents", "nothing", new ConfigDescription("The secret code for the secret card", (AcceptableValueBase)null, Array.Empty<object>())).Value; internal bool TurboMode => DebugCode.ToLowerInvariant().Contains("turbomode"); private void Awake() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)("Debug code = " + DebugCode)); Harmony val = new Harmony("zorro.inscryption.infiniscryption.p03kayceerun"); val.PatchAll(); DialogueManagement.TrackForTranslation = true; Type[] types = typeof(P03Plugin).Assembly.GetTypes(); foreach (Type type in types) { try { RuntimeHelpers.RunClassConstructor(type.TypeHandle); } catch (TypeLoadException ex) { Log.LogWarning((object)"Failed to force load static constructor!"); Log.LogWarning((object)ex); } } DialogueManagement.AddSequenceDialogue(); CustomCards.RegisterCustomCards(val); MultiverseCards.CreateCards(); StarterDecks.RegisterStarterDecks(); AscensionChallengeManagement.UpdateP03Challenges(); BossManagement.RegisterBosses(); DefaultQuestDefinitions.DefineAllQuests(); EncounterHelper.BuildEncounters(); MultiverseEncounters.CreateMultiverseEncounters(); DialogueManagement.TrackForTranslation = false; DialogueManagement.ResolveCurrentTranslation(); CustomCards.printAllCards(); SceneManager.sceneLoaded += OnSceneLoaded; Initialized = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Infiniscryption P03 in Kaycee's Mod is loaded and ready to go!"); } [MethodImpl(MethodImplOptions.NoInlining)] private void FixDeckEditor() { BaseUnityPlugin instance = Chainloader.PluginInfos["inscryption_deckeditor"].Instance; Traverse.Create((object)((instance is DeckEditor) ? instance : null)).Field("save").SetValue((object)SaveManager.SaveFile); } private void OnDestroy() { AudioHelper.FlushAudioClipCache(); AssetBundleManager.CleanUp(); } public void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (Chainloader.PluginInfos.ContainsKey("inscryption_deckeditor")) { FixDeckEditor(); } CardManager.SyncCardList(); AbilityManager.SyncAbilityList(); EncounterManager.SyncEncounterList(); } } } namespace Infiniscryption.P03KayceeRun.Quests { [HarmonyPatch] internal static class DefaultQuestDefinitions { public const int RADIO_TURNS = 5; public const int POWER_TURNS = 4; public const int BURNED_CARDS = 3; internal static QuestDefinition TippedScales { get; private set; } internal static QuestDefinition WhiteFlag { get; private set; } internal static QuestDefinition DeckSize { get; private set; } internal static QuestDefinition Smuggler { get; private set; } internal static QuestDefinition SmugglerPartTwo { get; private set; } internal static QuestDefinition Donation { get; private set; } internal static QuestDefinition DonationPartTwo { get; private set; } internal static QuestDefinition FullyUpgraded { get; private set; } internal static QuestDefinition ILoveBones { get; private set; } internal static QuestDefinition ListenToTheRadio { get; private set; } internal static QuestDefinition PowerUpTheTower { get; private set; } internal static QuestDefinition Pyromania { get; private set; } internal static QuestDefinition Conveyors { get; private set; } internal static QuestDefinition BombBattles { get; private set; } internal static QuestDefinition BountyTarget { get; private set; } internal static QuestDefinition LeapBotNeo { get; private set; } internal static QuestDefinition TrainingDummy { get; private set; } internal static QuestDefinition DredgerBattle { get; private set; } internal static QuestDefinition LibrarianPaperwork { get; private set; } internal static QuestDefinition KayceesFriend { get; private set; } internal static QuestDefinition KayceesFriendPartTwo { get; private set; } internal static QuestDefinition TrapperPelts { get; private set; } internal static QuestDefinition TraderPelts { get; private set; } internal static QuestDefinition Rebecha { get; private set; } internal static QuestDefinition FindGoobert { get; private set; } internal static QuestDefinition Prospector { get; private set; } internal static QuestDefinition BrokenGenerator { get; private set; } internal static bool TalkingCardPriorityCheck { get { if (P03Plugin.Instance.DebugCode.ToLowerInvariant().Contains("talking")) { return true; } float num = 0.1f; num += 0.1f * (float)((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Count((CardInfo ci) => ci.appearanceBehaviour.Contains((Appearance)10)); return SeededRandom.Value(P03AscensionSaveData.RandomSeed) < num; } } internal static int DeckSizeTarget { get { int valueAsInt = P03AscensionSaveData.RunStateData.GetValueAsInt("zorro.inscryption.infiniscryption.p03kayceerun", "DeckSizeTarget"); if (valueAsInt > 0) { return valueAsInt; } valueAsInt = ((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Count + 2; P03AscensionSaveData.RunStateData.SetValue("zorro.inscryption.infiniscryption.p03kayceerun", "DeckSizeTarget", (object)valueAsInt); return valueAsInt; } } internal static RunBasedHoloMap.Zone GoobertDropoffZone { get { string value = P03AscensionSaveData.RunStateData.GetValue("zorro.inscryption.infiniscryption.p03kayceerun", "Dropoff"); if (!string.IsNullOrEmpty(value)) { return (RunBasedHoloMap.Zone)Enum.Parse(typeof(RunBasedHoloMap.Zone), value); } List<RunBasedHoloMap.Zone> list = new List<RunBasedHoloMap.Zone> { RunBasedHoloMap.Zone.Magic, RunBasedHoloMap.Zone.Nature, RunBasedHoloMap.Zone.Tech, RunBasedHoloMap.Zone.Undead }; list.Remove(EventManagement.CurrentZone); RunBasedHoloMap.Zone zone = list[SeededRandom.Range(0, list.Count, P03AscensionSaveData.RandomSeed)]; P03AscensionSaveData.RunStateData.SetValue("zorro.inscryption.infiniscryption.p03kayceerun", "Dropoff", (object)zone); return zone; } } internal static void DefineAllQuests() { //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_0bb3: Unknown result type (might be due to invalid IL or missing references) //IL_0c73: Unknown result type (might be due to invalid IL or missing references) //IL_0c78: Unknown result type (might be due to invalid IL or missing references) //IL_0c79: Unknown result type (might be due to invalid IL or missing references) //IL_0c88: Unknown result type (might be due to invalid IL or missing references) //IL_0c8f: Unknown result type (might be due to invalid IL or missing references) //IL_0c9c: Expected O, but got Unknown //IL_0d49: Unknown result type (might be due to invalid IL or missing references) //IL_0d6f: Unknown result type (might be due to invalid IL or missing references) //IL_0fd2: Unknown result type (might be due to invalid IL or missing references) TippedScales = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Tipped Scales").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Rags, (FigurineType)0)).SetGenerateCondition(() => EventManagement.CompletedZones.Count <= 2); TippedScales.AddDialogueState("TOO EASY...", "P03TooEasyQuest").AddDialogueState("TOO EASY...", "P03TooEasyAccepted").AddDefaultActiveState("KEEP GOING...", "P03TooEasyInProgress", 3) .AddDialogueState("IMPRESSIVE...", "P03TooEasyComplete") .AddGainAbilitiesReward(1, (Ability)14); WhiteFlag = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "White Flag").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Cyclops, (FigurineType)0)); WhiteFlag.AddDialogueState("DO THEY GIVE UP?", "P03WhiteFlagSetup").AddDefaultActiveState("DO THEY GIVE UP?", "P03WhiteFlagSetup", 1).AddDialogueState("THEY DO GIVE UP", "P03WhiteFlagReward") .AddGainCardReward("P03KCM_Draft_Token_Uncommon"); DeckSize = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Deck Size").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Goggles, (FigurineType)7)); DeckSize.AddDialogueState("ITS TOO SMALL", "P03DeckSizeSetup").AddSuccessAction(delegate { int deckSizeTarget = DeckSizeTarget; }).AddNamedState("waiting", "ITS TOO SMALL", "P03DeckSizeSetup") .SetDynamicStatus(() => (((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Count < DeckSizeTarget) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success) .AddDialogueState("ITS JUST RIGHT", "P03DeckSizeReward") .AddDynamicMonetaryReward(); Smuggler = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Smuggler").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Wirehead, (FigurineType)6)); Smuggler.AddDialogueState("SSH - COME OVER HERE", "P03SmugglerSetup").AddDialogueState("LETS DO THIS", "P03SmugglerAccepted").AddGainCardReward("P03KCM_CONTRABAND"); SmugglerPartTwo = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "SmugglerPartTwo").SetPriorQuest(Smuggler).OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Wirehead, (FigurineType)6)); QuestState questState = SmugglerPartTwo.AddDummyStartingState(() => ((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Any((CardInfo c) => ((Object)c).name.Equals("P03KCM_CONTRABAND"))); questState.SetNextState(QuestState.QuestStateStatus.Success, "SSH - BRING IT HERE", "P03SmugglerComplete", autoComplete: true).AddLoseCardReward("P03KCM_CONTRABAND").AddGainCardReward("P03KCM_Draft_Token_Uncommon"); questState.SetNextState(QuestState.QuestStateStatus.Failure, "WHERE DID IT GO?", "P03SmugglerFailed", autoComplete: true); Donation = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Donation").QuestCannotContinueAcrossMap().OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Fishhead, (FigurineType)1)); Donation.AddDialogueState("SPARE SOME CASH?", "P03DonationIntro").AddNamedState("CheckingForAvailableCash", "SPARE SOME CASH?", "P03DonationNotEnough").SetDynamicStatus(() => (Part3SaveData.Data.currency < 10) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success) .AddDialogueState("SPARE SOME CASH?", "P03DonationComplete") .AddMonetaryReward(-10); DonationPartTwo = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "DonationPartTwo").SetPriorQuest(Donation).OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Fishhead, (FigurineType)0) { faceCode = "2-12-7" }); DonationPartTwo.AddDialogueState("THANK YOU!", "P03DonationReward").AddGemifyCardsReward(2); FullyUpgraded = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Fully Upgraded").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.BuildABot, (FigurineType)7)).SetGenerateCondition(() => EventManagement.CompletedZones.Count >= 3); FullyUpgraded.AddDialogueState("SHOW ME POWER", "P03FullyUpgradedFail").SetDynamicStatus(() => (!((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Any((CardInfo c) => c.HasAbility((Ability)61) && c.HasAbility(NewPermaDeath.AbilityID) && c.Gemified)) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success).AddDialogueState("SHOW ME POWER", "P03FullyUpgradedSuccess") .AddDynamicMonetaryReward(); ILoveBones = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "I Love Bones").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Faceless, (FigurineType)6)); ILoveBones.SetRegionCondition(RunBasedHoloMap.Zone.Undead).AddState("I LOVE BONES!!", "P03ILoveBones").SetDynamicStatus(() => (((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Where((CardInfo c) => c.HasAbility((Ability)35) || c.HasAbility((Ability)55) || c.HasAbility(NewPermaDeath.AbilityID)).Count() < 3) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success) .AddDialogueState("I LOVE BONES!!!!", "P03ILoveBonesSuccess") .AddGainCardReward("P03KCM_SKELETON_LORD"); ListenToTheRadio = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Listen To The Radio").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Creepface, (FigurineType)0)); QuestState parent = ListenToTheRadio.AddDialogueState("LETS DO SCIENCE", "P03RadioQuestStart").AddDialogueState("LETS DO SCIENCE", "P03RadioQuestAccepted").AddGainCardReward("P03KCM_RADIO_TOWER") .AddDefaultActiveState("LETS DO SCIENCE", "P03RadioQuestInProgress") .SetDynamicStatus(() => (ListenToTheRadio.GetQuestCounter() >= 5) ? QuestState.QuestStateStatus.Success : (((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Any((CardInfo c) => ((Object)c).name == "P03KCM_RADIO_TOWER") ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Failure)); parent.AddDialogueState("YOU BROKE IT?!", "P03RadioQuestFailed", QuestState.QuestStateStatus.Failure); parent.AddDialogueState("A WIN FOR SCIENCE", "P03RadioQuestSucceeded").AddLoseCardReward("P03KCM_RADIO_TOWER").AddGainCardReward("P03KCM_Draft_Token_Uncommon"); PowerUpTheTower = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Power Up The Tower").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Pipehead, (FigurineType)7)); QuestState parent2 = PowerUpTheTower.AddDialogueState("LOOKING FOR A JOB?", "P03PowerQuestStart").AddDialogueState("LOOKING FOR A JOB?", "P03PowerQuestAccepted").AddGainCardReward("P03KCM_POWER_TOWER") .AddDefaultActiveState("GET BACK TO WORK", "P03PowerQuestInProgress") .SetDynamicStatus(() => (PowerUpTheTower.GetQuestCounter() >= 4) ? QuestState.QuestStateStatus.Success : (((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Any((CardInfo c) => ((Object)c).name == "P03KCM_POWER_TOWER") ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Failure)); parent2.AddDialogueState("YOU BROKE IT?!", "P03PowerQuestFailed", QuestState.QuestStateStatus.Failure); parent2.AddDialogueState("HERE'S YOUR PAYMENT", "P03PowerQuestSucceeded").AddLoseCardReward("P03KCM_POWER_TOWER").AddDynamicMonetaryReward(low: true) .AddGainItemReward(((Object)ShockerItem.ItemData).name); FindGoobert = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "FindGoobert").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.PikeMageSolo, CompositeFigurineManager.PikeMage)); QuestState parent3 = FindGoobert.AddDialogueState("MY FRIEND IS LOST", "P03WhereIsGoobert").AddNamedState("GoobertAvailable", "MY FRIEND IS LOST", "P03WhereIsGoobert"); parent3.AddDialogueState("MY FRIEND IS LOST", "P03DidNotBuyGoobert", QuestState.QuestStateStatus.Failure); QuestState questState2 = parent3.AddNamedState("CarryingGoobert", "YOU FOUND HIM!", () => $"P03FoundGoobert{GoobertDropoffZone}"); questState2.SetDynamicStatus(() => (!Part3SaveData.Data.items.Any((string item) => ((Object)GoobertHuh.ItemData).name.ToLowerInvariant() == item.ToLowerInvariant())) ? QuestState.QuestStateStatus.Failure : ((EventManagement.CurrentZone != GoobertDropoffZone) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success)); questState2.AddDialogueState("MY FRIEND IS LOST", "P03LostGoobert", QuestState.QuestStateStatus.Failure); questState2.AddDialogueState("YOU FOUND HIM!", "P03GoobertHome").AddLoseItemReward(((Object)GoobertHuh.ItemData).name).AddGainItemReward(((Object)LifeItem.ItemData).name) .AddMonetaryReward(13); Prospector = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "The Prospector").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Prospector, (FigurineType)4)); QuestState parent4 = Prospector.AddState("GOLD!", "P03ProspectorWantGold").SetDynamicStatus(() => (!((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Any((CardInfo c) => ((Object)c).name == "P03KCM_BOUNTYBRAIN")) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success).AddDialogueState("GOLD!", "P03ProspectorPrepareGold") .AddNamedState("DoubleCheckHasBrain", "GOLD!", "P03ProspectorPrepareGold") .SetDynamicStatus(() => (!((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Any((CardInfo c) => ((Object)c).name == "P03KCM_BOUNTYBRAIN")) ? QuestState.QuestStateStatus.Failure : QuestState.QuestStateStatus.Success); parent4.AddDialogueState("NO GOLD?", "P03ProspectorNoMoreGold", QuestState.QuestStateStatus.Failure); parent4.AddDialogueState("GOLD!!!", "P03ProspectorReplaceGold").AddLoseCardReward("P03KCM_BOUNTYBRAIN").AddGainCardReward("P03KCM_BOUNTY_SPAWNER"); BrokenGenerator = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Broken Generator").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.InspectorSolo, (FigurineType)3, (FigurineType)0, (FigurineType)7)); QuestState parent5 = BrokenGenerator.AddState("HELP!", "P03DamageRaceIntro"); parent5.AddDialogueState("OH NO...", "P03DamageRaceFailed", QuestState.QuestStateStatus.Failure); parent5.AddDialogueState("PHEW!", "P03DamageRaceSuccess").AddDynamicMonetaryReward(low: true); Pyromania = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Pyromania").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Pyromaniac, (FigurineType)5)); Pyromania.SetGenerateCondition(() => ((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Where((CardInfo c) => c.Abilities.Any((Ability a) => AbilitiesUtil.GetInfo(a).metaCategories.Contains(BurningSlotBase.FlamingAbility))).Count() >= 2).AddDialogueState("BURN BABY BURN", "P03PyroQuestStart").AddDefaultActiveState("BURN BABY BURN", "P03PyroQuestInProgress") .WaitForQuestCounter(3) .AddDialogueState("SO SATISFYING...", "P03PyroQuestComplete") .AddGainCardReward("P03KCMXP2_FlameCharmer"); BurningSlotBase.FireDamageTrigger += delegate(int damage, PlayableCard card) { if (card.Health == 1) { Pyromania.IncrementQuestCounter(1, onlyIfActive: true); } }; Conveyors = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Conveyors").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Steambot, (FigurineType)7)); Conveyors.SetGenerateCondition(() => EventManagement.CompletedZones.Count < 3 && !AscensionSaveData.Data.ChallengeIsActive(AscensionChallengeManagement.ALL_CONVEYOR)).AddDialogueState("CONVEYOR FIELD TRIALS", "P03ConveyorQuestStart").AddDialogueState("START FIELD TRIALS?", "P03ConveyorQuestStarting") .AddDefaultActiveState("FIELD TRIALS IN PROGRESS", "P03ConveyorQuestActive") .WaitForQuestCounter(3) .AddDialogueState("FIELD TRIALS COMPLETE", "P03ConveyorQuestComplete") .AddDynamicMonetaryReward() .AddGainItemReward(((Object)WiseclockItem.ItemData).name); BombBattles = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "BombBattles").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.MrsBomb, (FigurineType)7)); BombBattles.SetGenerateCondition(() => EventManagement.CompletedZones.Count < 3 && !AscensionSaveData.Data.ChallengeIsActive(AscensionChallengeManagement.BOMB_CHALLENGE)).AddDialogueState("BOOM BOOM BOOM", "P03BombQuestStart").AddDialogueState("LET'S BLOW IT UP", "P03BombQuestStarting") .AddDefaultActiveState("KEEP UP THE BOOM", "P03BombQuestActive") .WaitForQuestCounter(3) .AddDialogueState("TRULY EXPLOSIVE", "P03BombQuestComplete") .AddDynamicMonetaryReward() .AddGainItemReward("BombRemote"); BountyTarget = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "BountyTarget").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.BountyHunter, (FigurineType)0)); BountyTarget.SetGenerateCondition(() => EventManagement.CompletedZones.Count < 3).AddDialogueState("CATCH A FUGITIVE?", "P03BountyQuestIntro").AddDialogueState("LET'S CATCH A FUGITIVE?!", "P03BountyQuestStarted") .AddDefaultActiveState("LET'S GET HIM!", "P03BountyQuestInProgress") .AddDialogueState("YOU GOT HIM!", "P03BountyQuestComplete") .AddDynamicMonetaryReward(low: true) .AddGainCardReward("P03KCM_Draft_Token+Sniper"); LeapBotNeo = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "LeapBotNeo").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.Leapbot, (FigurineType)7)); QuestState parent6 = LeapBotNeo.SetGenerateCondition(generateLBNQuest).SetMustBeGeneratedCondition(generateLBNQuest).GenerateAwayFromStartingArea() .AddDummyStartingState(() => ((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Any((CardInfo c) => ((Object)c).name == "LeapBot") ? QuestState.QuestStateStatus.Success : QuestState.QuestStateStatus.Failure); parent6.AddDialogueState("DISAPPOINTING", "P03LeapBotQuestFailed", QuestState.QuestStateStatus.Failure); parent6.AddDialogueState("ITS GLORIOUS", "P03LeapBotQuest").AddReward(new QuestRewardTransformCard { CardName = "LeapBot", TransformIntoCardName = "P03KCMXP2_LeapBotNeo" }); TrainingDummy = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "TrainingDummy").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.DummySolo, CompositeFigurineManager.TrainingDummy)); TrainingDummy.SetGenerateCondition(() => EventManagement.CurrentZone == RunBasedHoloMap.Zone.Magic).SetPriorityCalculation(() => (!TalkingCardPriorityCheck) ? 1 : 10).AddDialogueState("...", "DummyData") .AddDialogueState("...", "DummyDataTwo") .AddDialogueState("...", "DummyDataThree") .AddGainCardReward("P03KCM_TRAINING_DUMMY"); DredgerBattle = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "DredgerBattle").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.DredgerSolo, (FigurineType)7)); CardBattleNodeData data = new CardBattleNodeData { specialBattleId = BossBattleSequencer.GetSequencerIdForBoss(BossManagement.DredgerOpponent), difficulty = 0, blueprint = EncounterHelper.DredgerBattle }; QuestState parent7 = DredgerBattle.SetGenerateCondition(() => EventManagement.CurrentZone == RunBasedHoloMap.Zone.Tech).SetPriorityCalculation(() => (!TalkingCardPriorityCheck) ? 1 : 10).AddDialogueState("OY MATEY", "DredgerQuestStart") .AddSpecialNodeState("LET'S FIGHT", (NodeData)(object)data); parent7.AddDialogueState("GOOD GAME", "DredgerReward").AddGainCardReward(TalkingCardMelter.Name); parent7.AddDialogueState("TOO BAD", "DredgerNoReward", QuestState.QuestStateStatus.Failure); KayceesFriend = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "KayceesFriend").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.KayceeSolo, CompositeFigurineManager.Kaycee)); LibrarianPaperwork = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "LibrarianPaperwork").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.LibrariansSolo, CompositeFigurineManager.None)); LibrarianPaperwork.SetPartnerQuest(KayceesFriend.EventId).SetAllowLandmarks().QuestCannotContinueAcrossMap() .SetValidRoomCondition((HoloMapBlueprint bp) => (bp.specialTerrain & 0x400) != 0) .AddPostGenerationAction(delegate(GameObject go) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) go.transform.localPosition = new Vector3(-0.9469f, 1.1f, 0.6946f); }); KayceesFriend.SetGenerateCondition(() => EventManagement.CurrentZone == RunBasedHoloMap.Zone.Undead).QuestCannotContinueAcrossMap().SetPriorityCalculation(() => (!TalkingCardPriorityCheck) ? 1 : 10); QuestState parent8 = KayceesFriend.AddDialogueState("BRRRRR", "KayceeQuestStart").AddDefaultActiveState("F-FIND HIM", "KayceeQuestWaiting").SetDynamicStatus(delegate { if (!LibrarianPaperwork.IsCompleted) { return QuestState.QuestStateStatus.Active; } return ((CardCollectionInfo)Part3SaveData.Data.deck).CardInfos.Any((CardInfo ci) => ((Object)ci).name.Equals(TalkingCardSawyer.Name)) ? QuestState.QuestStateStatus.Success : QuestState.QuestStateStatus.Failure; }); parent8.AddDialogueState("HOORAY!", "KayceeQuestSuccess").SetDynamicStatus(() => QuestState.QuestStateStatus.Active); parent8.AddDialogueState("OH NO", "KayceeQuestFailed", QuestState.QuestStateStatus.Failure); QuestState parent9 = LibrarianPaperwork.AddState("QUIET", "LibrarianQuestShhh").SetDynamicStatus(() => (KayceesFriend.InitialState.Status != QuestState.QuestStateStatus.Success) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success).AddDialogueState("YOU WANT HIM BACK?", "LibrarianQuestStart") .AddGainCardReward("P03KCM_PAPERWORK_A") .AddGainCardReward("P03KCM_PAPERWORK_B") .AddGainCardReward("P03KCM_PAPERWORK_C") .AddDefaultActiveState("FILE THE PAPERS", "LibrarianQuestWaiting") .SetDynamicStatus(delegate { if (((CardCollectionInfo)Part3SaveData.Data.deck).CardInfos.Where((CardInfo ci) => FilePaperworkInOrder.ALL_PAPERWORK.Contains(((Object)ci).name)).Count() < 3) { return QuestState.QuestStateStatus.Failure; } return (FilePaperworkStamp.StampedPaperwork.Count < 3) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success; }); parent9.AddDialogueState("IT IS COMPLETE", "LibrarianQuestSuccess").AddLoseCardReward("P03KCM_PAPERWORK_A").AddLoseCardReward("P03KCM_PAPERWORK_B") .AddLoseCardReward("P03KCM_PAPERWORK_C") .AddGainCardReward(TalkingCardSawyer.Name); parent9.AddDialogueState("YOU FAILED", "LibrarianQuestFailed", QuestState.QuestStateStatus.Failure); KayceesFriendPartTwo = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "KayceesFriendContinue").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.KayceeSolo, CompositeFigurineManager.Kaycee)); KayceesFriendPartTwo.SetGenerateCondition(() => false).SetMustBeGeneratedCondition(() => LibrarianPaperwork.QuestGenerated && !LibrarianPaperwork.IsCompleted && ((CardCollectionInfo)Part3SaveData.Data.deck).CardInfos.Any((CardInfo ci) => FilePaperworkInOrder.ALL_PAPERWORK.Contains(((Object)ci).name)) && EventManagement.CurrentZone != RunBasedHoloMap.Zone.Undead); QuestState parent10 = KayceesFriendPartTwo.AddState("H-HURRY", "KayceeQuestTwoActive").SetDynamicStatus(delegate { if (((CardCollectionInfo)Part3SaveData.Data.deck).CardInfos.Where((CardInfo ci) => FilePaperworkInOrder.ALL_PAPERWORK.Contains(((Object)ci).name)).Count() < 3) { return QuestState.QuestStateStatus.Failure; } return (FilePaperworkStamp.StampedPaperwork.Count < 3) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success; }); parent10.AddDialogueState("HOORAY!", "KayceeQuestTwoSuccess").AddLoseCardReward("P03KCM_PAPERWORK_A").AddLoseCardReward("P03KCM_PAPERWORK_B") .AddLoseCardReward("P03KCM_PAPERWORK_C") .AddDefaultActiveState("BRB", "KayceeQuestTwoWaiting") .WaitForQuestCounter(1) .AddDialogueState("I'M BACK!", "KayceeQuestTwoFinal") .AddGainCardReward(TalkingCardSawyer.Name); parent10.AddDialogueState("OH NO", "KayceeQuestFailed", QuestState.QuestStateStatus.Failure); TrapperPelts = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "TrapperPelts").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.TrapperSolo, (FigurineType)3, (FigurineType)2, (FigurineType)2)); TrapperPelts.SetGenerateCondition(() => EventManagement.CurrentZone == RunBasedHoloMap.Zone.Nature).QuestCannotContinueAcrossMap().SetPriorityCalculation(() => (!TalkingCardPriorityCheck) ? 1 : 10) .AddDialogueState("PELTS PELTS PELTS", "TrapperQuestStart") .AddDialogueState("PELTS PELTS PELTS", "TrapperQuestContinue") .AddDefaultActiveState("FIND MY TRAPS", "TrapperQuestActive") .SetDynamicStatus(() => (Part3SaveData.Data.pelts < 4) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Failure) .AddDialogueState("PELTS!", "TrapperQuestComplete", QuestState.QuestStateStatus.Failure); TraderPelts = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "TraderPelts").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.TraderSolo, (FigurineType)3, (FigurineType)2, (FigurineType)2)); TraderPelts.SetPartnerQuest(TrapperPelts.EventId).QuestCannotContinueAcrossMap().SetValidRoomCondition((HoloMapBlueprint bp) => bp.color == 3) .AddState("PELTS?", "TraderNoPelts") .SetDynamicStatus(() => (Part3SaveData.Data.pelts == 0) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success) .AddDialogueState("A FINE PELT", "TraderFinePelt", QuestState.QuestStateStatus.Success, "BuyFirstPelt") .AddMonetaryReward(1) .AddDialogueState("PELTS?", "TraderNoPelts", QuestState.QuestStateStatus.Success, "WaitForSecondPelt") .SetDynamicStatus(() => (Part3SaveData.Data.pelts <= 1) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success) .AddDialogueState("A FINE PELT", "TraderFinePelt", QuestState.QuestStateStatus.Success, "BuySecondPelt") .AddMonetaryReward(2) .AddDialogueState("PELTS?", "TraderNoPelts", QuestState.QuestStateStatus.Success, "WaitForThirdPelt") .SetDynamicStatus(() => (Part3SaveData.Data.pelts <= 2) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success) .AddDialogueState("A FINE PELT", "TraderFinePelt", QuestState.QuestStateStatus.Success, "BuyThirdPelt") .AddMonetaryReward(2) .AddDialogueState("PELTS?", "TraderNoPelts", QuestState.QuestStateStatus.Success, "WaitForFourthPelt") .SetDynamicStatus(() => (Part3SaveData.Data.pelts <= 3) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success) .AddDialogueState("A VERY FINE PELT", "TraderVeryFinePelt", QuestState.QuestStateStatus.Success, "BuyFourthPelt") .AddGainCardReward("Angler_Talking"); Rebecha = QuestManager.Add("zorro.inscryption.infiniscryption.p03kayceerun", "Rebecha").OverrideNPCDescriptor(new NPCDescriptor(P03ModularNPCFace.FaceSet.RebechaSolo, (FigurineType)3, (FigurineType)4, (FigurineType)3)); Rebecha.SetGenerateCondition(() => false).AddState("IT'S BROKEN", "RebechaZeroComplete").SetDynamicStatus(() => (EventManagement.CompletedZones.Count == 0) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success) .AddNamedState("RebechaPhaseTwo", "IT'S STILL BROKEN", "RebechaOneComplete") .SetDynamicStatus(() => (EventManagement.CompletedZones.Count == 1) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Failure) .AddDialogueState("IT'S FIXED", "RebechaFullyOpen", QuestState.QuestStateStatus.Failure); static bool generateLBNQuest() { return LeapBotNeo.GetQuestCounter() > 7 && ((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Any((CardInfo c) => ((Object)c).name == "LeapBot"); } } [HarmonyPatch(typeof(HoloMapPeltMinigame), "Start")] [HarmonyPrefix] private static bool OnlyIfQuestActive(HoloMapPeltMinigame __instance) { if (!P03AscensionSaveData.IsP03Run) { return true; } if (!TrapperPelts.IsDefaultActive()) { ((Component)__instance).gameObject.SetActive(false); return false; } return true; } } public class NPCDescriptor { public string faceCode; public FigurineType head; public FigurineType arms; public FigurineType body; private static readonly Dictionary<string, Face> ANIMATED_FACES = new Dictionary<string, Face> { { $"{19}-{19}-{19}", (Face)44 }, { $"{18}-{18}-{18}", (Face)24 }, { $"{20}-{20}-{20}", (Face)1 }, { $"{21}-{21}-{21}", (Face)35 }, { $"{22}-{22}-{22}", (Face)25 }, { $"{23}-{23}-{23}", (Face)21 }, { $"{26}-{26}-{26}", (Face)23 } }; public Face P03Face { get { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (ANIMATED_FACES.ContainsKey(faceCode)) { return ANIMATED_FACES[faceCode]; } return P03ModularNPCFace.ModularNPCFace; } } public NPCDescriptor(P03ModularNPCFace.FaceSet face, FigurineType figureType) : this(face, figureType, figureType, figureType) { }//IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) public NPCDescriptor(P03ModularNPCFace.FaceSet face, FigurineType headPart, FigurineType armsPart, FigurineType bodyPart) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) faceCode = $"{(int)face}-{(int)face}-{(int)face}"; head = headPart; arms = armsPart; body = bodyPart; } public NPCDescriptor(string code) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //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) string[] array = code.Split(new char[1] { '|' }); faceCode = array[0]; head = (FigurineType)Enum.Parse(typeof(FigurineType), array[1]); arms = (FigurineType)Enum.Parse(typeof(FigurineType), array[2]); body = (FigurineType)Enum.Parse(typeof(FigurineType), array[3]); } public static NPCDescriptor GetDescriptorForNPC(SpecialEvent se) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) QuestDefinition questDefinition = QuestManager.Get(se); if (questDefinition.ForcedNPCDescriptor != null) { return questDefinition.ForcedNPCDescriptor; } string value = P03AscensionSaveData.RunStateData.GetValue("zorro.inscryption.infiniscryption.p03kayceerun", $"NPC{se}"); if (!string.IsNullOrEmpty(value)) { return new NPCDescriptor(value); } string text = P03ModularNPCFace.GeneratedNPCFaceCode(); int num = P03AscensionSaveData.RandomSeed + 350; FigurineType val = (FigurineType)SeededRandom.Range(0, 8, num++); FigurineType val2 = (FigurineType)SeededRandom.Range(0, 8, num++); FigurineType val3 = (FigurineType)SeededRandom.Range(0, 8, num++); string text2 = $"{text}|{val}|{val2}|{val3}"; P03AscensionSaveData.RunStateData.SetValue("zorro.inscryption.infiniscryption.p03kayceerun", $"NPC{se}", (object)text2); return new NPCDescriptor(text2); } public static IEnumerator SayDialogue(SpecialEvent questParent, string dialogueCode, bool switchViews = true, string[] variableStrings = null) { string faceCode = GetDescriptorForNPC(questParent).faceCode; P03ModularNPCFace.Instance.SetNPCFace(faceCode); View currentView = Singleton<ViewManager>.Instance.CurrentView; if (switchViews) { Singleton<ViewManager>.Instance.SwitchToView((View)33, false, false); yield return (object)new WaitForSeconds(0.1f); } P03AnimationController.Instance.SwitchToFace(P03ModularNPCFace.ModularNPCFace, true, true); yield return (object)new WaitForSeconds(0.1f); yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent(dialogueCode, (MessageAdvanceMode)1, (EventIntersectMode)0, variableStrings, (Action<Line>)null); yield return (object)new WaitForSeconds(0.1f); if (switchViews) { Singleton<ViewManager>.Instance.SwitchToView(currentView, false, false); yield return (object)new WaitForSeconds(0.15f); } } } public class QuestDefinition { public string ModGuid { get; private set; } public string QuestName { get; private set; } public SpecialEvent EventId { get; private set; } public NPCDescriptor ForcedNPCDescriptor { get; set; } public SpecialEvent PriorEventId { get; set; } = SpecialEvent.None; public SpecialEvent PartnerOfEventId { get; set; } = SpecialEvent.None; public QuestState InitialState { get; set; } public Func<bool> GenerateCondition { get; set; } public bool AllowSecretRoom { get; set; } = false; public bool AllowLandmarks { get; set; } = false; public bool QuestCanContinue { get; set; } = true; public Func<int> CalculatedPriority { get; set; } = () => 1; public Func<bool> MustBeGeneratedConditon { get; set; } public Action<GameObject> PostGenerateAction { get; set; } public bool QuestGenerated { get { return P03AscensionSaveData.RunStateData.GetValueAsBoolean(ModGuid, QuestName + "_GENERATED"); } internal set { P03AscensionSaveData.RunStateData.SetValue(ModGuid, QuestName + "_GENERATED", (object)value); } } public Predicate<HoloMapBlueprint> ValidRoomCondition { get; set; } public bool IsSpecialQuest => EventId == DefaultQuestDefinitions.FindGoobert.EventId || EventId == DefaultQuestDefinitions.BrokenGenerator.EventId || EventId == DefaultQuestDefinitions.Prospector.EventId || EventId == DefaultQuestDefinitions.Rebecha.EventId; public bool IsEndOfQuest => QuestManager.AllQuestDefinitions.Count((QuestDefinition q) => q.PriorEventId == EventId) == 0; public bool ValidForRandomSelection { get { if (IsSpecialQuest) { return false; } if (QuestGenerated) { return false; } if (PriorEventId != 0) { return false; } if (PartnerOfEventId != 0) { return false; } if (4 - EventManagement.CompletedZones.Count < QuestManager.CalculateQuestSize(EventId)) { return false; } return GenerateCondition == null || GenerateCondition(); } } public bool MustBeGenerated { get { if (EventId == DefaultQuestDefinitions.FindGoobert.EventId) { if (EventManagement.CompletedZones.Count == 0) { return true; } return EventManagement.CompletedZones.Count == 1 && CurrentState.Status == QuestState.QuestStateStatus.Active && EventManagement.CurrentZone == DefaultQuestDefinitions.GoobertDropoffZone; } if (EventId == DefaultQuestDefinitions.BrokenGenerator.EventId) { return EventManagement.CompletedZones.Count == 1; } if (EventId == DefaultQuestDefinitions.Prospector.EventId) { return ((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Any((CardInfo c) => ((Object)c).name == "P03KCM_BOUNTYBRAIN"); } if (EventId == DefaultQuestDefinitions.Rebecha.EventId) { return false; } if (IsCompleted && HasUngrantedRewards && QuestCanContinue) { return true; } if (IsCompleted) { return false; } if (PriorEventId != 0) { QuestDefinition questDefinition = QuestManager.Get(PriorEventId); if (questDefinition.IsCompleted && questDefinition.CurrentState.Status == QuestState.QuestStateStatus.Success) { return true; } } if (PartnerOfEventId != 0) { QuestDefinition questDefinition2 = QuestManager.Get(PartnerOfEventId); if (questDefinition2.QuestGenerated && !questDefinition2.IsCompleted && (!QuestGenerated || QuestCanContinue)) { return true; } } if (MustBeGeneratedConditon != null) { return MustBeGeneratedConditon(); } return CurrentState.Status == QuestState.QuestStateStatus.Active && QuestCanContinue; } } public QuestState CurrentState { get { QuestState questState = InitialState; while (questState.GetNextState() != null) { questState = questState.GetNextState(); } return questState; } } public bool IsCompleted { get { QuestState currentState = CurrentState; int result; if (currentState.IsEndState) { QuestState.QuestStateStatus status = currentState.Status; result = ((status == QuestState.QuestStateStatus.Success || status == QuestState.QuestStateStatus.Failure) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } } public bool HasUngrantedRewards => CurrentState.HasUngrantedRewards; internal Predicate<HoloMapBlueprint> GenerateRoomFilter() { int startingQuad = RunBasedHoloMap.GetStartingQuadrant(EventManagement.CurrentZone); if (EventId == DefaultQuestDefinitions.FindGoobert.EventId) { return (EventManagement.CompletedZones.Count == 0) ? ((Predicate<HoloMapBlueprint>)((HoloMapBlueprint bp) => bp.isSecretRoom)) : ((Predicate<HoloMapBlueprint>)((HoloMapBlueprint bp) => !bp.isSecretRoom && bp.color != startingQuad)); } if (EventId == DefaultQuestDefinitions.BrokenGenerator.EventId) { return (HoloMapBlueprint bp) => bp.isSecretRoom; } if (EventId == DefaultQuestDefinitions.Prospector.EventId) { return (HoloMapBlueprint bp) => !bp.isSecretRoom && bp.color != startingQuad && (bp.specialTerrain & 0x80) == 0; } Predicate<HoloMapBlueprint> landmark = (AllowLandmarks ? ((Predicate<HoloMapBlueprint>)((HoloMapBlueprint bp) => true)) : ((Predicate<HoloMapBlueprint>)((HoloMapBlueprint bp) => (bp.specialTerrain & 0x80) == 0))); Predicate<HoloMapBlueprint> secret = (AllowSecretRoom ? ((Predicate<HoloMapBlueprint>)((HoloMapBlueprint bp) => true)) : ((Predicate<HoloMapBlueprint>)((HoloMapBlueprint bp) => !bp.isSecretRoom))); if (ValidRoomCondition != null) { Predicate<HoloMapBlueprint> special = ValidRoomCondition; return (HoloMapBlueprint bp) => landmark(bp) && secret(bp) && special(bp); } return (PriorEventId != 0 || CurrentState.Status != 0) ? ((Predicate<HoloMapBlueprint>)((HoloMapBlueprint bp) => secret(bp) && landmark(bp) && bp.color != startingQuad)) : ((Predicate<HoloMapBlueprint>)((HoloMapBlueprint bp) => secret(bp) && landmark(bp) && bp.color == startingQuad)); } public void ForceComplete(QuestState.QuestStateStatus status) { if (status == QuestState.QuestStateStatus.Success) { while (CurrentState.Status != status) { CurrentState.Status = status; } return; } while (CurrentState.Status != status) { if (CurrentState.IsEndState) { CurrentState.Status = QuestState.QuestStateStatus.Failure; break; } CurrentState.Status = ((CurrentState.GetNextState(QuestState.QuestStateStatus.Failure) != null) ? QuestState.QuestStateStatus.Failure : QuestState.QuestStateStatus.Success); } } public IEnumerator GrantAllUngrantedRewards() { QuestState currentState = InitialState; yield return currentState.GrantRewards(); while (currentState.GetNextState() != null) { currentState = currentState.GetNextState(); yield return currentState.GrantRewards(); } } internal QuestDefinition(string modGuid, string questName) { ModGuid = modGuid; QuestName = questName; EventId = GuidManager.GetEnumValue<SpecialEvent>(modGuid, questName); } } public static class QuestExtensions { public static QuestDefinition SetPriorQuest(this QuestDefinition parent, SpecialEvent prior) { parent.PriorEventId = prior; return parent; } public static QuestDefinition SetPartnerQuest(this QuestDefinition parent, SpecialEvent partner) { parent.PartnerOfEventId = partner; return parent; } public static QuestDefinition SetAllowSecretRoom(this QuestDefinition parent) { parent.AllowSecretRoom = true; return parent; } public static QuestDefinition QuestCannotContinueAcrossMap(this QuestDefinition parent) { parent.QuestCanContinue = false; return parent; } public static QuestDefinition SetAllowLandmarks(this QuestDefinition parent) { parent.AllowLandmarks = true; return parent; } public static QuestDefinition AddPostGenerationAction(this QuestDefinition parent, Action<GameObject> action) { parent.PostGenerateAction = action; return parent; } public static QuestDefinition SetPriorQuest(this QuestDefinition parent, QuestDefinition prior) { return parent.SetPriorQuest(prior.EventId); } public static QuestDefinition OverrideNPCDescriptor(this QuestDefinition parent, NPCDescriptor npc) { parent.ForcedNPCDescriptor = npc; return parent; } public static QuestDefinition SetMustBeGeneratedCondition(this QuestDefinition parent, Func<bool> condition) { parent.MustBeGeneratedConditon = condition; return parent; } public static QuestDefinition SetValidRoomCondition(this QuestDefinition parent, Predicate<HoloMapBlueprint> condition) { parent.ValidRoomCondition = condition; return parent; } public static QuestDefinition GenerateAwayFromStartingArea(this QuestDefinition parent) { return parent.SetValidRoomCondition((HoloMapBlueprint bp) => bp.color != 1); } public static QuestDefinition SetGenerateCondition(this QuestDefinition parent, Func<bool> condition) { parent.GenerateCondition = condition; return parent; } public static QuestDefinition SetPriorityCalculation(this QuestDefinition parent, Func<int> priorityCalc) { parent.CalculatedPriority = priorityCalc; return parent; } public static QuestDefinition SetRegionCondition(this QuestDefinition parent, RunBasedHoloMap.Zone region) { return parent.SetGenerateCondition(() => EventManagement.CurrentZone == region || EventManagement.CompletedZones.Any((string z) => z.ToLowerInvariant().EndsWith(region.ToString().ToLowerInvariant()))); } public static QuestState AddDummyStartingState(this QuestDefinition parent, Func<QuestState.QuestStateStatus> status) { return parent.AddDialogueState("DUMMY", "DUMMY").SetDynamicStatus(status); } public static QuestState AddDummyStartingState(this QuestDefinition parent, Func<bool> status) { return parent.AddDialogueState("DUMMY", "DUMMY").SetDynamicStatus(() => status() ? QuestState.QuestStateStatus.Success : QuestState.QuestStateStatus.Failure); } public static QuestState AddDialogueState(this QuestDefinition parent, string hoverText, string dialogueId) { return parent.InitialState = new QuestState(parent, "InitialDialogue", hoverText, dialogueId, autoComplete: true); } public static QuestState AddSpecialNodeState(this QuestState parent, string hoverText, NodeData data) { QuestState questState = new QuestState(parent.ParentQuest, "SpecialNodeState" + hoverText, hoverText, string.Empty); questState.SpecialNodeData = data; parent.SetNextState(QuestState.QuestStateStatus.Success, questState); return questState; } public static QuestState AddState(this QuestDefinition parent, string hoverText, string dialogueId) { return parent.InitialState = new QuestState(parent, "InitialState", hoverText, dialogueId); } public static QuestState SetDynamicStatus(this QuestState state, Func<QuestState.QuestStateStatus> status) { state.DynamicStatus = status; return state; } public static QuestState SetStoryEventStatus(this QuestState state, StoryEvent successState, StoryEvent? failState) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (failState.HasValue) { StoryEvent actualFailState = failState.Value; return state.SetDynamicStatus(() => StoryEventsData.EventCompleted(actualFailState) ? QuestState.QuestStateStatus.Failure : ((!StoryEventsData.EventCompleted(successState)) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success)); } return state.SetDynamicStatus(() => (!StoryEventsData.EventCompleted(successState)) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success); } public static QuestState SetAutoComplete(this QuestState state, bool autoComplete = true) { state.AutoComplete = autoComplete; return state; } public static QuestState AddSuccessAction(this QuestState state, Action action) { state.Rewards.Add(new QuestRewardAction { RewardAction = action }); return state; } public static QuestState AddDialogueState(this QuestState parent, string hoverText, string dialogueId, QuestState.QuestStateStatus status = QuestState.QuestStateStatus.Success, string overrideName = null) { QuestState questState = new QuestState(parent.ParentQuest, overrideName ?? $"Dialogue_{dialogueId}", hoverText, dialogueId, autoComplete: true); parent.SetNextState(status, questState); return questState; } public static QuestState AddNamedState(this QuestState parent, string name, string hoverText, string dialogueId, QuestState.QuestStateStatus status = QuestState.QuestStateStatus.Success) { QuestState questState = new QuestState(parent.ParentQuest, name, hoverText, dialogueId); parent.SetNextState(status, questState); return questState; } public static QuestState AddNamedState(this QuestState parent, string name, string hoverText, Func<string> dialogueId, QuestState.QuestStateStatus status = QuestState.QuestStateStatus.Success) { QuestState questState = new QuestState(parent.ParentQuest, name, hoverText, dialogueId); parent.SetNextState(status, questState); return questState; } public static QuestState AddDefaultActiveState(this QuestState parent, string hoverText, string dialogueId, int threshold = 0) { QuestState questState = parent.AddNamedState("DEFAULTACTIVESTATE", hoverText, dialogueId); if (threshold > 0) { string saveKey = $"{parent.ParentQuest.QuestName}_Counter"; string modGuid = parent.ParentQuest.ModGuid; questState.DynamicStatus = () => (P03AscensionSaveData.RunStateData.GetValueAsInt(modGuid, saveKey) < threshold) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success; } return questState; } public static void IncrementQuestCounter(this QuestDefinition defn, int incrementBy = 1, bool onlyIfActive = false) { if (!onlyIfActive || defn.CurrentState.Status == QuestState.QuestStateStatus.Active) { string text = $"{defn.QuestName}_Counter"; int valueAsInt = P03AscensionSaveData.RunStateData.GetValueAsInt(defn.ModGuid, text); P03AscensionSaveData.RunStateData.SetValue(defn.ModGuid, text, (object)(valueAsInt + incrementBy)); } } public static int GetQuestCounter(this QuestDefinition defn) { return P03AscensionSaveData.RunStateData.GetValueAsInt(defn.ModGuid, $"{defn.QuestName}_Counter"); } public static QuestState WaitForQuestCounter(this QuestState state, int threshold) { return state.SetDynamicStatus(() => (state.ParentQuest.GetQuestCounter() < threshold) ? QuestState.QuestStateStatus.Active : QuestState.QuestStateStatus.Success); } public static bool IsDefaultState(this QuestState state) { return state.StateName == "DEFAULTACTIVESTATE"; } public static bool IsDefaultActive(this QuestDefinition defn) { return defn.CurrentState.IsDefaultState(); } public static QuestState AddMonetaryReward(this QuestState state, int amount) { state.Rewards.Add(new QuestRewardCoins { Amount = amount }); return state; } public static QuestState AddDynamicMonetaryReward(this QuestState state, bool low = false) { state.Rewards.Add(new QuestRewardDynamicCoins { Low = low }); return state; } public static QuestState AddGainCardReward(this QuestState state, string cardName) { state.Rewards.Add(new QuestRewardCard { CardName = cardName }); return state; } public static QuestState AddGainItemReward(this QuestState state, string itemName) { state.Rewards.Add(new QuestRewardItem { ItemName = itemName }); return state; } public static QuestState AddLoseCardReward(this QuestState state, string cardName) { state.Rewards.Add(new QuestRewardLoseCard { CardName = cardName }); return state; } public static QuestState AddLoseItemReward(this QuestState state, string itemName) { state.Rewards.Add(new QuestRewardLoseItem { ItemName = itemName }); return state; } public static QuestState AddGemifyCardsReward(this QuestState state, int count) { state.Rewards.Add(new QuestRewardModifyRandomCards { NumberOfCards = count, Gemify = true }); return state; } public static QuestState AddGainAbilitiesReward(this QuestState state, int count, Ability ability) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) state.Rewards.Add(new QuestRewardModifyRandomCards { NumberOfCards = count, Ability = ability }); return state; } public static QuestState AddReward(this QuestState state, QuestReward reward) { state.Rewards.Add(reward); return state; } } [HarmonyPatch] public static class QuestManager { private static readonly Dictionary<SpecialEvent, QuestDefinition> AllQuests = new Dictionary<SpecialEvent, QuestDefinition>(); public static IEnumerable<QuestDefinition> AllQuestDefinitions = AllQuests.Values; internal static int CalculateQuestSize(SpecialEvent eventId) { QuestDefinition questDefinition = AllQuests.Values.FirstOrDefault((QuestDefinition q) => q.PriorEventId == eventId); return (questDefinition == null) ? 1 : (1 + CalculateQuestSize(questDefinition.EventId)); } public static QuestDefinition Get(SpecialEvent eventId) { return AllQuests[eventId]; } public static QuestDefinition Add(string modGuid, string questName) { SpecialEvent enumValue = GuidManager.GetEnumValue<SpecialEvent>(modGuid, questName); if (AllQuests.ContainsKey(enumValue)) { throw new InvalidOperationException($"A quest with the name {questName} in mod {modGuid} was defined twice!"); } QuestDefinition questDefinition = new QuestDefinition(modGuid, questName); AllQuests.Add(enumValue, questDefinition); return questDefinition; } internal static List<Tuple<SpecialEvent, Predicate<HoloMapBlueprint>>> GetSpecialEventForZone(RunBasedHoloMap.Zone zone) { List<Tuple<SpecialEvent, Predicate<HoloMapBlueprint>>> list = new List<Tuple<SpecialEvent, Predicate<HoloMapBlueprint>>>(); foreach (QuestDefinition item in AllQuests.Values.Where((QuestDefinition q) => q.MustBeGenerated)) { item.QuestGenerated = true; list.Add(new Tuple<SpecialEvent, Predicate<HoloMapBlueprint>>(item.EventId, item.GenerateRoomFilter())); } List<SpecialEvent> list2 = (from q in AllQuests.Values where q.ValidForRandomSelection select q.EventId).ToList(); if (P03Plugin.Instance.DebugCode.ToLowerInvariant().Contains("event")) { try { int num = P03Plugin.Instance.DebugCode.ToLowerInvariant().IndexOf("event["); int num2 = P03Plugin.Instance.DebugCode.ToUpperInvariant().IndexOf("]"); string text = P03Plugin.Instance.DebugCode.Substring(num + 6, num2 - num - 6); P03Plugin.Log.LogWarning((object)("Parsing override debug event! " + text)); string[] array = text.Split(new char[1] { '_' }); SpecialEvent enumValue = GuidManager.GetEnumValue<SpecialEvent>(array[0], array[1]); QuestDefinition questDefinition = Get(enumValue); questDefinition.QuestGenerated = true; list.Add(new Tuple<SpecialEvent, Predicate<HoloMapBlueprint>>(enumValue, questDefinition.GenerateRoomFilter())); list2.Clear(); } catch (Exception arg) { P03Plugin.Log.LogWarning((object)$"Could not parse special event from debug string! {arg}"); } } if (list2.Count > 0) { int maxPriority = list2.Max((SpecialEvent p) => Get(p).CalculatedPriority()); list2.RemoveAll((SpecialEvent se) => Get(se).CalculatedPriority() != maxPriority); SpecialEvent specialEvent = list2[SeededRandom.Range(0, list2.Count, P03AscensionSaveData.RandomSeed)]; QuestDefinition questDefinition2 = Get(specialEvent); questDefinition2.QuestGenerated = true; list.Add(new Tuple<SpecialEvent, Predicate<HoloMapBlueprint>>(specialEvent, questDefinition2.GenerateRoomFilter())); } foreach (QuestDefinition quest in AllQuests.Values.Where((QuestDefinition q) => q.MustBeGenerated)) { if (!list.Any((Tuple<SpecialEvent, Predicate<HoloMapBlueprint>> e) => e.Item1 == quest.EventId)) { quest.QuestGenerated = true; list.Add(new Tuple<SpecialEvent, Predicate<HoloMapBlueprint>>(quest.EventId, quest.GenerateRoomFilter())); } } return list; } } public abstract class QuestReward { public QuestState ParentState { get; internal set; } protected int RewardIndex => ParentState.Rewards.IndexOf(this); public bool HasBeenGranted { get { return P03AscensionSaveData.RunStateData.GetValueAsBoolean(ParentState.ParentQuest.ModGuid, $"{ParentState.SaveKey}_{RewardIndex}_RewardStatus"); } set { P03AscensionSaveData.RunStateData.SetValue(ParentState.ParentQuest.ModGuid, $"{ParentState.SaveKey}_{RewardIndex}_RewardStatus", (object)value); } } public IEnumerator GrantReward() { if (!HasBeenGranted) { if (CanGrantReward()) { HasBeenGranted = true; yield return GrantRewardSequence(); } else { yield return CannotGrantRewardSequence(); } } } protected virtual IEnumerator CannotGrantRewardSequence() { yield return NPCDescriptor.SayDialogue(ParentState.ParentQuest.EventId, "NPCCannotGiveReward"); } protected virtual bool CanGrantReward() { return true; } protected abstract IEnumerator GrantRewardSequence(); } public class QuestRewardCoins : QuestReward { public virtual int Amount { get; set; } protected override IEnumerator GrantRewardSequence() { if (Amount != 0) { Face currentFace = P03AnimationController.Instance.CurrentFace; View currentView = Singleton<ViewManager>.Instance.CurrentView; yield return (object)new WaitForSeconds(0.4f); yield return P03AnimationController.Instance.ShowChangeCurrency(Amount, true); Part3SaveData data = Part3SaveData.Data; data.currency += Amount; yield return (object)new WaitForSeconds(0.2f); P03AnimationController.Instance.SwitchToFace(currentFace, true, true); yield return (object)new WaitForSeconds(0.1f); Singleton<ViewManager>.Instance.SwitchToView(currentView, false, false); yield return (object)new WaitForSeconds(0.2f); } } } public class QuestRewardDynamicCoins : QuestRewardCoins { public bool Low = false; public override int Amount { get { if (base.Amount > 0) { return base.Amount; } Tuple<int, int> currencyGainRange = EventManagement.CurrencyGainRange; return Low ? currencyGainRange.Item1 : currencyGainRange.Item2; } set { base.Amount = value; } } } public class QuestRewardCard : QuestReward { [CompilerGenerated] private sealed class <DoCardAction>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SelectableCard card; public CardInfo info; public QuestRewardCard <>4__this; private TalkingCard <tCard>5__1; private string <dialogue>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoCardAction>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { } private bool MoveNext() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: { <>1__state = -1; ((CardCollectionInfo)Part3SaveData.Data.deck).AddCard(info); <tCard>5__1 = ((Component)card).GetComponent<TalkingCard>(); if ((Object)(object)<tCard>5__1 != (Object)null) { <dialogue>5__2 = <tCard>5__1.OnDiscoveredInExplorationDialogueId ?? <>4__this.DialogueId; if (!string.IsNullOrEmpty(<dialogue>5__2)) { <>2__current = <tCard>5__1.PlaySoloDialogueEvent(<dialogue>5__2); <>1__state = 1; return true; } <dialogue>5__2 = null; } object obj = this; obj = ((!string.IsNullOrEmpty(<>4__this.DialogueId)) ? Singleton<TextDisplayer>.Instance.PlayDialogueEvent(<>4__this.DialogueId, (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null) : ((IEnumerator)new WaitForSeconds(1.5f))); ((<DoCardAction>d__10)obj).<>2__current = obj; <>1__state = 3; return true; } case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 2; return true; case 2: <>1__state = -1; return false; case 3: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private List<CardModificationInfo> mods = new List<CardModificationInfo>(); protected SelectableCard lastCreatedCard; public string CardName { get; set; } public string DialogueId { get; set; } public static IEnumerator ImmediateReward(string card, string dialogue = null, List<CardModificationInfo> mods = null) { QuestRewardCard q = new QuestRewardCard { CardName = card, DialogueId = dialogue, mods = mods }; yield return q.GrantRewardSequence(); } protected virtual IEnumerator DoCardAction(SelectableCard card, CardInfo info) { ((CardCollectionInfo)Part3SaveData.Data.deck).AddCard(info); TalkingCard tCard = ((Component)card).GetComponent<TalkingCard>(); if ((Object)(object)tCard != (Object)null) { string dialogue = tCard.OnDiscoveredInExplorationDialogueId ?? DialogueId; if (!string.IsNullOrEmpty(dialogue)) { yield return tCard.PlaySoloDialogueEvent(dialogue); yield return (object)new WaitForSeconds(0.25f); yield break; } } object obj = (object)/*Error near IL_00f9: stateMachine*/; obj = ((!string.IsNullOrEmpty(DialogueId)) ? Singleton<TextDisplayer>.Instance.PlayDialogueEvent(DialogueId, (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null) : ((IEnumerator)new WaitForSeconds(1.5f))); ((<DoCardAction>d__10)obj).<>2__current = obj; try { /*Error near IL_013e: Unexpected return in MoveNext()*/; } finally { /*Error: Could not find finallyMethod for state=3. Possibly this method is affected by a C# compiler bug that causes the finally body not to run in case of an exception or early 'break;' out of a loop consuming this iterable.*/; } } protected IEnumerator DisplayCard(CardInfo cardInfo) { GameObject cardGO = Object.Instantiate<GameObject>(Singleton<SpecialNodeHandler>.Instance.buildACardSequencer.selectableCardPrefab); lastCreatedCard = cardGO.GetComponent<SelectableCard>(); lastCreatedCard.Initialize(cardInfo, (Action<SelectableCard>)null, (Action<SelectableCard>)null, false, (Action<SelectableCard>)null); ((InteractableBase)lastCreatedCard).SetEnabled(false); ((Card)lastCreatedCard).SetInteractionEnabled(false); ((Component)lastCreatedCard).transform.position = new Vector3(-1f, 10f, 0f); Transform targetPosition = Singleton<SpecialNodeHandler>.Instance.buildACardSequencer.cardExamineMarker; Tween.Position(((Component)lastCreatedCard).transform, targetPosition.position, 0.25f, 0f, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true); Tween.Rotation(((Component)lastCreatedCard).transform, targetPosition.rotation, 0.25f, 0f, Tween.EaseOut, (LoopType)0, (Action)null, (Action)null, true); yield return (object)new WaitForSeconds(0.25f); } protected IEnumerator RemoveCard() { ((Card)lastCreatedCard).ExitBoard(0.25f, Vector3.zero); yield return (object)new WaitForSeconds(0.25f); } protected override IEnumerator GrantRewardSequence() { if (string.IsNullOrEmpty(CardName)) { yield break; } CardInfo cardInfo = CustomCards.ConvertCodeToCard(CardName); if (mods != null) { CardInfo val = cardInfo; if (val.mods == null) { val.mods = new List<CardModificationInfo>(); } cardInfo.mods.AddRange(mods); } yield return DisplayCard(cardInfo); yield return DoCardAction(lastCreatedCard, cardInfo); yield return RemoveCard(); } } public class QuestRewardLoseCard : QuestRewardCard { protected override IEnumerator DoCardAction(SelectableCard card, CardInfo info) { yield return (object)new WaitForSeconds(0.75f); ((CardCollectionInfo)Part3SaveData.Data.deck).RemoveCardByName(base.CardName); ((Card)card).Anim.PlayPermaDeathAnimation(true); yield return (object)new WaitForSeconds(0.75f); } protected override IEnumerator GrantRewardSequence() { if (((CardCollectionInfo)Part3SaveData.Data.deck).Cards.Any((CardInfo c) => ((Object)c).name == base.CardName)) { yield return base.GrantRewardSequence(); } } } public class QuestRewardItem : QuestReward { public string ItemName { get; set; } protected override bool CanGrantReward() { return Part3SaveData.Data.items.Count < P03AscensionSaveData.MaxNumberOfItems; } protected override IEnumerator CannotGrantRewardSequence() { ConsumableItemData data = ItemsUtil.GetConsumableByName(ItemName); yield return NPCDescriptor.SayDialogue(base.ParentState.ParentQuest.EventId, "NPCCannotGiveItem", switchViews: true, new string[1] { data.rulebookName }); } protected override IEnumerator GrantRewardSequence() { if (!string.IsNullOrEmpty(ItemName) && Part3SaveData.Data.items.Count < P03AscensionSaveData.MaxNumberOfItems) { View currentView = Singleton<ViewManager>.Instance.CurrentView; yield return (object)new WaitForEndOfFrame(); Singleton<ViewManager>.Instance.SwitchToView((View)37, false, true); yield return (object)new WaitForSeconds(0.8f); Part3SaveData.Data.items.Add(ItemName); yield return (object)new WaitForEndOfFrame(); Singleton<ItemsManager>.Instance.UpdateItems(false); yield return (object)new WaitForSeconds(1f); Singleton<ViewManager>.Instance.SwitchToView(currentView, false, false); yield return (object)new WaitForSeconds(0.2f); } } } public class QuestRewardLoseItem : QuestRewardItem { protected override bool CanGrantReward() { return true; } protected override IEnumerator GrantRewardSequence() { if (!string.IsNullOrEmpty(base.ItemName) && Part3SaveData.Data.items.Contains(base.ItemName)) { ItemSlot slot = Singleton<ItemsManager>.Instance.Slots.First((ItemSlot s) => (Object)(object)s.Item != (Object)null && ((Object)s.Item.Data).name.Equals(base.ItemName)); View currentView = Singleton<ViewManager>.Instance.CurrentView; yield return (object)new WaitForEndOfFrame(); Singleton<ViewManager>.Instance.SwitchToView((View)37, false, true); yield return (object)new WaitForSeconds(0.8f); slot.Item.PlayExitAnimation(); yield return (object)new WaitForSeconds(1f); Singleton<ItemsManager>.Instance.RemoveItemFromSaveData(base.ItemName); slot.DestroyItem(); Singleton<ViewManager>.Instance.SwitchToView(currentView, false, false); yield return (object)new WaitForSeconds(0.2f); } } } public class QuestRewardTransformCard : QuestRewardCard { public string TransformIntoCardName { get; set; } protected override IEnumerator DoCardAction(SelectableCard card, CardInfo info) { yield return (object)new WaitForSeconds(1.5f); ((Card)card).Anim.SetFaceDown(true, false); yield return (object)new WaitForSeconds(0.2f); ((Card)card).Anim.SetShaking(true); CardInfo newCardInfo = CardLoader.GetCardByName(TransformIntoCardName); foreach (CardModificationInfo mod in info.Mods) { newCardInfo.Mods.Add((CardModificationInfo)mod.Clone()); } ((CardCollectionInfo)Part3SaveData.Data.deck).AddCard(newCardInfo); ((CardCollectionInfo)Part3SaveData.Data.deck).RemoveCard(info); ((Card)card).SetInfo(newCardInfo); yield return (object)new WaitForSeconds(0.45f); ((Card)card).Anim.SetShaking(false); ((Card)card).SetFaceDown(false, false); yield return (object)new WaitForSeconds(1.5f); } protected override IEnumerator GrantRewardSequence() { CardInfo startCard = ((IEnumerable<CardInfo>)((CardCollectionInfo)Part3SaveData.Data.deck).Cards).FirstOrDefault((Func<CardInfo, bool>)((CardInfo ci) => ((Object)ci).name == base.CardName)); if ((Object)(object)startCard != (Object)null) { yield return DisplayCard(startCard); yield return DoCardAction(lastCreatedCard, startCard); yield return RemoveCard(); } } } public class QuestRewardModifyRandomCards : QuestRewardCard { public Ability Ability { get; set; } = (Ability)107; public bool Gemify { get; set; } public int AttackAdjustment { get; set; } public int HealthAdjustment { get; set; } public int NumberOfCards { get; set; } protected override IEnumerator DoCardAction(SelectableCard card, CardInfo info) { yield return (object)new WaitForSeconds(1.5f); ((Card)card).Anim.SetFaceDown(true, false); yield return (object)new WaitForSeconds(0.2f); ((Card)card).Anim.SetShaking(true); CardModificationInfo mod = new CardModificationInfo { gemify = Gemify }; if ((int)Ability != 107) { mod.abilities = new List<Ability> { Ability }; } mod.attackAdjustment = AttackAdjustment; mod.healthAdjustment = HealthAdjustment; Part3SaveData.Data.deck.ModifyCard(info, mod); ((Card)card).SetInfo(info); yield return (object)new WaitForSeconds(0.45f); ((Card)card).Anim.SetShaking(false); ((Card)card).SetFaceDown(false, false); yield return (object)new WaitForSeconds(1.5f); } protected override IEnumerator GrantRewardSequence() { if (NumberOfCards <= 0) { yield break; } IEnumerable<CardInfo> cardQuery = ((CardCollectionInfo)Part3SaveData.Data.deck).Cards; if (Gemify) { cardQuery = cardQuery.Where((CardInfo c) => !c.Gemified); } if ((int)Ability != 107) { cardQuery = cardQuery.Where((CardInfo c) => !c.HasAbility(Ability)); } List<CardInfo> cards = cardQuery.ToList(); int randomSeed = P03AscensionSaveData.RandomSeed; while (cards.Count > NumberOfCards) { cards.RemoveAt(SeededRandom.Range(0, cards.Count, randomSeed++)); } foreach (CardInfo card in cards) { yield return DisplayCard(card); yield return DoCardAction(lastCreatedCard, card); yield return RemoveCard(); } } } public class QuestRewardAction : QuestReward { public Action RewardAction { get; set; } protected override IEnumerator GrantRewardSequence() { RewardAction?.Invoke(); yield break; } } public class QuestRewardSpecialEvent : QuestReward { public NodeData Data { get; set; } protected override IEnumerator GrantRewardSequence() { yield break; } } [HarmonyPatch] public class QuestState { public enum QuestStateStatus { NotStarted, Active, Success, Failure } private static readonly Dictionary<string, QuestState> DIALOGUE_REVERSE_MAP = new Dictionary<string, QuestState>(); private string _dialogueId; private readonly Dictionary<QuestStateStatus, QuestState> childStates = new Dictionary<QuestStateStatus, QuestState>(); private static readonly Dictionary<StoryEvent, QuestState> storyEventReverseLookup = new Dictionary<StoryEvent, QuestState>(); public StoryEvent StateCompleteEvent { get; private set; } public StoryEvent StateSuccessfulEvent { get; private set; } public StoryEvent StateFailedEvent { get; private set; } public string EncounterId { get; set; } public string StateName { get; private set; } public string DialogueId { get { return _dialogueId; } private set { if (!string.IsNullOrEmpty(_dialogueId) && DIALOGUE_REVERSE_MAP.ContainsKey(_dialogueId)) { DIALOGUE_REVERSE_MAP.Remove(_dialogueId); } _dialogueId = value; if (!string.IsNullOrEmpty(value)) { DIALOGUE_REVERSE_MAP[value] = this; } } } public int DialogueRepeatCount { get { return P03AscensionSaveData.RunStateData.GetValueAsInt("zorro.inscryption.infiniscryption.p03kayceerun", SaveKey + "_DialogueRepeatCount"); } set { P03AscensionSaveData.RunStateData.SetValue("zorro.inscryption.infiniscryption.p03kayceerun", SaveKey + "_DialogueRepeatCount", (object)value); } } public Func<string> DynamicDialogueId { get; private set; } public string NPCHoverText { get; set; } public QuestDefinition ParentQuest { get; private set; } public NodeData SpecialNodeData { get; internal set; } internal string SaveKey => $"{ParentQuest.QuestName}_{StateName}"; public Func<QuestStateStatus> DynamicStatus { get; set; } public QuestStateStatus Status { get { if (!ParentQuest.QuestGenerated) { return QuestStateStatus.NotStarted; } QuestStateStatus questStateStatus = (QuestStateStatus)P03AscensionSaveData.RunStateData.GetValueAsInt(ParentQuest.ModGuid, SaveKey + "_Status"); if (questStateStatus == QuestStateStatus.NotStarted && this != ParentQuest.InitialState) { questStateStatus = QuestStateStatus.Active; } return (questStateStatus == QuestStateStatus.Success || questStateStatus == QuestStateStatus.Failure || DynamicStatus == null) ? questStateStatus : DynamicStatus(); } set { P03AscensionSaveData.RunStateData.SetValue(ParentQuest.ModGuid, SaveKey + "_Status", (object)(int)value); } } public List<QuestReward> Rewards { get; private set; } = new List<QuestReward>(); public bool AutoComplete { get; internal set; } public bool IsEndState => childStates.Count == 0; public bool IsFailState { get; private set; } public bool HasUngrantedRewards { get { foreach (QuestReward reward in Rewards) { reward.ParentState = this; if (!reward.HasBeenGranted) { return true; } } return false; } } [HarmonyPatch(typeof(DialogueEventsData), "FindEvent")] [HarmonyPrefix] private static bool SpecialDialogueCounter(string eventId, ref EventSaveData __result) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown if (!P03AscensionSaveData.IsP03Run) { return true; } if (!DIALOGUE_REVERSE_MAP.ContainsKey(eventId)) { return true; } QuestState questState = DIALOGUE_REVERSE_MAP[eventId]; __result = new EventSaveData(eventId) { repeatCount = questState.DialogueRepeatCount }; return false; } [HarmonyPatch(typeof(DialogueEventsData), "MarkEventPlayed")] [HarmonyPrefix] private static bool SpecialDialogueCounterIncrease(string eventId) { if (!P03AscensionSaveData.IsP03Run) { return true; } if (!DIALOGUE_REVERSE_MAP.ContainsKey(eventId)) { return true; } DIALOGUE_REVERSE_MAP[eventId].DialogueRepeatCount++; return false; } public QuestState SetNextState(QuestStateStatus statusCondition, QuestState nextState) { if (IsFailState || statusCondition == QuestStateStatus.Failure) { nextState.IsFailState = true; } if (childStates.ContainsKey(statusCondition)) { childStates[statusCondition] = nextState; } else { childStates.Add(statusCondition, nextState); } return nextState; } public QuestState SetNextState(QuestStateStatus statusCondition, string hoverText, string dialogueId, bool autoComplete = false) { QuestState nextState = new QuestState(ParentQuest, $"{StateName}_{statusCondition.ToString()}", hoverText, dialogueId, autoComplete); return SetNextState(statusCondition, nextState); } public QuestState GetNextState(QuestStateStatus statusCondition) { return childStates.ContainsKey(statusCondition) ? childStates[statusCondition] : null; } public QuestState GetNextState() { return GetNextState(Status); } public IEnumerator GrantRewards() { Status = Status; if (Status != QuestStateStatus.Success) { yield break; } foreach (QuestReward reward in Rewards) { reward.ParentState = this; if (!reward.HasBeenGranted) { yield return reward.GrantReward(); } } } internal QuestState(QuestDefinition parentQuest, string stateName, string hoverText, string dialogueId, bool autoComplete = false) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) StateName = stateName; ParentQuest = parentQuest; NPCHoverText = hoverText; AutoComplete = autoComplete; DialogueId = dialogueId; StateCompleteEvent = GuidManager.GetEnumValue<StoryEvent>(parentQuest.ModGuid, $"{parentQuest.QuestName}_{StateName}_Complete"); StateSuccessfulEvent = GuidManager.GetEnumValue<StoryEvent>(parentQuest.ModGuid, $"{parentQuest.QuestName}_{StateName}_Success"); StateFailedEvent = GuidManager.GetEnumValue<StoryEvent>(parentQuest.ModGuid, $"{parentQuest.QuestName}_{StateName}_Failure"); storyEventReverseLookup[StateCompleteEvent] = this; storyEventReverseLookup[StateSuccessfulEvent] = this; storyEventReverseLookup[StateFailedEvent] = this; } internal QuestState(QuestDefinition parentQuest, string stateName, string hoverText, Func<string> dialogueId, bool autoComplete = false) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) StateName = stateName; ParentQuest = parentQuest; NPCHoverText = hoverText; AutoComplete = autoComplete; DialogueId = null; DynamicDialogueId = dialogueId; StateCompleteEvent = GuidManager.GetEnumValue<StoryEvent>(parentQuest.ModGuid, $"{parentQuest.QuestName}_{StateName}_Complete"); StateSuccessfulEvent = GuidManager.GetEnumValue<StoryEvent>(parentQuest.ModGuid, $"{parentQuest.QuestName}_{StateName}_Success"); StateFailedEvent = GuidManager.GetEnumValue<StoryEvent>(parentQuest.ModGuid, $"{parentQuest.QuestName}_{StateName}_Failure"); storyEventReverseLookup[StateCompleteEvent] = this; storyEventReverseLookup[StateSuccessfulEvent] = this; storyEventReverseLookup[StateFailedEvent] = this; } [HarmonyPatch(typeof(StoryEventsData), "EventCompleted")] [HarmonyPrefix] internal static bool QuestBasedStoryFlags(ref bool __result, StoryEvent storyEvent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!storyEventReverseLookup.ContainsKey(storyEvent)) { return true; } QuestState questState = storyEventReverseLookup[storyEvent]; QuestStateStatus status = questState.Status; if (status == QuestStateStatus.NotStarted || status == QuestStateStatus.Active) { __result = false; } else if (storyEvent == questState.StateCompleteEvent) { __result = true; } else if (storyEvent == questState.StateFailedEvent) { __result = questState.Status == QuestStateStatus.Failure; } else if (storyEvent == questState.StateSuccessfulEvent) { __result = questState.Status == QuestStateStatus.Success; } return false; } } public enum SpecialEvent { None } } namespace Infiniscryption.P03KayceeRun.Sequences { [HarmonyPatch] public class RoboRingwormUpgrade { public static bool HasEatenRingworm { get { return P03AscensionSaveData.RunStateData.GetValueAsBoolean("zorro.inscryption.infiniscryption.p03kayceerun", "HasEatenRingworm"); } set { P03AscensionSaveData.RunStateData.SetValue("zorro.inscryption.infiniscryption.p03kayceerun", "HasEatenRingworm", (object)value); } } public static bool HasIntroducedNewDiskDrive { get { return P03AscensionSaveData.RunStateData.GetValueAsBoolean("zorro.inscryption.infiniscryption.p03kayceerun", "HasIntroducedNewDiskDrive"); } set { P03AscensionSaveData.RunStateData.SetValue("zorro.inscryption.infiniscryption.p03kayceerun", "HasIntroducedNewDiskDrive", (object)value); } } [HarmonyPatch(typeof(DiskDriveModSequencer), "PreSelectionDialogueSequence")] [HarmonyPostfix] private static IEnumerator WhineAboutNewModifier(IEnumerator sequence, DiskDriveModSequencer __instance) { if (P03AscensionSaveData.IsP03Run && __instance is AddCardAbilitySequencer && HasEatenRingworm && !HasIntroducedNewDiskDrive) { HasIntroducedNewDiskDrive = true; yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("P03RingwormNew", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null); } else { yield return sequence; } } [HarmonyPatch(typeof(AddCardAbilitySequencer), "UpdateModChoices")] [HarmonyPrefix] private static bool UpdateChoicesForRingworm(AddCardAbilitySequencer __instance, CardInfo selectedCard) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (!P03AscensionSaveData.IsP03Run) { return true; } if (!HasEatenRingworm) { return true; } if (((DiskDriveModSequencer)__instance).modChoices == null) { List<Ability> learnedAbilities = AbilitiesUtil.GetLearnedAbilities(false, 1, 4, (AbilityMetaCategory)3); List<Ability> rareAbilities = RandomRareAbility.RareAbilities; rareAbilities.Add((Ability)25); rareAbilities.Add((Ability)5); rareAbilities.Add(TreeStrafe.AbilityID); rareAbilities.Remove((Ability)61); rareAbilities = rareAbilities.Distinct().ToList(); rareAbilities.RemoveAll((Ability x) => selectedCard.HasAbility(x)); learnedAbilities.RemoveAll((Ability x) => selectedCard.HasAbility(x)); int currentRandomSeed = SaveManager.SaveFile.GetCurrentRandomSeed(); while (rareAbilities.Count > 2) { rareAbilities.RemoveAt(SeededRandom.Range(0, rareAbilities.Count, currentRandomSeed++)); } while (learnedAbilities.Count > 2) { learnedAbilities.RemoveAt(SeededRandom.Range(0, learnedAbilities.Count, currentRandomSeed++)); } ((DiskDriveModSequencer)__instance).modChoices = new List<CardModificationInfo>(learnedAbilities.Concat(rareAbilities).Select((Func<Ability, CardModificationInfo>)((Ability a) => new CardModificationInfo(a)))); } ((DiskDriveModSequencer)__instance).currentValidModChoices = new List<CardModificationInfo>(((DiskDriveModSequencer)__instance).modChoices); ((DiskDriveModSequencer)__instance).currentValidModChoices.RemoveAll((CardModificationInfo m) => selectedCard.HasAbility(m.abilities[0])); return false; } [HarmonyPatch(typeof(DiskDriveModSequencer), "ModifyCardSequence")] [HarmonyPostfix] private static IEnumerator RingwormCheckSequence(IEnumerator sequence, DiskDriveModSequencer __instance) { AddCardAbilitySequencer abilityMachine = default(AddCardAbilitySequencer); int num; if (P03AscensionSaveData.IsP03Run) { abilityMachine = (AddCardAbilitySequencer)(object)((__instance is AddCardAbilitySequencer) ? __instance : null); num = ((abilityMachine == null) ? 1 : 0); } else { num = 1; } if (num != 0) { yield return sequence; yield break; } if (HasEatenRingworm) { yield return sequence; yield break; } while (sequence.MoveNext()) { if (!(sequence.Current is WaitWhile)) { yield return sequence.Current; continue; } yield return sequence.Current; if (((DiskDriveModSequencer)abilityMachine).selectedMod != null && ((Card)((DiskDriveModSequencer)abilityMachine).selectedCard).Info.HasTrait(CustomCards.UpgradeVirus)) { P03AnimationController.Instance.SwitchToFace((Face)1, true, true); Singleton<P03ScreenInteractables>.Instance.HideArrowButtons(); Singleton<P03ScreenInteractables>.Instance.ClearFaceInteractables(); Singleton<TextDisplayer>.Instance.Clear(); Singleton<ViewManager>.Instance.SwitchToView((View)1, false, false); yield return (object)new WaitForSeconds(0.5f); GameObject firePrefab = ResourceBank.Get<GameObject>("p03kcm/prefabs/Fire_Parent"); GameObject fireObj = Object.Instantiate<GameObject>(firePrefab, ((Component)((DiskDriveModSequencer)abilityMachine).diskDrive).transform); fireObj.transform.localPosition = new Vector3(-1.3f, 0.46f, 2.17f); fireObj.transform.SetParent(((Component)((DiskDriveModSequencer)abilityMachine).diskDrive.anim).transform, true); for (int i = 1; i <= 4; i++) { ((Component)fireObj.transform.Find($"Fire_System_{i}")).gameObject.SetActive(false); } AudioController.Instance.PlaySound3D("fireball", (MixerGroup)4, fireObj.transform.position, 0.35f, 0f, (Pitch)null, (Repetition)null, (Randomization)null, (Distortion)null, false); yield return (object)new WaitForSeconds(1f); P03AnimationController.Instance.UnplugInputCable((Action)delegate { ((DiskDriveModSequencer)abilityMachine).diskDrive.JostleUnplugged(); }); ((CardCollectionInfo)Part3SaveData.Data.deck