コード例 #1
0
        public static void UpdateSearchResults()
        {
            if (blueprints == null)
            {
                return;
            }
            selectedCollationIndex      = 0;
            selectedBlueprint           = null;
            selectedBlueprintIndex      = -1;
            selectedCollatedBPs         = null;
            BlueprintListUI.needsLayout = true;
            if (settings.searchText.Trim().Length == 0)
            {
                ResetSearch();
            }
            var terms = settings.searchText.Split(' ').Select(s => s.ToLower()).ToHashSet();

            selectedTypeFilter = blueprintTypeFilters[settings.selectedBPTypeFilter];
            var selectedType = selectedTypeFilter.type;
            IEnumerable <BlueprintScriptableObject> bps = null;

            if (selectedTypeFilter.blueprintSource != null)
            {
                bps = selectedTypeFilter.blueprintSource();
            }
            else
            {
                bps = BlueprintExensions.BlueprintsOfType(selectedType).Where((bp) => selectedTypeFilter.filter(bp));
            }
            var filtered = new List <BlueprintScriptableObject>();

            foreach (BlueprintScriptableObject blueprint in bps)
            {
                var name = blueprint.name.ToLower();
                if (terms.All(term => name.Contains(term)))
                {
                    filtered.Add(blueprint);
                }
            }
            filteredBPs = filtered.OrderBy(bp => bp.name);
            matchCount  = filtered.Count();
            if (selectedTypeFilter.collator != null)
            {
                collatedBPs = filtered.GroupBy(selectedTypeFilter.collator).OrderBy(bp => bp.Key);
                // I could do something like this but I will leave it up to the UI when a collation is selected.
                // GetItems().GroupBy(g => g.Type).Select(s => new { Type = s.Key, LastTen = s.Take(10).ToList() });
                collationKeys = new List <String>()
                {
                    "All"
                };
                collationKeys = collationKeys.Concat(collatedBPs.Select(cbp => cbp.Key)).ToList();
            }
            filteredBPs     = filteredBPs.Take(settings.searchLimit).ToArray();
            filteredBPNames = filteredBPs.Select(b => b.name).ToArray();
            firstSearch     = false;
        }
コード例 #2
0
ファイル: Teleport.cs プロジェクト: cabarius/ToyBox
        public static void To(this BlueprintArea area)
        {
            var areaEnterPoints = BlueprintExensions.BlueprintsOfType <BlueprintAreaEnterPoint>();
            var blueprint       = areaEnterPoints.FirstOrDefault(bp => bp is BlueprintAreaEnterPoint ep && ep.Area == area);

            if (blueprint is BlueprintAreaEnterPoint enterPoint)
            {
                GameHelper.EnterToArea(enterPoint, AutoSaveMode.None);
            }
        }
コード例 #3
0
        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);
                }
            }),
