public void PrimogenitureAndSeniorityTriggersAreOutputted() { const string outputModName = "outputMod"; var outputFilePath = Path.Combine( "output", outputModName, "common", "scripted_triggers", "IRToCK3_succession_triggers.txt" ); var date = new Date(476, 1, 1); var titles = new Title.LandedTitles(); var kingdomPrimogeniture = titles.Add("k_kingdom1"); kingdomPrimogeniture.SuccessionLaws.Add("single_heir_succession_law"); var kingdomSeniority = titles.Add("k_kingdom2"); kingdomSeniority.SuccessionLaws.Add("single_heir_dynasty_house"); var vassal = titles.Add("d_vassal"); vassal.SuccessionLaws.Add("single_heir_succession_law"); vassal.SetDeFactoLiege(kingdomPrimogeniture, date); // has de facto liege, will not be added to the trigger SystemUtils.TryCreateFolder(CommonFunctions.GetPath(outputFilePath)); SuccessionTriggersOutputter.OutputSuccessionTriggers(outputModName, titles, date); using var file = File.OpenRead(outputFilePath); var reader = new StreamReader(file); Assert.Equal("historical_succession_access_single_heir_succession_law_trigger={", reader.ReadLine()); Assert.Equal("\tOR={", reader.ReadLine()); Assert.Equal($"\t\thas_title=title:{kingdomPrimogeniture.Id}", reader.ReadLine()); Assert.Equal("\t}", reader.ReadLine()); Assert.Equal("}", reader.ReadLine()); Assert.Equal("historical_succession_access_single_heir_dynasty_house_trigger={", reader.ReadLine()); Assert.Equal("\tOR={", reader.ReadLine()); Assert.Equal($"\t\thas_title=title:{kingdomSeniority.Id}", reader.ReadLine()); Assert.Equal("\t}", reader.ReadLine()); Assert.Equal("}", reader.ReadLine()); Assert.True(reader.EndOfStream); }
public static void OutputWorld(World ck3World, IEnumerable <Mod> imperatorMods, Configuration config) { ClearOutputModFolder(); var outputName = config.OutputModName; CreateModFolder(outputName); OutputModFile(outputName); Logger.Info("Creating folders..."); CreateFolders(outputName); Logger.Info("Writing Characters..."); CharactersOutputter.OutputCharacters(outputName, ck3World.Characters, ck3World.CorrectedDate); Logger.Info("Writing Dynasties..."); DynastiesOutputter.OutputDynasties(outputName, ck3World.Dynasties); Logger.Info("Writing Provinces..."); ProvincesOutputter.OutputProvinces(outputName, ck3World.Provinces, ck3World.LandedTitles); Logger.Info("Writing Landed Titles..."); TitlesOutputter.OutputTitles( outputName, ck3World.LandedTitles, config.ImperatorDeJure ); Logger.Info("Writing Succession Triggers..."); SuccessionTriggersOutputter.OutputSuccessionTriggers(outputName, ck3World.LandedTitles, config.CK3BookmarkDate); Logger.Info("Writing Localization..."); LocalizationOutputter.OutputLocalization( config.ImperatorPath, outputName, ck3World, config.ImperatorDeJure ); var outputPath = Path.Combine("output", config.OutputModName); Logger.Info("Copying named colors..."); SystemUtils.TryCopyFile( Path.Combine(config.ImperatorPath, "game", "common", "named_colors", "default_colors.txt"), Path.Combine(outputPath, "common", "named_colors", "imp_colors.txt") ); Logger.Info("Copying Coats of Arms..."); ColoredEmblemsOutputter.CopyColoredEmblems(config, imperatorMods); CoatOfArmsOutputter.OutputCoas(outputName, ck3World.LandedTitles); SystemUtils.TryCopyFolder( Path.Combine(config.ImperatorPath, "game", "gfx", "coat_of_arms", "patterns"), Path.Combine(outputPath, "gfx", "coat_of_arms", "patterns") ); Logger.Info("Copying blankMod files to output..."); SystemUtils.TryCopyFolder( Path.Combine("blankMod", "output"), outputPath ); Logger.Info("Creating bookmark..."); BookmarkOutputter.OutputBookmark(ck3World, config); void ClearOutputModFolder() { var directoryToClear = $"output/{config.OutputModName}"; var di = new DirectoryInfo(directoryToClear); if (!di.Exists) { return; } Logger.Info("Clearing the output mod folder..."); foreach (FileInfo file in di.EnumerateFiles()) { file.Delete(); } foreach (DirectoryInfo dir in di.EnumerateDirectories()) { dir.Delete(true); } } }