public Form1() { cultureMaps = new CultureMaps(); regionMap = new RegionMapper(); ck2RegionsInfo = new CK2CountyRegionsInfo(regionMap); religionsInfo = new ReligionsInfo(); factionsInfo = new FactionsInfo(); InitializeComponent(); psr = new ProjectSettingsReader(); string savegameXMLPath = psr.getSavegameXMLLocation(); importantPaths = new ImportantPaths(savegameXMLPath); //Init dating system DateConverter dtConverter = new DateConverter(importantPaths); //Generate characters located in faction array (these characters are alive) CharInfoCreator charInfoCreator = new CharInfoCreator(importantPaths, dtConverter, religionsInfo); //Build family tree and generate dead characters FamilyTrees famTrees = new FamilyTrees(importantPaths, charInfoCreator, dtConverter); //Update faction-specific information with save game data factionsInfo.updateImportantPaths(importantPaths); factionsInfo.readFactionXMLs(); //Init region information attilaRegionsInfo = new AttilaRegionsInfo(importantPaths, regionMap, factionsInfo); //Generate de jure titles deJureTitles = new DeJureTitles(attilaRegionsInfo); //Update other information regarding factions and regions factionsInfo.updateFactionsInfo(attilaRegionsInfo); //Process family trees with regards to faction settings. (Dynasty update occurs here) factionsInfo.readFamilyTrees(famTrees); DirectoryHierarchyCreator.createOutputDirectories(); MoveFlags.move(factionsInfo); MoveCultures.move(); OutputCommonLandedTitles.output(factionsInfo); OutputCommonLandedTitles.outputDeJure(deJureTitles); OutputCommonDynasties.output(famTrees); //OutputCommonCultures.outputProvinceSpecific(attilaRegionsInfo); OutputCharacterHistories.output(factionsInfo); OutputProvinceHistories.output(attilaRegionsInfo, ck2RegionsInfo, religionsInfo); OutputTitleHistories.outputCountyHistory(factionsInfo); OutputTitleHistories.outputFactionTitleHistory(factionsInfo); OutputTitleLocalisation.output(factionsInfo); OutputTitleLocalisation.outputDeJure(deJureTitles); OutputCultureLocalisation.outputCultureGroups(cultureMaps); OutputCultureLocalisation.outputCultures(cultureMaps); }
private List <Tuple <String, String> > getCharXMLLocs(ImportantPaths importantPaths, ReligionsInfo religions) { string factionsPath = importantPaths.getSavegameXMLPath() + "\\factions"; string[] factionXMLs = Directory.GetFiles(factionsPath); List <Tuple <String, String> > charXMLs = new List <Tuple <String, String> >(); foreach (string xmlPath in factionXMLs) { string[] dirItems = xmlPath.Split('\\'); string absoluteName = dirItems[dirItems.Length - 1]; if (!absoluteName.StartsWith("att_fact_")) { continue; } string faction = absoluteName.Substring(0, absoluteName.Length - 4); XmlDocument doc = new XmlDocument(); try { doc.Load(xmlPath); } catch (Exception) { continue; } XmlNode root = doc.DocumentElement; for (XmlNode node = root.FirstChild; node != null; node = node.NextSibling) { if (node.Attributes.Count == 0) { continue; } XmlAttribute attr = node.Attributes[0]; if (attr.Name == "type" && attr.InnerText == "FACTION_RELIGION_MANAGER") { string attilaReligion = node.FirstChild.InnerText; string ck2Religion = religions.getCK2Religion(attilaReligion); faction2ReligionMap.Add(faction, ck2Religion); } if (attr.Name == "type" && attr.InnerText == "CHARACTER_ARRAY") { for (XmlNode charNode = node.FirstChild; charNode != null; charNode = charNode.NextSibling) { string path = charNode.Attributes[0].InnerText; //Garrison leader if (path.StartsWith("character/colonel")) { continue; } Tuple <String, String> tuple = Tuple.Create <String, String>(faction, path); charXMLs.Add(tuple); } } if (attr.Name == "path" && attr.InnerText.StartsWith("government")) { string governmentLoc = attr.InnerText; governmentLoc = governmentLoc.Replace("/", "\\"); readGovernmentInfo(importantPaths, governmentLoc); } } } return(charXMLs); }
public static void output(AttilaRegionsInfo attilaRegions, CK2CountyRegionsInfo ck2Regions, ReligionsInfo religions) { int count = 0; List <AttilaRegionInfo> attilaList = attilaRegions.getList(); Dictionary <string, CK2CountyRegionInfo> ck2CountiesMap = ck2Regions.getCountiesMap(); foreach (AttilaRegionInfo attilaRegion in attilaList) { List <String> attilasCK2regions = attilaRegion.getCK2Regions(); foreach (String ck2RegionStr in attilasCK2regions) { CK2CountyRegionInfo ck2County = ck2CountiesMap[ck2RegionStr]; writeProvinceHistory(attilaRegion, ck2County, religions); count++; } } count += 0; }
public CharInfoCreator(ImportantPaths importantPaths, DateConverter dtConverter, ReligionsInfo religions) { esfID2Job = new Dictionary <int, string>(); faction2ReligionMap = new Dictionary <string, string>(); faction2CultureMap = buildCultureMap(); List <Tuple <String, String> > charXMLLocs = getCharXMLLocs(importantPaths, religions); nameIDMap = generateNameIDMap(); charInfo = generateCharInfo(importantPaths, charXMLLocs, dtConverter); }
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"); } }