Example #1
0
 public static void OnLoad()
 {
     // Combat
     KeyBindings.RegisterAction(RestAll, () => CheatsCombat.RestAll());
     KeyBindings.RegisterAction(RestSelected, () => Cheats.RestSelected());
     KeyBindings.RegisterAction(Empowered, () => CheatsCombat.Empowered(""));
     KeyBindings.RegisterAction(FullBuffPlease, () => CheatsCombat.FullBuffPlease(""));
     KeyBindings.RegisterAction(GoddesBuffs, () => CheatsCombat.Iddqd(""));
     KeyBindings.RegisterAction(RemoveBuffs, () => Actions.RemoveAllBuffs());
     KeyBindings.RegisterAction(RemoveDeathsDoor, () => CheatsCombat.DetachDebuff());
     KeyBindings.RegisterAction(KillAllEnemies, () => CheatsCombat.KillAll());
     //KeyBindings.RegisterAction(SummonZoo, () => CheatsCombat.SpawnInspectedEnemiesUnderCursor(""));
     KeyBindings.RegisterAction(LobotomizeAllEnemies, () => Actions.LobotomizeAllEnemies());
     // Common
     KeyBindings.RegisterAction(TeleportPartyToYou, () => Teleport.TeleportPartyToPlayer());
     KeyBindings.RegisterAction(GoToGlobalMap, () => Teleport.TeleportToGlobalMap());
     KeyBindings.RegisterAction(RerollPerception, () => Actions.RunPerceptionTriggers());
     KeyBindings.RegisterAction(RerollInteractionSkillChecks, () => Actions.RerollInteractionSkillChecks());
     KeyBindings.RegisterAction(ChangeParty, () => { Actions.ChangeParty(); });
     KeyBindings.RegisterAction(ChangWeather, () => CheatsCommon.ChangeWeather(""));
     // Other
     KeyBindings.RegisterAction(TimeScaleMultToggle, () => {
         settings.useAlternateTimeScaleMultiplier = !settings.useAlternateTimeScaleMultiplier;
         Actions.ApplyTimeScale();
     });
     KeyBindings.RegisterAction(PreviewDialogResults, () => {
         settings.previewDialogResults = !settings.previewDialogResults;
         var dialogController          = Game.Instance.DialogController;
     });
     KeyBindings.RegisterAction(ResetAdditionalCameraAngles, () => {
         Main.resetExtraCameraAngles = true;
     });
 }
Example #2
0
            private static void Postfix(ref bool inCombat)
            {
                if (!inCombat && settings.toggleRestoreSpellsAbilitiesAfterCombat)
                {
                    List <UnitEntityData> partyMembers = Game.Instance.Player.PartyAndPets;
                    foreach (UnitEntityData u in partyMembers)
                    {
                        foreach (BlueprintScriptableObject resource in u.Descriptor.Resources)
                        {
                            u.Descriptor.Resources.Restore(resource);
                        }
                        foreach (Spellbook spellbook in u.Descriptor.Spellbooks)
                        {
                            spellbook.Rest();
                        }
                        u.Brain.RestoreAvailableActions();
                    }
                }
                if (!inCombat && settings.toggleInstantRestAfterCombat)
                {
                    CheatsCombat.RestAll();
                }
#if false
                if (!inCombat && settings.toggleRestoreItemChargesAfterCombat)
                {
                    Cheats.RestoreAllItemCharges();
                }

                if (inCombat && StringUtils.ToToggleBool(settings.toggleArmourChecksPenalty0) && StringUtils.ToToggleBool(settings.toggleArmourChecksPenalty0OutOfCombatOnly))
                {
                    foreach (UnitEntityData unitEntityData in Game.Instance.Player.Party)
                    {
                        Common.RecalculateArmourItemStats(unitEntityData);
                    }
                }
                if (!inCombat && StringUtils.ToToggleBool(settings.toggleArmourChecksPenalty0) && StringUtils.ToToggleBool(settings.toggleArmourChecksPenalty0OutOfCombatOnly))
                {
                    foreach (UnitEntityData unitEntityData in Game.Instance.Player.Party)
                    {
                        Common.RecalculateArmourItemStats(unitEntityData);
                    }
                }
#endif
            }
