/* * Refer MainMenu.StartChargen which also calls CharacterBuildController.HandleLevelUpStart * */ internal static void TestLevelup() { var unit = CreateUnit(); var descriptorJson = UnitSerialization.Serialize(unit.Descriptor);; if (Main.settings.ShowDollRoom) { ShowDollRoom(unit); } CharacterBuildController characterBuildController = Game.Instance.UI.CharacterBuildController; LevelPlanManager.CurrentLevelUpController = LevelUpController.Start( unit: unit.Descriptor, instantCommit: false, unitJson: descriptorJson, onSuccess: null, mode: LevelUpState.CharBuildMode.CharGen); /*CurrentLevelUpController.SelectPortrait(Game.Instance.BlueprintRoot.CharGen.Portraits[0]); * CurrentLevelUpController.SelectGender(Gender.Male); * CurrentLevelUpController.SelectRace(Game.Instance.BlueprintRoot.Progression.CharacterRaces[0]); * CurrentLevelUpController.SelectAlignment(Kingmaker.Enums.Alignment.TrueNeutral); * CurrentLevelUpController.SelectVoice(Game.Instance.BlueprintRoot.CharGen.MaleVoices[0]); * CurrentLevelUpController.SelectName("LevelPlan");*/ Traverse.Create(characterBuildController).Property <LevelUpController>("LevelUpController").Value = LevelPlanManager.CurrentLevelUpController; characterBuildController.Unit = unit.Descriptor; characterBuildController.Show(true); }
private void StartPreviewThread([CanBeNull] JToken unitJson) { if (unitJson == null) { unitJson = UnitSerialization.Serialize(this.Unit); } LevelUpPreviewThread.Start(unitJson); }
internal static void TestDefaultLevelPlan2() { var defaultClass = ResourcesLibrary.TryGetBlueprint <BlueprintCharacterClass>("0937bec61c0dabc468428f496580c721"); //Alchemist var defaultBuild = defaultClass.DefaultBuild; var addClassLevels = defaultBuild.GetComponent <AddClassLevels>(); var targetPoints = Main.settings.DefaultPointBuy25 ? 25 : 20; var stats = defaultBuild.GetComponents <StatsDistributionPreset>().FirstOrDefault(sd => sd.TargetPoints == targetPoints); UnitEntityData unitData = Main.settings.DefaultPointBuy25 ? Game.Instance.CreateUnitVacuum(BlueprintRoot.Instance.DefaultPlayerCharacter) : Game.Instance.CreateUnitVacuum(BlueprintRoot.Instance.CustomCompanion); var unit = unitData.Descriptor; LogUnit("BlankUnit.txt", unit); var levelUpController = TestLevelUpController.Start(unit: unit, instantCommit: true, unitJson: null, onSuccess: null, mode: LevelUpState.CharBuildMode.CharGen); bool success = true; success = levelUpController.SelectPortrait(ResourcesLibrary.GetBlueprints <BlueprintPortrait>().First()); if (!success) { Main.Log("Error selecting portrait"); } success = levelUpController.SelectGender(Gender.Male); if (!success) { Main.Log("Error selecting gender"); } var race = ResourcesLibrary.TryGetBlueprint <BlueprintRace>("0a5d473ead98b0646b94495af250fdc4"); //Human race = ResourcesLibrary.TryGetBlueprint <BlueprintRace>("5c4e42124dc2b4647af6e36cf2590500"); //Tiefling success = levelUpController.SelectRace(race); if (!success) { Main.Log("Error selecting race"); } levelUpController.State.SelectedClass = ResourcesLibrary.TryGetBlueprint <BlueprintCharacterClass>("0937bec61c0dabc468428f496580c721"); ApplyDefaultBuild(levelUpController); //success = levelUpController.SelectClass(ResourcesLibrary.TryGetBlueprint<BlueprintCharacterClass>("0937bec61c0dabc468428f496580c721")); //if (!success) Main.Log("Error selecting class"); //levelUpController.ApplyClassMechanics(); //levelUpController.ApplySpellbook(); //levelUpController.SelectDefaultClassBuild(); var levelPlanHolder = new LevelPlanHolder(); for (int i = 0; i < 20; i++) { var plan = unit.Progression.GetLevelPlan(i + 1); levelPlanHolder.LevelPlanData[i] = plan; } LevelPlanManager.CurrentLevelPlan = levelPlanHolder; var token = UnitSerialization.Serialize(unit); File.WriteAllText("TestDefaultAlch.json", token.ToString()); LogUnit("TestDefaultAlch.txt", unit); }
static void CreateLevelPlan() { var unit = Game.Instance.Player.MainCharacter.Value.Descriptor; var unitJson = UnitSerialization.Serialize(unit); CharacterBuildController characterBuildController = Game.Instance.UI.CharacterBuildController; CurrentLevelUpController = LevelUpController.Start( unit: unit, instantCommit: false, unitJson: unitJson, onSuccess: null, mode: LevelUpState.CharBuildMode.PreGen); Traverse.Create(characterBuildController).Property <LevelUpController>("LevelUpController").Value = CurrentLevelUpController; Traverse.Create(characterBuildController).Field("Mode").SetValue(CurrentLevelUpController.State.Mode); Traverse.Create(characterBuildController).Field("Unit").SetValue(unit); characterBuildController.Show(true); }
internal static void TestLevelUp() { var defaultClass = ResourcesLibrary.TryGetBlueprint <BlueprintCharacterClass>("0937bec61c0dabc468428f496580c721"); //Alchemist var defaultBuild = defaultClass.DefaultBuild; var addClassLevels = defaultBuild.GetComponent <AddClassLevels>(); var targetPoints = Main.settings.DefaultPointBuy25 ? 25 : 20; var stats = defaultBuild.GetComponents <StatsDistributionPreset>().FirstOrDefault(sd => sd.TargetPoints == targetPoints); UnitEntityData unitData = Main.settings.DefaultPointBuy25 ? Game.Instance.CreateUnitVacuum(BlueprintRoot.Instance.DefaultPlayerCharacter) : Game.Instance.CreateUnitVacuum(BlueprintRoot.Instance.CustomCompanion); var unit = unitData.Descriptor; bool success = false; var levelUpController = TestLevelUpController.Start(unit: unit, instantCommit: true, unitJson: null, onSuccess: null, mode: LevelUpState.CharBuildMode.CharGen); success = levelUpController.SelectPortrait(ResourcesLibrary.GetBlueprints <BlueprintPortrait>().First()); if (!success) { Main.Log("Error selecting portrait"); } success = levelUpController.SelectGender(Gender.Male); if (!success) { Main.Log("Error selecting gender"); } success = levelUpController.SelectRace(ResourcesLibrary.TryGetBlueprint <BlueprintRace>("0a5d473ead98b0646b94495af250fdc4")); if (!success) { Main.Log("Error selecting race"); } success = levelUpController.SelectRaceStat(Kingmaker.EntitySystem.Stats.StatType.Intelligence); if (!success) { Main.Log("Error selecting race stat"); } success = levelUpController.SelectClass(ResourcesLibrary.TryGetBlueprint <BlueprintCharacterClass>("0937bec61c0dabc468428f496580c721")); if (!success) { Main.Log("Error selecting class"); } levelUpController.ApplyClassMechanics(); levelUpController.ApplySpellbook(); success = levelUpController.RemoveStatPoint(Kingmaker.EntitySystem.Stats.StatType.Charisma); success &= levelUpController.RemoveStatPoint(Kingmaker.EntitySystem.Stats.StatType.Charisma); success &= levelUpController.RemoveStatPoint(Kingmaker.EntitySystem.Stats.StatType.Charisma); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Constitution); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Constitution); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Dexterity); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Dexterity); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Dexterity); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Dexterity); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Dexterity); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Dexterity); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Intelligence); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Intelligence); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Intelligence); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Intelligence); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Intelligence); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Intelligence); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Intelligence); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Intelligence); success &= levelUpController.AddStatPoint(Kingmaker.EntitySystem.Stats.StatType.Intelligence); if (!success) { Main.Log("Error selecting stats"); } success = levelUpController.SpendSkillPoint(Kingmaker.EntitySystem.Stats.StatType.SkillUseMagicDevice); success &= levelUpController.SpendSkillPoint(Kingmaker.EntitySystem.Stats.StatType.SkillKnowledgeWorld); success &= levelUpController.SpendSkillPoint(Kingmaker.EntitySystem.Stats.StatType.SkillPerception); success &= levelUpController.SpendSkillPoint(Kingmaker.EntitySystem.Stats.StatType.SkillThievery); success &= levelUpController.SpendSkillPoint(Kingmaker.EntitySystem.Stats.StatType.SkillStealth); success &= levelUpController.SpendSkillPoint(Kingmaker.EntitySystem.Stats.StatType.SkillLoreNature); success &= levelUpController.SpendSkillPoint(Kingmaker.EntitySystem.Stats.StatType.SkillKnowledgeArcana); if (!success) { Main.Log("Error selecting skills"); } var selection = ResourcesLibrary.TryGetBlueprint <BlueprintFeatureSelection>("247a4068296e8be42890143f451b4b45"); //BasicFeatSelection var featurePointBlack = ResourcesLibrary.TryGetBlueprint <BlueprintFeature>("0da0c194d6e1d43419eb8d990b28e0ab"); //PointBlankFeature success = levelUpController.SelectFeature(new FeatureSelectionState(null, null, selection, 0, 0), featurePointBlack); if (!success) { Main.Log("Error selecting point blank"); } var featurePreciseShot = ResourcesLibrary.TryGetBlueprint <BlueprintFeature>("8f3d1e6b4be006f4d896081f2f889665"); //PreciseShotFeature success = levelUpController.SelectFeature(new FeatureSelectionState(null, null, selection, 1, 0), featurePreciseShot); if (!success) { Main.Log("Error selecting precise shot"); } var spells = new List <string>() { "4f8181e7a7f1d904fbaea64220e83379", "5590652e1c2225c4ca30c4a699ab3649", "4e0e9aba6447d514f88eff1464cc4763", "ef768022b0785eb43a18969903c537c4", "2c38da66e5a599347ac95b3294acbe00", "9d504f8dff6e93b4ab6afc938ed6a23d", "24afb2c948c731440a3aaf5411904c89", "c60969e7f264e6d4b84a1499fdcf9039", }; var alchemistSpellBook = ResourcesLibrary.TryGetBlueprint <BlueprintSpellbook>("fcbf2a5447624528a3f333bced844d06"); var alchemistSpellList = ResourcesLibrary.TryGetBlueprint <BlueprintSpellList>("f60d0cd93edc65c42ad31e34a905fb2f"); success = true; for (var i = 0; i < spells.Count; i++) { var spell = ResourcesLibrary.TryGetBlueprint <BlueprintAbility>(spells[i]); success &= levelUpController.SelectSpell(alchemistSpellBook, alchemistSpellList, 1, spell, i); } if (!success) { Main.Log("Error selecting spells"); } success = levelUpController.SelectVoice(ResourcesLibrary.TryGetBlueprint <BlueprintUnitAsksList>("e7b22776ba8e2b84eaaff98e439639a7")); if (!success) { Main.Log("Error selecting voice"); } success = levelUpController.SelectName("ABC"); if (!success) { Main.Log("Error selecting name"); } var token = UnitSerialization.Serialize(unit); File.WriteAllText("TestUnit.json", token.ToString()); LogUnit("TestUnit.txt", unit); }