コード例 #4
0
ファイル: BlueprintBrowser.cs プロジェクト: cabarius/ToyBox
        public static void UpdateSearchResults()
        {
            if (blueprints == null)
            {
                return;
            }
            selectedCollationIndex      = 0;
            selectedCollatedBPs         = null;
            BlueprintListUI.needsLayout = true;
            if (settings.searchText.Trim().Length == 0)
            {
                ResetSearch();
            }
            var searchText = settings.searchText;
            var terms      = searchText.Split(' ').Select(s => s.ToLower()).ToHashSet();

            selectedTypeFilter = blueprintTypeFilters[settings.selectedBPTypeFilter];
            var selectedType = selectedTypeFilter.type;
            IEnumerable <SimpleBlueprint> bps = null;

            if (selectedTypeFilter.blueprintSource != null)
            {
                bps = selectedTypeFilter.blueprintSource();
            }
            else
            {
                bps = from bp in BlueprintExensions.BlueprintsOfType(selectedType)
                      where selectedTypeFilter.filter(bp)
                      select bp;
            }
            var filtered = new List <SimpleBlueprint>();

            foreach (var blueprint in bps)
            {
                if (blueprint.AssetGuid.ToString().Contains(searchText) ||
                    blueprint.GetType().ToString().Contains(searchText))
                {
                    filtered.Add(blueprint);
                }
                else
                {
                    var name        = blueprint.name;
                    var displayName = blueprint.GetDisplayName();
                    var description = blueprint.GetDescription() ?? "";
                    if (terms.All(term => name.Matches(term)) ||
                        terms.All(term => displayName.Matches(term)) ||
                        settings.searchesDescriptions &&
                        (terms.All(term => description.Matches(term)) ||
                         blueprint is BlueprintItem itemBP &&
                         terms.All(term => itemBP.FlavorText.Matches(term))
                        )
                        )
                    {
                        filtered.Add(blueprint);
                    }
                }
            }
            filteredBPs = filtered.OrderBy(bp => bp.name);
            matchCount  = filtered.Count();
            UpdatePageCount();
            for (var i = 0; i < BlueprintListUI.ParamSelected.Length; i++)
            {
                BlueprintListUI.ParamSelected[i] = 0;
            }
            uncolatedMatchCount = matchCount;
            if (selectedTypeFilter.collator != null)
            {
                collatedBPs = from bp in filtered
                              from key in selectedTypeFilter.collator(bp)
                              //where selectedTypeFilter.collator(bp).Contains(key) // this line causes a mutation error
                              group bp by key into g
                              orderby g.Key.LongSortKey(), g.Key
                select g;

                _ = collatedBPs.Count();
                var keys = collatedBPs.ToList().Select(cbp => cbp.Key).ToList();
                collationKeys = new List <string> {
                    "All"
                };
                collationKeys.AddRange(keys);
            }
            else
            {
                collationKeys = null;
            }

            unpagedBPs = filteredBPs;
            UpdatePaginatedResults();
            firstSearch = false;
            UpdateCollation();
        }
