public static void InitializeActions() { BlueprintAction.Register( new BlueprintAction <BlueprintItem>("Add", (bp, ch, n) => Game.Instance.Player.Inventory.Add(bp, n, null), null, true ), new BlueprintAction <BlueprintItem>("Remove", (bp, ch, n) => Game.Instance.Player.Inventory.Remove(bp, n), (bp, ch) => Game.Instance.Player.Inventory.Contains(bp), true ), new BlueprintAction <BlueprintUnit>("Spawn", (bp, ch, n) => Actions.SpawnUnit(bp, n), null, true ), #if false new BlueprintAction("Kill", typeof(BlueprintUnit), (bp, ch) => { Actions.SpawnUnit((BlueprintUnit)bp); } ), new BlueprintAction("Remove", typeof(BlueprintUnit), (bp, ch) => { CheatsCombat.Kill((BlueprintUnit)bp); }, (bp, ch) => { return(ch.Inventory.Contains((BlueprintUnit)bp)); } ), #endif new BlueprintAction <BlueprintFeature>("Add", (bp, ch, n) => ch.Descriptor.AddFact(bp), (bp, ch) => !ch.Progression.Features.HasFact(bp) ), new BlueprintAction <BlueprintFeature>("Remove", (bp, ch, n) => ch.Progression.Features.RemoveFact(bp), (bp, ch) => ch.Progression.Features.HasFact(bp) ), new BlueprintAction <BlueprintFeature>("<", (bp, ch, n) => { try { ch.Progression.Features.GetFact(bp).RemoveRank(); } catch (Exception e) { Logger.Log(e); } }, (bp, ch) => { var feature = ch.Progression.Features.GetFact(bp); return(feature != null && feature.GetRank() > 1); }), new BlueprintAction <BlueprintFeature>(">", (bp, ch, n) => ch.Progression.Features.GetFact(bp).AddRank(), (bp, ch) => { var feature = ch.Progression.Features.GetFact(bp); return(feature != null && feature.GetRank() < feature.Blueprint.Ranks); }), // Spellbooks new BlueprintAction <BlueprintSpellbook>("Add", (bp, ch, n) => { ch.Descriptor.DemandSpellbook(bp.CharacterClass); }, (bp, ch) => !ch.Descriptor.Spellbooks.Any((sb) => sb.Blueprint == bp) ), new BlueprintAction <BlueprintSpellbook>("Remove", (bp, ch, n) => ch.Descriptor.DeleteSpellbook(bp), (bp, ch) => ch.Descriptor.Spellbooks.Any((sb) => sb.Blueprint == bp) ), new BlueprintAction <BlueprintSpellbook>(">", (bp, ch, n) => { try { var spellbook = ch.Descriptor.Spellbooks.First((sb) => sb.Blueprint == bp); if (spellbook.IsMythic) { spellbook.AddMythicLevel(); } else { spellbook.AddBaseLevel(); } } catch (Exception e) { Logger.Log(e); } }, (bp, ch) => ch.Descriptor.Spellbooks.Any((sb) => sb.Blueprint == bp && sb.CasterLevel < bp.MaxSpellLevel) ), // Buffs new BlueprintAction <BlueprintBuff>("Add", (bp, ch, n) => GameHelper.ApplyBuff(ch, bp), (bp, ch) => !ch.Descriptor.Buffs.HasFact(bp) ), new BlueprintAction <BlueprintBuff>("Remove", (bp, ch, n) => ch.Descriptor.RemoveFact(bp), (bp, ch) => ch.Descriptor.Buffs.HasFact(bp) ), new BlueprintAction <BlueprintBuff>("<", (bp, ch, n) => ch.Descriptor.Buffs.GetFact(bp).RemoveRank(), (bp, ch) => { var buff = ch.Descriptor.Buffs.GetFact(bp); return(buff != null && buff.GetRank() > 1); }), new BlueprintAction <BlueprintBuff>(">", (bp, ch, n) => ch.Descriptor.Buffs.GetFact(bp).AddRank(), (bp, ch) => { var buff = ch.Descriptor.Buffs.GetFact(bp); return(buff != null && buff.GetRank() < buff.Blueprint.Ranks - 1); }), // Abilities new BlueprintAction <BlueprintAbility>("Add", (bp, ch, n) => ch.AddAbility(bp), (bp, ch) => ch.CanAddAbility(bp) ), new BlueprintAction <BlueprintAbility>("At Will", (bp, ch, n) => ch.AddSpellAsAbility(bp), (bp, ch) => ch.CanAddSpellAsAbility(bp) ), new BlueprintAction <BlueprintAbility>("Remove", (bp, ch, n) => ch.RemoveAbility(bp), (bp, ch) => ch.HasAbility(bp) ), // BlueprintActivatableAbility new BlueprintAction <BlueprintActivatableAbility>("Add", (bp, ch, n) => ch.Descriptor.AddFact(bp), (bp, ch) => !ch.Descriptor.HasFact(bp) ), new BlueprintAction <BlueprintActivatableAbility>("Remove", (bp, ch, n) => ch.Descriptor.RemoveFact(bp), (bp, ch) => ch.Descriptor.HasFact(bp) ), // Etudes new BlueprintAction <BlueprintEtude>("Start", (bp, ch, n) => Game.Instance.Player.EtudesSystem.StartEtude(bp), (bp, ch) => Game.Instance.Player.EtudesSystem.EtudeIsNotStarted(bp) ), new BlueprintAction <BlueprintEtude>("Complete", (bp, ch, n) => Game.Instance.Player.EtudesSystem.MarkEtudeCompleted(bp), (bp, ch) => !Game.Instance.Player.EtudesSystem.EtudeIsNotStarted(bp) && !Game.Instance.Player.EtudesSystem.EtudeIsCompleted(bp) ), // Cut Scenes new BlueprintAction <Cutscene>("Play", (bp, ch, n) => { Actions.ToggleModWindow(); CutscenePlayerData cutscenePlayerData = CutscenePlayerData.Queue.FirstOrDefault <CutscenePlayerData>((Func <CutscenePlayerData, bool>)(c => c.PlayActionId == bp.name)); if (cutscenePlayerData != null) { cutscenePlayerData.PreventDestruction = true; cutscenePlayerData.Stop(); cutscenePlayerData.PreventDestruction = false; } var state = Kingmaker.ElementsSystem.ContextData <SpawnedUnitData> .Current?.State; CutscenePlayerView.Play(bp, null, true, state).PlayerData.PlayActionId = bp.name; }), // Teleport new BlueprintAction <BlueprintAreaEnterPoint>("Teleport", (bp, ch, n) => GameHelper.EnterToArea(bp, AutoSaveMode.None) ), new BlueprintAction <BlueprintGlobalMap>("Teleport", (bp, ch, n) => GameHelper.EnterToArea(bp.GlobalMapEnterPoint, AutoSaveMode.None) ), //new BlueprintAction<BlueprintAreaPart>("Teleport", // (bp, ch, n) => GameHelper.EnterToArea(bp, AutoSaveMode.None) // ), new BlueprintAction <BlueprintArea>("Teleport", (area, ch, n) => { var areaEnterPoints = BlueprintExensions.BlueprintsOfType <BlueprintAreaEnterPoint>(); var blueprint = areaEnterPoints.Where(bp => (bp is BlueprintAreaEnterPoint ep) ? ep.Area == area : false).FirstOrDefault(); if (blueprint is BlueprintAreaEnterPoint enterPoint) { GameHelper.EnterToArea(enterPoint, AutoSaveMode.None); } }),