public static void outputCountyHistory(FactionsInfo factions) { string outputDir = ImportantPaths.getOutputPath() + "\\history\\titles"; string countyAcquireDate = "767.1.1"; foreach (FactionInfo faction in factions.getFactions()) { if (!faction.getExists() || faction.getCK2Title() == null) { continue; } HashSet <String> counties = faction.getOwnedCounties(); foreach (String countyStr in counties) { using (StreamWriter writer = File.CreateText(outputDir + "\\" + countyStr + ".txt")) { writer.WriteLine(countyAcquireDate + "={"); writer.WriteLine("\tholder=" + faction.getOwner().getID()); //if (faction.getOwner().getName() == "Giesmus") { // int h = 0; //} writer.WriteLine("}"); } } } }
public static void outputProvinceSpecific(AttilaRegionsInfo attilaRegions) { string outputPath = ImportantPaths.getOutputPath() + "\\common\\cultures\\specialProvCultures.txt"; List <AttilaRegionInfo> regions = attilaRegions.getList(); using (StreamWriter writer = File.CreateText(outputPath)) { writer.WriteLine("iberian = {"); writer.WriteLine("\tgraphical_cultures = { occitangfx }"); writer.WriteLine("\t"); Random rand = new Random(); foreach (AttilaRegionInfo region in regions) { writer.WriteLine("\t" + region.getIDStr() + " = {"); writer.WriteLine("\t\tgraphical_cultures = { southerngfx }"); writer.WriteLine("\t\tsecondary_event_pictures = bedouin_arabic"); writer.WriteLine("\t\t"); double r = (rand.Next(0, 100)) / 100.0; double g = (rand.Next(0, 100)) / 100.0; double b = (rand.Next(0, 100)) / 100.0; writer.WriteLine("\t\tcolor = { " + r + " " + g + " " + b + " }"); writer.WriteLine("\t\t"); writer.WriteLine("\t\tmale_names = { Placeholder }"); writer.WriteLine("\t\tfemale_names = { Placeholder }"); writer.WriteLine("\t\t"); writer.WriteLine("\t\tmodifier = default_culture_modifier"); writer.WriteLine("\t}"); } writer.WriteLine("}"); } }
public static void outputFactionTitleHistory(FactionsInfo factions) { string outputDir = ImportantPaths.getOutputPath() + "\\history\\titles"; string titleAcquireDate = "767.1.1"; foreach (FactionInfo faction in factions.getFactions()) { if (!faction.getExists() || faction.getCK2Title() == null) { continue; } string ck2Title = faction.getCK2Title(); int ownerCharID = faction.getOwner().getID(); using (StreamWriter writer = File.CreateText(outputDir + "\\" + ck2Title + ".txt")) { writer.WriteLine(titleAcquireDate + "={"); writer.WriteLine("\tholder=" + ownerCharID); if (faction.getCK2Title().StartsWith("e_")) { writer.WriteLine("\tlaw=imperial_administration"); writer.WriteLine("\tlaw=succ_primogeniture"); } if (!faction.getIsNewTitle()) { string idName = ("correction_" + faction.getCK2Title()).ToUpper(); string idAdj = ("correction_" + faction.getCK2Title() + "_adj").ToUpper(); writer.WriteLine("name=" + idName); writer.WriteLine("adjective=" + idAdj); } writer.WriteLine("}"); } } }
public static void output(FactionsInfo factionsObj) { List <CK2Character> owners = factionsObj.getOwners(); List <FactionInfo> factions = factionsObj.getFactions(); Dictionary <string, HashSet <CK2Character> > charactersToOutput = new Dictionary <string, HashSet <CK2Character> >(); foreach (FactionInfo faction in factions) { if (!faction.getExists()) { continue; } CK2Character owner = faction.getOwner(); HashSet <int> writtenCharacters = new HashSet <int>(); selectCharacter(writtenCharacters, owner, charactersToOutput); } foreach (var pair in charactersToOutput) { string filename = ImportantPaths.getOutputPath() + "\\history\\characters\\" + pair.Key + ".txt"; HashSet <CK2Character> characters = pair.Value; using (StreamWriter writer = File.CreateText(filename)) { foreach (CK2Character character in characters) { writeCharacter(writer, character); } } } }
public static void move() { string searchDir = ImportantPaths.conversionInfoPath() + "\\cultures\\cultureFiles"; string destDir = ImportantPaths.getOutputPath() + "\\common\\cultures"; string[] searchFiles = Directory.GetFiles(searchDir, "*.txt"); foreach (string searchFile in searchFiles) { string absoluteFilename = Path.GetFileName(searchFile); string destFile = destDir + "\\" + absoluteFilename; File.Copy(searchFile, destFile, true); } }
public static void output(FamilyTrees trees) { List <CK2Dynasty> dynasties = trees.getDynasties(); string filename = ImportantPaths.getOutputPath() + "\\common\\dynasties\\attila_dynasties.txt"; using (StreamWriter writer = File.CreateText(filename)) { foreach (CK2Dynasty dynasty in dynasties) { int id = dynasty.getID(); string name = dynasty.getName(); writeDynasty(writer, id, name); } } }
private static void writeProvinceHistory(AttilaRegionInfo attilaRegion, CK2CountyRegionInfo ck2County, ReligionsInfo religions) { //Remove ifs if going province specific if (attilaRegion.getIsBurned()) { return; } FactionInfo faction = attilaRegion.getOwningFaction(); if (faction.getID().Contains("fact_separatist") || faction.getID().Contains("fact_rebel")) { return; } string filename = ck2County.getFilename(); string outputPath = ImportantPaths.getOutputPath() + "\\history\\provinces\\" + filename; HashSet <String> baronies = ck2County.getBaronies(); using (StreamWriter writer = File.CreateText(outputPath)) { writer.WriteLine("# " + filename.Substring(0, filename.Length - 4)); writer.WriteLine(""); writer.WriteLine("# County Title"); writer.WriteLine("title = " + ck2County.getID()); writer.WriteLine(""); writer.WriteLine("# Settlements"); writer.WriteLine("max_settlements = " + ck2County.getMaxSettlements()); bool wroteBarony = false; foreach (String barony in baronies) { if (wroteBarony == false) { writer.WriteLine(barony + " = castle"); wroteBarony = true; } else { writer.WriteLine("#" + barony + " = castle"); } } writer.WriteLine(""); writer.WriteLine("# Misc"); string culture = faction.getOwner().getCulture(); writer.WriteLine("culture = " + culture); //writer.WriteLine("culture = " + attilaRegion.getIDStr()); writer.WriteLine("religion = " + religions.getCK2Religion(attilaRegion.getMostPowerfulReligion())); writer.WriteLine(""); writer.WriteLine("# History"); } }
public static void outputv1History(CK2CountyRegionsInfo ck2Regions) { Dictionary <string, CK2CountyRegionInfo> counties = ck2Regions.getCountiesMap(); string outputDir = ImportantPaths.getOutputPath() + "\\history\\titles"; foreach (var countyPair in counties) { string countyStr = countyPair.Key; int luckyGuy = 157600001; using (StreamWriter writer = File.CreateText(outputDir + "\\" + countyStr + ".txt")) { writer.WriteLine("767.1.1={"); writer.WriteLine("\tholder=" + luckyGuy); writer.WriteLine("}"); } } }
public static void outputDeJure(DeJureTitles titles) { string outputPath = ImportantPaths.getOutputPath() + "\\common\\landed_titles\\newDeJureTitles.txt"; List <DeJureKingdom> kingdoms = titles.getTitles(); using (StreamWriter writer = File.CreateText(outputPath)) { foreach (DeJureKingdom kingdom in kingdoms) { writeDeJureKingdomInfo(writer, kingdom); List <DeJureDuchy> duchies = kingdom.getDuchies(); foreach (DeJureDuchy duchy in duchies) { writeDeJureDuchyInfo(writer, duchy); } } } }
public static void output(FactionsInfo factionsInfo) { string outputFile = ImportantPaths.getOutputPath() + "\\localisation\\newTitles.csv"; using (StreamWriter writer = File.CreateText(outputFile)) { writer.WriteLine(LocalisationFormatter.header()); foreach (FactionInfo faction in factionsInfo.getFactions()) { if (faction.getCK2Title() == null) { continue; } outputNames(writer, faction); outputAdjectives(writer, faction); } } }
public static void outputDeJure(DeJureTitles titles) { string outputFile = ImportantPaths.getOutputPath() + "\\localisation\\newDeJureTitles.csv"; List <DeJureKingdom> kingdoms = titles.getTitles(); using (StreamWriter writer = File.CreateText(outputFile)) { foreach (DeJureKingdom kingdom in kingdoms) { outputDeJureInfo(writer, true, kingdom.getName(), kingdom.getScreenName(), kingdom.getScreenName()); List <DeJureDuchy> duchies = kingdom.getDuchies(); foreach (DeJureDuchy duchy in duchies) { outputDeJureInfo(writer, false, duchy.getName(), duchy.getScreenName(), duchy.getScreenName()); } } } }
public static void outputCultureGroups(CultureMaps maps) { string outputFile = ImportantPaths.getOutputPath() + "\\localisation\\newGroupCultures.csv"; using (StreamWriter writer = File.CreateText(outputFile)) { writer.WriteLine(LocalisationFormatter.header()); foreach (var pair in maps.getCultureGroupMaps()) { string id = pair.Key; string english = ""; if (pair.Value.Count > 0) { english = pair.Value[0]; } string line = LocalisationFormatter.format(id, english); writer.WriteLine(line); } } }
public static void move(FactionsInfo factions) { string searchDir = ImportantPaths.conversionInfoPath() + "\\factions\\flags"; string destDir = ImportantPaths.getOutputPath() + "\\gfx\\flags"; foreach (FactionInfo faction in factions.getFactions()) { string ck2Title = faction.getCK2Title(); if (ck2Title == null) { continue; } string target = ck2Title.Substring(2) + ".tga"; target = searchDir + "\\" + target; bool flagExists = File.Exists(target); if (!flagExists) { continue; } string dest = destDir + "\\" + ck2Title + ".tga"; File.Copy(target, dest, true); } }
public static void output(FactionsInfo factions) { string outputPath = ImportantPaths.getOutputPath() + "\\common\\landed_titles\\newTitles.txt"; HashSet <string> dupChecker = new HashSet <string>(); using (StreamWriter writer = File.CreateText(outputPath)) { foreach (FactionInfo faction in factions.getFactions()) { if (!faction.getExists()) { continue; } writeTitleInfo(writer, faction, dupChecker); } foreach (FactionInfo faction in factions.getFactions()) { if (faction.getExists()) { continue; } writeTitleInfo(writer, faction, dupChecker); } } }
public static void createOutputDirectories() { string outputDir = ImportantPaths.getOutputPath(); string historyDirectory = outputDir + "\\history"; string historyProvincesDirectory = historyDirectory + "\\provinces"; string historyTitlesDirectory = historyDirectory + "\\titles"; string historyCharactersDirectory = historyDirectory + "\\characters"; if (!Directory.Exists(historyDirectory)) { Directory.CreateDirectory(historyDirectory); } if (!Directory.Exists(historyProvincesDirectory)) { Directory.CreateDirectory(historyProvincesDirectory); } if (!Directory.Exists(historyTitlesDirectory)) { Directory.CreateDirectory(historyTitlesDirectory); } if (!Directory.Exists(historyCharactersDirectory)) { Directory.CreateDirectory(historyCharactersDirectory); } string commonDirectory = outputDir + "\\common"; string commonCulturesDirectory = commonDirectory + "\\cultures"; string commonDynastiesDirectory = commonDirectory + "\\dynasties"; string commonLandedTitlesDirectory = commonDirectory + "\\landed_titles"; if (!Directory.Exists(commonDirectory)) { Directory.CreateDirectory(commonDirectory); } if (!Directory.Exists(commonCulturesDirectory)) { Directory.CreateDirectory(commonCulturesDirectory); } if (!Directory.Exists(commonDynastiesDirectory)) { Directory.CreateDirectory(commonDynastiesDirectory); } if (!Directory.Exists(commonLandedTitlesDirectory)) { Directory.CreateDirectory(commonLandedTitlesDirectory); } string localisationDirectory = outputDir + "\\localisation"; if (!Directory.Exists(localisationDirectory)) { Directory.CreateDirectory(localisationDirectory); } string gfxDirectory = outputDir + "\\gfx"; string gfxFlagsDirectory = gfxDirectory + "\\flags"; if (!Directory.Exists(gfxDirectory)) { Directory.CreateDirectory(gfxDirectory); } if (!Directory.Exists(gfxFlagsDirectory)) { Directory.CreateDirectory(gfxFlagsDirectory); } }