コード例 #5
0
ファイル: EditorActions.cs プロジェクト: cabarius/ToyBox
        public static void InitializeActions()
        {
#if false
            var flags = Game.Instance.Player.UnlockableFlags;
            BlueprintAction.Register <BlueprintItem>("Add",
                                                     (bp, ch, n, index) => Game.Instance.Player.Inventory.Add(bp, n), isRepeatable: true);

            BlueprintAction.Register <BlueprintItem>("Remove",
                                                     (bp, ch, n, index) => Game.Instance.Player.Inventory.Remove(bp, n),
                                                     (bp, ch, index) => Game.Instance.Player.Inventory.Contains(bp), true);

            BlueprintAction.Register <BlueprintUnit>("Spawn",
                                                     (bp, ch, n, index) => Actions.SpawnUnit(bp, n), isRepeatable: true);

            BlueprintAction.Register <BlueprintFeature>("Add",
                                                        (bp, ch, n, index) => ch.Descriptor.AddFact(bp),
                                                        (bp, ch, index) => !ch.Progression.Features.HasFact(bp));

            BlueprintAction.Register <BlueprintFeature>("Remove",
                                                        (bp, ch, n, index) => ch.Progression.Features.RemoveFact(bp),
                                                        (bp, ch, index) => ch.Progression.Features.HasFact(bp));

            BlueprintAction.Register <BlueprintParametrizedFeature>("Add",
                                                                    (bp, ch, n, index) => ch?.Descriptor?.AddFact <UnitFact>(bp, null, bp.Items.OrderBy(x => x.Name).ElementAt(BlueprintListUI.ParamSelected[index]).Param),
                                                                    (bp, ch, index) => ch?.Descriptor?.Unit?.Facts?.Get <Feature>(i => i.Blueprint == bp && i.Param == bp.Items.OrderBy(x => x.Name).ElementAt(BlueprintListUI.ParamSelected[index]).Param) == null);

            BlueprintAction.Register <BlueprintParametrizedFeature>("Remove", (bp, ch, n, index) => ch?.Progression?.Features?.RemoveFact(ch.Descriptor?.Unit?.Facts?.Get <Feature>(i => i.Blueprint == bp && i.Param == bp.Items.OrderBy(x => x.Name).ToArray()[BlueprintListUI.ParamSelected[index]].Param)),
                                                                    (bp, ch, index) => ch?.Descriptor?.Unit?.Facts?.Get <Feature>(i => i.Blueprint == bp && i.Param == bp.Items.OrderBy(x => x.Name).ToArray()[BlueprintListUI.ParamSelected[index]].Param) != null);

            BlueprintAction.Register <BlueprintFeature>("<",
                                                        (bp, ch, n, index) => ch.Progression.Features.GetFact(bp)?.RemoveRank(),
                                                        (bp, ch, index) => {
                var feature = ch.Progression.Features.GetFact(bp);
                return(feature?.GetRank() > 1);
            });

            BlueprintAction.Register <BlueprintFeature>(">",
                                                        (bp, ch, n, index) => ch.Progression.Features.GetFact(bp)?.AddRank(),
                                                        (bp, ch, index) => {
                var feature = ch.Progression.Features.GetFact(bp);
                return(feature != null && feature.GetRank() < feature.Blueprint.Ranks);
            });
            //BlueprintAction.Register<BlueprintArchetype>(
            //    "Add",
            //    (bp, ch, n, index) => ch.Progression.AddArchetype(ch.Progression.Classes.First().CharacterClass, bp),
            //    (bp, ch, index) => ch.Progression.CanAddArchetype(ch.Progression.Classes.First().CharacterClass, bp)
            //    );
            //BlueprintAction.Register<BlueprintArchetype>("Remove",
            //    (bp, ch, n, index) => ch.Progression.AddArchetype(ch.Progression.Classes.First().CharacterClass, bp),
            //    (bp, ch, index) => ch.Progression.Classes.First().Archetypes.Contains(bp)
            //    );

            // Spellbooks
            BlueprintAction.Register <BlueprintSpellbook>("Add",
                                                          (bp, ch, n, index) => ch.Descriptor.DemandSpellbook(bp.CharacterClass),
                                                          (bp, ch, index) => ch.Descriptor.Spellbooks.All(sb => sb.Blueprint != bp));

            BlueprintAction.Register <BlueprintSpellbook>("Remove",
                                                          (bp, ch, n, index) => ch.Descriptor.DeleteSpellbook(bp),
                                                          (bp, ch, index) => ch.Descriptor.Spellbooks.Any(sb => sb.Blueprint == bp));

            BlueprintAction.Register <BlueprintSpellbook>(">",
                                                          (bp, ch, n, index) => {
                try {
                    var spellbook = ch.Descriptor.Spellbooks.First(sb => sb.Blueprint == bp);

                    if (spellbook.IsMythic)
                    {
                        spellbook.AddMythicLevel();
                    }
                    else
                    {
                        spellbook.AddBaseLevel();
                    }
                }
                catch (Exception e) { Mod.Error(e); }
            },
                                                          (bp, ch, index) => ch.Descriptor.Spellbooks.Any(sb => sb.Blueprint == bp && sb.CasterLevel < bp.MaxSpellLevel));

            // Buffs
            BlueprintAction.Register <BlueprintBuff>("Add",
                                                     (bp, ch, n, index) => GameHelper.ApplyBuff(ch, bp),
                                                     (bp, ch, index) => !ch.Descriptor.Buffs.HasFact(bp));

            BlueprintAction.Register <BlueprintBuff>("Remove",
                                                     (bp, ch, n, index) => ch.Descriptor.RemoveFact(bp),
                                                     (bp, ch, index) => ch.Descriptor.Buffs.HasFact(bp));

            BlueprintAction.Register <BlueprintBuff>("<",
                                                     (bp, ch, n, index) => ch.Descriptor.Buffs.GetFact(bp)?.RemoveRank(),
                                                     (bp, ch, index) => {
                var buff = ch.Descriptor.Buffs.GetFact(bp);

                return(buff?.GetRank() > 1);
            });

            BlueprintAction.Register <BlueprintBuff>(">",
                                                     (bp, ch, n, index) => ch.Descriptor.Buffs.GetFact(bp)?.AddRank(),
                                                     (bp, ch, index) => {
                var buff = ch.Descriptor.Buffs.GetFact(bp);

                return(buff != null && buff.GetRank() < buff.Blueprint.Ranks - 1);
            });

            // Abilities
            BlueprintAction.Register <BlueprintAbility>("Add",
                                                        (bp, ch, n, index) => ch.AddAbility(bp),
                                                        (bp, ch, index) => ch.CanAddAbility(bp));

            BlueprintAction.Register <BlueprintAbility>("At Will",
                                                        (bp, ch, n, index) => ch.AddSpellAsAbility(bp),
                                                        (bp, ch, index) => ch.CanAddSpellAsAbility(bp));

            BlueprintAction.Register <BlueprintAbility>("Remove",
                                                        (bp, ch, n, index) => ch.RemoveAbility(bp),
                                                        (bp, ch, index) => ch.HasAbility(bp));
            // Ability Resources

            BlueprintAction.Register <BlueprintAbilityResource>("Add",
                                                                (bp, ch, n, index) => ch.Resources.Add(bp, true),
                                                                (bp, ch, index) => !ch.Resources.ContainsResource(bp));

            BlueprintAction.Register <BlueprintAbilityResource>("Remove",
                                                                (bp, ch, n, index) => ch.Resources.Remove(bp),
                                                                (bp, ch, index) => ch.Resources.ContainsResource(bp));

            // Spellbooks


            // BlueprintActivatableAbility
            BlueprintAction.Register <BlueprintActivatableAbility>("Add",
                                                                   (bp, ch, n, index) => ch.Descriptor.AddFact(bp),
                                                                   (bp, ch, index) => !ch.Descriptor.HasFact(bp));

            BlueprintAction.Register <BlueprintActivatableAbility>("Remove",
                                                                   (bp, ch, n, index) => ch.Descriptor.RemoveFact(bp),
                                                                   (bp, ch, index) => ch.Descriptor.HasFact(bp));

            // Quests
            BlueprintAction.Register <BlueprintQuest>("Start",
                                                      (bp, ch, n, index) => Game.Instance.Player.QuestBook.GiveObjective(bp.Objectives.First()),
                                                      (bp, ch, index) => Game.Instance.Player.QuestBook.GetQuest(bp) == null);

            BlueprintAction.Register <BlueprintQuest>("Complete",
                                                      (bp, ch, n, index) => {
                foreach (var objective in bp.Objectives)
                {
                    Game.Instance.Player.QuestBook.CompleteObjective(objective);
                }
            }, (bp, ch, index) => Game.Instance.Player.QuestBook.GetQuest(bp)?.State == QuestState.Started);

            // Quests Objectives
            BlueprintAction.Register <BlueprintQuestObjective>("Start",
                                                               (bp, ch, n, index) => Game.Instance.Player.QuestBook.GiveObjective(bp),
                                                               (bp, ch, index) => Game.Instance.Player.QuestBook.GetQuest(bp.Quest) == null);

            BlueprintAction.Register <BlueprintQuestObjective>("Complete",
                                                               (bp, ch, n, index) => Game.Instance.Player.QuestBook.CompleteObjective(bp),
                                                               (bp, ch, index) => Game.Instance.Player.QuestBook.GetQuest(bp.Quest)?.State == QuestState.Started);

            // Etudes
            BlueprintAction.Register <BlueprintEtude>("Start",
                                                      (bp, ch, n, index) => Game.Instance.Player.EtudesSystem.StartEtude(bp),
                                                      (bp, ch, index) => Game.Instance.Player.EtudesSystem.EtudeIsNotStarted(bp));
            BlueprintAction.Register <BlueprintEtude>("Unstart",
                                                      (bp, ch, n, index) => Game.Instance.Player.EtudesSystem.UnstartEtude(bp),
                                                      (bp, ch, index) => !Game.Instance.Player.EtudesSystem.EtudeIsNotStarted(bp));
            BlueprintAction.Register <BlueprintEtude>("Complete",
                                                      (bp, ch, n, index) => Game.Instance.Player.EtudesSystem.MarkEtudeCompleted(bp),
                                                      (bp, ch, index) => !Game.Instance.Player.EtudesSystem.EtudeIsNotStarted(bp) &&
                                                      !Game.Instance.Player.EtudesSystem.EtudeIsCompleted(bp));
            // Flags
            BlueprintAction.Register <BlueprintUnlockableFlag>("Unlock",
                                                               (bp, ch, n, index) => flags.Unlock(bp),
                                                               (bp, ch, index) => !flags.IsUnlocked(bp));

            BlueprintAction.Register <BlueprintUnlockableFlag>("Lock",
                                                               (bp, ch, n, index) => flags.Lock(bp),
                                                               (bp, ch, index) => flags.IsUnlocked(bp));

            BlueprintAction.Register <BlueprintUnlockableFlag>(">",
                                                               (bp, ch, n, index) => flags.SetFlagValue(bp, flags.GetFlagValue(bp) + n),
                                                               (bp, ch, index) => flags.IsUnlocked(bp));

            BlueprintAction.Register <BlueprintUnlockableFlag>("<",
                                                               (bp, ch, n, index) => flags.SetFlagValue(bp, flags.GetFlagValue(bp) - n),
                                                               (bp, ch, index) => flags.IsUnlocked(bp));

            // Cutscenes
            BlueprintAction.Register <Cutscene>("Play", (bp, ch, n, index) => {
                Actions.ToggleModWindow();
                var cutscenePlayerData = CutscenePlayerData.Queue.FirstOrDefault(c => c.PlayActionId == bp.name);

                if (cutscenePlayerData != null)
                {
                    cutscenePlayerData.PreventDestruction = true;
                    cutscenePlayerData.Stop();
                    cutscenePlayerData.PreventDestruction = false;
                }

                var state = ContextData <SpawnedUnitData> .Current?.State;
                CutscenePlayerView.Play(bp, null, true, state).PlayerData.PlayActionId = bp.name;
            });

            // Teleport
            BlueprintAction.Register <BlueprintAreaEnterPoint>("Teleport", (bp, ch, n, index) => GameHelper.EnterToArea(bp, AutoSaveMode.None));
            BlueprintAction.Register <BlueprintGlobalMap>("Teleport", (bp, ch, n, index) => GameHelper.EnterToArea(bp.GlobalMapEnterPoint, AutoSaveMode.None));

            BlueprintAction.Register <BlueprintArea>("Teleport", (area, ch, n, index) => {
                var areaEnterPoints = BlueprintExensions.BlueprintsOfType <BlueprintAreaEnterPoint>();
                var blueprint       = areaEnterPoints.FirstOrDefault(bp => bp is BlueprintAreaEnterPoint ep && ep.Area == area);

                if (blueprint is BlueprintAreaEnterPoint enterPoint)
                {
                    GameHelper.EnterToArea(enterPoint, AutoSaveMode.None);
                }
            });

            BlueprintAction.Register <BlueprintGlobalMapPoint>("Teleport", (globalMapPoint, ch, n, index) => {
                if (!Teleport.TeleportToGlobalMapPoint(globalMapPoint))
                {
                    Teleport.TeleportToGlobalMap(() => Teleport.TeleportToGlobalMapPoint(globalMapPoint));
                }
            });

            //Army
            BlueprintAction.Register <BlueprintArmyPreset>("Add", (bp, ch, n, l) => {
                Actions.CreateArmy(bp);
            });

            //ArmyGeneral
            BlueprintAction.Register <BlueprintLeaderSkill>("Add",
                                                            (bp, ch, n, l) => Actions.AddSkillToLeader(bp),
                                                            (bp, ch, index) => Actions.LeaderSelected(bp) && !Actions.LeaderHasSkill(bp));

            //ArmyGeneral
            BlueprintAction.Register <BlueprintLeaderSkill>("Remove",
                                                            (bp, ch, n, l) => Actions.RemoveSkillFromLeader(bp),
                                                            (bp, ch, index) => Actions.LeaderSelected(bp) && Actions.LeaderHasSkill(bp));
#endif
        }