Example #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);
                }
            }),
Example #4
0
        public static void OnGUI()
        {
            if (Main.IsInGame)
            {
                UI.BeginHorizontal();
                UI.Space(25);
                UI.Label("increment".cyan(), UI.AutoWidth());
                var increment = UI.IntTextField(ref settings.increment, null, UI.Width(150));
                UI.Space(25);
                UI.Toggle("Dividers", ref settings.showDivisions);
                UI.EndHorizontal();
                var mainChar = Game.Instance.Player.MainCharacter.Value;
                var kingdom  = KingdomState.Instance;
                UI.Div(0, 25);
                UI.HStack("Resources", 1,
                          () => {
                    var money = Game.Instance.Player.Money;
                    UI.Label("Gold".cyan(), UI.Width(150));
                    UI.Label(money.ToString().orange().bold(), UI.Width(200));
                    UI.ActionButton($"Gain {increment}", () => Game.Instance.Player.GainMoney(increment), UI.AutoWidth());
                    UI.ActionButton($"Lose {increment}", () => {
                        var loss = Math.Min(money, increment);
                        Game.Instance.Player.GainMoney(-loss);
                    }, UI.AutoWidth());
                },
                          () => {
                    var exp = mainChar.Progression.Experience;
                    UI.Label("Experience".cyan(), UI.Width(150));
                    UI.Label(exp.ToString().orange().bold(), UI.Width(200));
                    UI.ActionButton($"Gain {increment}", () => {
                        Game.Instance.Player.GainPartyExperience(increment);
                    }, UI.AutoWidth());
                });
                if (kingdom != null)
                {
                    UI.Div(0, 25);
                    UI.HStack("Kingdom", 1,
                              () => {
                        UI.Label("Finances".cyan(), UI.Width(150));
                        UI.Label(kingdom.Resources.Finances.ToString().orange().bold(), UI.Width(200));
                        UI.ActionButton($"Gain {increment}", () => {
                            kingdom.Resources += KingdomResourcesAmount.FromFinances(increment);
                        }, UI.AutoWidth());
                        UI.ActionButton($"Lose {increment}", () => {
                            kingdom.Resources -= KingdomResourcesAmount.FromFinances(increment);
                        }, UI.AutoWidth());
                    },
                              () => {
                        UI.Label("Materials".cyan(), UI.Width(150));
                        UI.Label(kingdom.Resources.Materials.ToString().orange().bold(), UI.Width(200));
                        UI.ActionButton($"Gain {increment}", () => {
                            kingdom.Resources += KingdomResourcesAmount.FromMaterials(increment);
                        }, UI.AutoWidth());
                        UI.ActionButton($"Lose {increment}", () => {
                            kingdom.Resources -= KingdomResourcesAmount.FromMaterials(increment);
                        }, UI.AutoWidth());
                    },
                              () => {
                        UI.Label("Favors".cyan(), UI.Width(150));
                        UI.Label(kingdom.Resources.Favors.ToString().orange().bold(), UI.Width(200));
                        UI.ActionButton($"Gain {increment}", () => {
                            kingdom.Resources += KingdomResourcesAmount.FromFavors(increment);
                        }, UI.AutoWidth());
                        UI.ActionButton($"Lose {increment}", () => {
                            kingdom.Resources -= KingdomResourcesAmount.FromFavors(increment);
                        }, UI.AutoWidth());
                    });
                }
            }
            UI.Div(0, 25);
            UI.HStack("Combat", 4,
                      () => UI.ActionButton("Rest All", () => CheatsCombat.RestAll()),
                      () => UI.ActionButton("Empowered", () => CheatsCombat.Empowered("")),
                      () => UI.ActionButton("Full Buff Please", () => CheatsCombat.FullBuffPlease("")),
                      () => UI.ActionButton("Remove Buffs", () => Actions.RemoveAllBuffs()),
                      () => UI.ActionButton("Remove Death's Door", () => CheatsCombat.DetachDebuff()),
                      () => UI.ActionButton("Kill All Enemies", () => CheatsCombat.KillAll()),
                      () => UI.ActionButton("Summon Zoo", () => CheatsCombat.SpawnInspectedEnemiesUnderCursor(""))
                      );
            UI.Div(0, 25);
            UI.HStack("Common", 4,
                      () => UI.ActionButton("Teleport Party To You", () => Actions.TeleportPartyToPlayer()),
                      () => UI.ActionButton("Go To Global Map", () => Actions.TeleportToGlobalMap()),
                      () => UI.ActionButton("Perception Checks", () => Actions.RunPerceptionTriggers()),
                      () => {
                UI.ActionButton("Set Perception to 40", () => {
                    CheatsCommon.StatPerception();
                    Actions.RunPerceptionTriggers();
                });
            },
                      () => UI.ActionButton("Change Weather", () => CheatsCommon.ChangeWeather("")),
                      () => UI.ActionButton("Give All Items", () => CheatsUnlock.CreateAllItems("")),
                      //                    () => { UI.ActionButton("Change Party", () => { Actions.ChangeParty(); }); },
                      () => { }
                      );
            UI.Div(0, 25);
            UI.HStack("Unlocks", 4, () => {
                UI.ActionButton("All Mythic Paths", () => Actions.UnlockAllMythicPaths());
                UI.Space(25);
                UI.Label("Warning! Using this might break your game somehow. Recommend for experimental tinkering like trying out different builds, and not for actually playing the game.".green());
            });
            UI.Div(0, 25);
            UI.HStack("Preview", 0, () => {
                UI.Toggle("Dialog Results", ref settings.previewDialogResults, 0);
                UI.Toggle("Dialog Alignment", ref settings.previewAlignmentRestrictedDialog, 0);
                UI.Toggle("Random Encounters", ref settings.previewRandomEncounters, 0);
                UI.Toggle("Events", ref settings.previewEventResults, 0);
            });
            UI.Div(0, 25);
            UI.HStack("Tweaks", 1,
                      () => UI.Toggle("Object Highlight Toggle Mode", ref settings.highlightObjectsToggle, 0),
                      () => UI.Toggle("Whole Team Moves Same Speed", ref settings.toggleMoveSpeedAsOne, 0),

                      () => UI.Toggle("Infinite Abilities", ref settings.toggleInfiniteAbilities, 0),
                      () => UI.Toggle("Infinite Spell Casts", ref settings.toggleInfiniteSpellCasts, 0),

                      () => UI.Toggle("Unlimited Actions During Turn", ref settings.toggleUnlimitedActionsPerTurn, 0),
                      () => UI.Toggle("Infinite Charges On Items", ref settings.toggleInfiniteItems, 0),

                      () => UI.Toggle("Instant Cooldown", ref settings.toggleInstantCooldown, 0),
                      () => UI.Toggle("Spontaneous Caster Scroll Copy", ref settings.toggleSpontaneousCopyScrolls, 0),

                      () => UI.Toggle("Disable Equipment Restrictions", ref settings.toggleEquipmentRestrictions, 0),
                      () => UI.Toggle("Disable Dialog Restrictions", ref settings.toggleDialogRestrictions, 0),

                      () => UI.Toggle("No Friendly Fire On AOEs", ref settings.toggleNoFriendlyFireForAOE, 0),
                      () => UI.Toggle("Free Meta-Magic", ref settings.toggleMetamagicIsFree, 0),

                      () => UI.Toggle("No Fog Of War", ref settings.toggleNoFogOfWar, 0),
                      () => UI.Toggle("No Material Components", ref settings.toggleMaterialComponent, 0),
                      //() => UI.Toggle("Restore Spells & Skills After Combat", ref settings.toggleRestoreSpellsAbilitiesAfterCombat,0),
                      //() => UI.Toggle("Access Remote Characters", ref settings.toggleAccessRemoteCharacters,0),
                      //() => UI.Toggle("Show Pet Portraits", ref settings.toggleShowAllPartyPortraits,0),
                      () => UI.Toggle("Instant Rest After Combat", ref settings.toggleInstantRestAfterCombat, 0),
                      () => UI.Toggle("Auto Load Last Save On Launch", ref settings.toggleAutomaticallyLoadLastSave, 0),
                      () => { }
                      );
            UI.Div(153, 25);
            UI.HStack("", 1,
                      () => UI.EnumGrid("Disable Attacks Of Opportunity", ref settings.noAttacksOfOpportunitySelection, 0, UI.AutoWidth()),
                      () => UI.EnumGrid("Can Move Through", ref settings.allowMovementThroughSelection, 0, UI.AutoWidth()),
                      () => { UI.Space(328); UI.Label("This allows characters you control to move through the selected category of units during combat".green(), UI.AutoWidth()); }
#if false
                      () => { UI.Slider("Collision Radius Multiplier", ref settings.collisionRadiusMultiplier, 0f, 2f, 1f, 1, "", UI.AutoWidth()); },
Example #5
0
        public static void OnGUI()
        {
            if (Main.IsInGame)
            {
                UI.BeginHorizontal();
                UI.Space(25);
                UI.Label("increment".cyan(), UI.AutoWidth());
                var increment = UI.IntTextField(ref settings.increment, null, UI.Width(150));
                UI.Space(25);
                UI.Toggle("Dividers", ref settings.showDivisions);
                UI.EndHorizontal();
                var mainChar = Game.Instance.Player.MainCharacter.Value;
                var kingdom  = KingdomState.Instance;
                UI.Div(0, 25);
                UI.HStack("Resources", 1,
                          () => {
                    var money = Game.Instance.Player.Money;
                    UI.Label("Gold".cyan(), UI.Width(150));
                    UI.Label(money.ToString().orange().bold(), UI.Width(200));
                    UI.ActionButton($"Gain {increment}", () => { Game.Instance.Player.GainMoney(increment); }, UI.AutoWidth());
                    UI.ActionButton($"Lose {increment}", () => {
                        var loss = Math.Min(money, increment);
                        Game.Instance.Player.GainMoney(-loss);
                    }, UI.AutoWidth());
                },
                          () => {
                    var exp = mainChar.Progression.Experience;
                    UI.Label("Experience".cyan(), UI.Width(150));
                    UI.Label(exp.ToString().orange().bold(), UI.Width(200));
                    UI.ActionButton($"Gain {increment}", () => {
                        Game.Instance.Player.GainPartyExperience(increment);
                    }, UI.AutoWidth());
                });
                if (kingdom != null)
                {
                    UI.Div(0, 25);
                    UI.HStack("Kingdom", 1,
                              () => {
                        UI.Label("Finances".cyan(), UI.Width(150));
                        UI.Label(kingdom.Resources.Finances.ToString().orange().bold(), UI.Width(200));
                        UI.ActionButton($"Gain {increment}", () => {
                            kingdom.Resources += KingdomResourcesAmount.FromFinances(increment);
                        }, UI.AutoWidth());
                        UI.ActionButton($"Lose {increment}", () => {
                            kingdom.Resources -= KingdomResourcesAmount.FromFinances(increment);
                        }, UI.AutoWidth());
                    },
                              () => {
                        UI.Label("Materials".cyan(), UI.Width(150));
                        UI.Label(kingdom.Resources.Materials.ToString().orange().bold(), UI.Width(200));
                        UI.ActionButton($"Gain {increment}", () => {
                            kingdom.Resources += KingdomResourcesAmount.FromMaterials(increment);
                        }, UI.AutoWidth());
                        UI.ActionButton($"Lose {increment}", () => {
                            kingdom.Resources -= KingdomResourcesAmount.FromMaterials(increment);
                        }, UI.AutoWidth());
                    },
                              () => {
                        UI.Label("Favors".cyan(), UI.Width(150));
                        UI.Label(kingdom.Resources.Favors.ToString().orange().bold(), UI.Width(200));
                        UI.ActionButton($"Gain {increment}", () => {
                            kingdom.Resources += KingdomResourcesAmount.FromFavors(increment);
                        }, UI.AutoWidth());
                        UI.ActionButton($"Lose {increment}", () => {
                            kingdom.Resources -= KingdomResourcesAmount.FromFavors(increment);
                        }, UI.AutoWidth());
                    });
                }
            }
            UI.Div(0, 25);
            UI.HStack("Combat", 4,
                      () => { UI.ActionButton("Rest All", () => { CheatsCombat.RestAll(); }); },
                      () => { UI.ActionButton("Empowered", () => { CheatsCombat.Empowered(""); }); },
                      () => { UI.ActionButton("Full Buff Please", () => { CheatsCombat.FullBuffPlease(""); }); },
                      () => { UI.ActionButton("Remove Buffs", () => { Actions.RemoveAllBuffs(); }); },
                      () => { UI.ActionButton("Remove Death's Door", () => { CheatsCombat.DetachDebuff(); }); },
                      () => { UI.ActionButton("Kill All Enemies", () => { CheatsCombat.KillAll(); }); },
                      () => { UI.ActionButton("Summon Zoo", () => { CheatsCombat.SpawnInspectedEnemiesUnderCursor(""); }); }
                      );
            UI.Div(0, 25);
            UI.HStack("Common", 4,
                      () => { UI.ActionButton("Teleport Party To You", () => { Actions.TeleportPartyToPlayer(); }); },
                      () => { UI.ActionButton("Perception Checks", () => { Actions.RunPerceptionTriggers(); }); },
                      () => {
                UI.ActionButton("Set Perception to 40", () => {
                    CheatsCommon.StatPerception();
                    Actions.RunPerceptionTriggers();
                });
            },
                      () => { UI.ActionButton("Change Weather", () => { CheatsCommon.ChangeWeather(""); }); },
                      () => { UI.ActionButton("Give All Items", () => { CheatsUnlock.CreateAllItems(""); }); },
                      //                    () => { UI.ActionButton("Change Party", () => { Actions.ChangeParty(); }); },
                      () => { }
                      );
            UI.Div(0, 25);
            UI.HStack("Unlocks", 4, () => {
                UI.ActionButton("All Mythic Paths", () => { Actions.UnlockAllMythicPaths(); });
                UI.Space(25);
                UI.Label("Warning! Using this might break your game somehow. Recommend for experimental tinkering like trying out different builds, and not for actually playing the game.".green());
            });
            UI.Div(0, 25);
            UI.HStack("Preview", 0, () => {
                UI.Toggle("Dialog Results", ref settings.previewDialogResults, 0);
                UI.Toggle("Dialog Alignment", ref settings.previewAlignmentRestrictedDialog, 0);
                UI.Toggle("Random Encounters", ref settings.previewRandomEncounters, 0);
                UI.Toggle("Events", ref settings.previewEventResults, 0);
            });
            UI.Div(0, 25);
            UI.HStack("Tweaks", 1,
                      () => { UI.Toggle("Object Highlight Toggle Mode", ref settings.highlightObjectsToggle, 0); },
                      () => { UI.Toggle("Whole Team Moves Same Speed", ref settings.toggleMoveSpeedAsOne, 0); },

                      () => { UI.Toggle("Infinite Abilities", ref settings.toggleInfiniteAbilities, 0); },
                      () => { UI.Toggle("Infinite Spell Casts", ref settings.toggleInfiniteSpellCasts, 0); },

                      () => { UI.Toggle("Unlimited Actions During Turn", ref settings.toggleUnlimitedActionsPerTurn, 0); },
                      () => { UI.Toggle("Infinite Charges On Items", ref settings.toggleInfiniteItems, 0); },

                      () => { UI.Toggle("Instant Cooldown", ref settings.toggleInstantCooldown, 0); },
                      () => { UI.Toggle("Spontaneous Caster Scroll Copy", ref settings.toggleSpontaneousCopyScrolls, 0); },

                      () => { UI.Toggle("Disable Equipment Restrictions", ref settings.toggleEquipmentRestrictions, 0); },
                      () => { UI.Toggle("Disable Dialog Restrictions", ref settings.toggleDialogRestrictions, 0); },

                      () => { UI.Toggle("No Friendly Fire On AOEs", ref settings.toggleNoFriendlyFireForAOE, 0); },
                      () => { UI.Toggle("Free Meta-Magic", ref settings.toggleMetamagicIsFree, 0); },

                      () => { UI.Toggle("No Fog Of War", ref settings.toggleNoFogOfWar, 0); },
                      () => { UI.Toggle("No Material Components", ref settings.toggleMaterialComponent, 0); },
                      //() => { UI.Toggle("Restore Spells & Skills After Combat", ref settings.toggleRestoreSpellsAbilitiesAfterCombat,0); },
                      //() => { UI.Toggle("Access Remote Characters", ref settings.toggleAccessRemoteCharacters,0); },
                      //() => { UI.Toggle("Show Pet Portraits", ref settings.toggleShowAllPartyPortraits,0); },
                      () => { UI.Toggle("Instant Rest After Combat", ref settings.toggleInstantRestAfterCombat, 0); },
                      () => { UI.Toggle("Auto Load Last Save On Launch", ref settings.toggleAutomaticallyLoadLastSave, 0); },
                      () => { }
                      );
            UI.Div(153, 25);
            UI.HStack("", 1,
                      () => {
                UI.EnumGrid("Disable Attacks Of Opportunity",
                            ref settings.noAttacksOfOpportunitySelection, 0, UI.AutoWidth());
            },
                      () => {
                UI.EnumGrid("Can Move Through", ref settings.allowMovementThroughSelection, 0, UI.AutoWidth());
            },
                      () => { UI.Space(328); UI.Label("This allows characters you control to move through the selected category of units during combat".green(), UI.AutoWidth()); },
#if false
                      () => { UI.Slider("Collision Radius Multiplier", ref settings.collisionRadiusMultiplier, 0f, 2f, 1f, 1, "", UI.AutoWidth()); },
#endif
                      () => { }
                      );
            UI.Div(0, 25);
            UI.HStack("Level Up", 1,
                      () => { UI.Slider("Feature Selection Multiplier", ref settings.featsMultiplier, 0, 10, 1, "", UI.AutoWidth()); },
                      () => { UI.Toggle("Always Able To Level Up", ref settings.toggleNoLevelUpRestrictions, 0); },
                      () => { UI.Toggle("Add Full Hit Die Value", ref settings.toggleFullHitdiceEachLevel, 0); },
                      () => {
                UI.Toggle("Ignore Class And Feat Restrictions", ref settings.toggleIgnorePrerequisites, 0);
                UI.Space(25);
                UI.Label("Experimental".cyan() + ": in addition to regular leveling, this allows you to choose any mythic class each time you level up starting from level 1. This may have interesting and unexpected effects. Backup early and often...".green());
            },
                      () => { UI.Toggle("Ignore Prerequisites When Choosing A Feat", ref settings.toggleFeaturesIgnorePrerequisites, 0); },
                      () => { UI.Toggle("Ignore Caster Type And Spell Level Restrictions", ref settings.toggleIgnoreCasterTypeSpellLevel, 0); },
                      () => { UI.Toggle("Ignore Forbidden Archetypes", ref settings.toggleIgnoreForbiddenArchetype, 0); },
                      () => { UI.Toggle("Ignore Required Stat Values", ref settings.toggleIgnorePrerequisiteStatValue, 0); },
                      () => { UI.Toggle("Ignore Alignment When Choosing A Class", ref settings.toggleIgnoreAlignmentWhenChoosingClass, 0); },
                      () => { UI.Toggle("Skip Spell Selection", ref settings.toggleSkipSpellSelection, 0); },

#if false
                      // Do we need these or is it covered by toggleFeaturesIgnorePrerequisites
                      () => { UI.Toggle("Ignore Feat Prerequisites When Choosing A Class", ref settings.toggleIgnoreFeaturePrerequisitesWhenChoosingClass, 0); },
                      () => { UI.Toggle("Ignore Feat Prerequisits (List) When Choosing A Class", ref settings.toggle, 0); },
#endif

                      () => { }
                      );
            UI.Div(0, 25);
            UI.HStack("Multipliers", 1,
                      () => { UI.LogSlider("Experience", ref settings.experienceMultiplier, 0f, 20, 1, 1, "", UI.AutoWidth()); },
                      () => { UI.LogSlider("Money Earned", ref settings.moneyMultiplier, 0f, 20, 1, 1, "", UI.AutoWidth()); },
                      () => { UI.LogSlider("Vendor Sell Price", ref settings.vendorSellPriceMultiplier, 0f, 20, 1, 1, "", UI.AutoWidth()); },
                      () => { UI.LogSlider("Vendor Buy Price", ref settings.vendorBuyPriceMultiplier, 0f, 20, 1, 1, "", UI.AutoWidth()); },
                      () => { UI.Slider("Encumberance", ref settings.encumberanceMultiplier, 1, 100, 1, "", UI.AutoWidth()); },
                      () => { UI.LogSlider("Spells Per Day", ref settings.spellsPerDayMultiplier, 0f, 20, 1, 1, "", UI.AutoWidth()); },
                      () => { UI.LogSlider("Movement Speed", ref settings.partyMovementSpeedMultiplier, 0f, 20, 1, 1, "", UI.AutoWidth()); },
                      () => { UI.LogSlider("Travel Speed", ref settings.travelSpeedMultiplier, 0f, 20, 1, 1, "", UI.AutoWidth()); },
                      () => { UI.LogSlider("Companion Cost", ref settings.companionCostMultiplier, 0, 20, 1, 1, "", UI.AutoWidth()); },
                      () => { UI.LogSlider("Enemy HP Multiplier", ref settings.enemyBaseHitPointsMultiplier, 0f, 20, 1, 1, "", UI.AutoWidth()); },
                      () => { UI.LogSlider("Buff Duration", ref settings.buffDurationMultiplierValue, 0f, 100, 1, 1, "", UI.AutoWidth()); },
                      () => { }
                      );
            UI.Div(0, 25);
            UI.HStack("Dice Rolls", 1,
                      () => UI.EnumGrid("All Hits Critical", ref settings.allHitsCritical, 0, UI.AutoWidth()),
                      () => UI.EnumGrid("Roll With Avantage", ref settings.rollWithAdvantage, 0, UI.AutoWidth()),
                      () => UI.EnumGrid("Roll With Disavantage", ref settings.rollWithDisadvantage, 0, UI.AutoWidth()),
                      () => UI.EnumGrid("Always Roll 20", ref settings.alwaysRoll20, 0, UI.AutoWidth()),
                      () => UI.EnumGrid("Always Roll 1", ref settings.alwaysRoll1, 0, UI.AutoWidth()),
                      () => UI.EnumGrid("Never Roll 20", ref settings.neverRoll20, 0, UI.AutoWidth()),
                      () => UI.EnumGrid("Never Roll 1", ref settings.neverRoll1, 0, UI.AutoWidth()),
                      () => UI.EnumGrid("Always Roll 20 Initiative ", ref settings.roll20Initiative, 0, UI.AutoWidth()),
                      () => UI.EnumGrid("Always Roll 1 Initiative", ref settings.roll1Initiative, 0, UI.AutoWidth()),
                      () => { }
                      );
            UI.Div(0, 25);
            UI.HStack("Character Creation", 1,
                      () => { UI.Slider("Build Points (Main)", ref settings.characterCreationAbilityPointsPlayer, 1, 200, 25, "", UI.AutoWidth()); },
                      () => { UI.Slider("Build Points (Mercenary)", ref settings.characterCreationAbilityPointsMerc, 1, 200, 20, "", UI.AutoWidth()); },
                      () => { UI.Slider("Ability Max", ref settings.characterCreationAbilityPointsMax, 0, 50, 18, "", UI.AutoWidth()); },
                      () => { UI.Slider("Ability Min", ref settings.characterCreationAbilityPointsMin, 0, 50, 7, "", UI.AutoWidth()); },
                      () => { }
                      );
            UI.Div(0, 25);
            UI.HStack("Crusade", 1,
                      () => { UI.Toggle("Instant Events", ref settings.toggleInstantEvent, 0); },
                      () => {
                UI.Slider("Build Time Modifer", ref settings.kingdomBuildingTimeModifier, -10, 10, 0, 1, "", UI.AutoWidth());
                var instance = KingdomState.Instance;
                if (instance != null)
                {
                    instance.BuildingTimeModifier = settings.kingdomBuildingTimeModifier;
                }
            },
                      () => { }
                      );
            UI.Space(25);
        }
Example #6
0
            private static void Postfix(ref bool inCombat)
            {
                if (!inCombat && settings.toggleRestoreSpellsAbilitiesAfterCombat)
                {
                    var partyMembers = Game.Instance.Player.PartyAndPets;
                    foreach (var u in partyMembers)
                    {
                        foreach (var resource in u.Descriptor.Resources)
                        {
                            u.Descriptor.Resources.Restore(resource);
                        }
                        foreach (var spellbook in u.Descriptor.Spellbooks)
                        {
                            spellbook.Rest();
                        }
                        u.Brain.RestoreAvailableActions();
                    }
                }
                if (!inCombat && settings.toggleRechargeItemsAfterCombat)
                {
                }
                if (!inCombat && settings.toggleInstantRestAfterCombat)
                {
                    CheatsCombat.RestAll();
                }
                if (inCombat && (settings.toggleEnterCombatAutoRage || settings.toggleEnterCombatAutoRage))
                {
                    foreach (var unit in Game.Instance.Player.Party)
                    {
                        var flag = true;
                        if (settings.toggleEnterCombatAutoRageDemon)   // we prefer demon rage, as it's more powerful
                        {
                            foreach (var ability in unit.Abilities)
                            {
                                if (ability.Blueprint.AssetGuid == rage_demon && ability.Data.IsAvailableForCast)
                                {
                                    Kingmaker.RuleSystem.Rulebook.Trigger(new RuleCastSpell(ability.Data, unit));
                                    ability.Data.Spend();
                                    flag = false; // if demon rage is active, we skip the normal rage checks
                                    break;
                                }
                            }
                        }
                        if (flag && settings.toggleEnterCombatAutoRage)
                        {
                            foreach (var activatable in unit.ActivatableAbilities)
                            {
                                if (activatable.Blueprint.AssetGuid == rage_barbarian ||
                                    activatable.Blueprint.AssetGuid == rage_blood ||
                                    activatable.Blueprint.AssetGuid == rage_focused)
                                {
                                    activatable.IsOn = true;
                                    break;
                                }
                            }
                        }
                    }
                }
#if false
                if (!inCombat && settings.toggleRestoreItemChargesAfterCombat)
                {
                    Cheats.RestoreAllItemCharges();
                }

                if (inCombat && StringUtils.ToToggleBool(settings.toggleArmourChecksPenalty0) && StringUtils.ToToggleBool(settings.toggleArmourChecksPenalty0OutOfCombatOnly))
                {
                    foreach (UnitEntityData unitEntityData in Game.Instance.Player.Party)
                    {
                        Common.RecalculateArmourItemStats(unitEntityData);
                    }
                }
                if (!inCombat && StringUtils.ToToggleBool(settings.toggleArmourChecksPenalty0) && StringUtils.ToToggleBool(settings.toggleArmourChecksPenalty0OutOfCombatOnly))
                {
                    foreach (UnitEntityData unitEntityData in Game.Instance.Player.Party)
                    {
                        Common.RecalculateArmourItemStats(unitEntityData);
                    }
                }
#endif
            }