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 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("}");
                    }
                }
            }
        }
Beispiel #3
0
        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 AttilaRegionsInfo(ImportantPaths importantPaths, RegionMapper map, FactionsInfo factions)
        {
            this.importantPaths = importantPaths;
            getRegionXMLInfo(map, factions);
            AttilaRegionsInfoComparer attilaComp = new AttilaRegionsInfoComparer();

            attilaRegionMappings.Sort(attilaComp);
        }
        private void getRegionXMLInfo(RegionMapper map, FactionsInfo factions)
        {
            attilaRegionMappings = new List <AttilaRegionInfo>();
            string regionPath = importantPaths.getSavegameXMLPath() + "\\region";

            string[] regionXMLs = Directory.GetFiles(regionPath);
            foreach (string regionXML in regionXMLs)
            {
                AttilaRegionInfo regionInfo = new AttilaRegionInfo(importantPaths, regionXML, map, factions);
                attilaRegionMappings.Add(regionInfo);
            }
        }
Beispiel #6
0
        private void readRegionXML(string regionXML, FactionsInfo factions)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(regionXML);
            XmlNode root    = doc.DocumentElement;
            int     nodePos = 0;

            for (XmlNode node = root.FirstChild; node != null; node = node.NextSibling)
            {
                if (node.Name == "rec" || node.Name == "xml_include" || node.Name == "traits")
                {
                    continue;
                }
                if (nodePos == 0)
                {
                    idNum = Int32.Parse(node.InnerText);
                }
                else if (nodePos == 1)
                {
                    idStr = node.InnerText;
                }
                else if (nodePos == 10)
                {
                    int         ownerNumID = Int32.Parse(node.InnerText);
                    FactionInfo faction    = factions.getFactionByNumID(ownerNumID);
                    if (faction != null)
                    {
                        this.owningFaction = faction;
                    }
                }
                else if (nodePos == 23)
                {
                    if (node.Name == "yes")
                    {
                        burned = true;
                    }
                    else
                    {
                        burned = false;
                    }
                }
                nodePos++;
            }
            //string regionSlotPath = importantPaths.getSavegameXMLPath() + "\\region_slot\\" + idStr + "-0.xml";
            //readRegionSlot0(regionSlotPath);
        }
Beispiel #7
0
        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);
                }
            }
        }
Beispiel #8
0
        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);
            }
        }
Beispiel #9
0
        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);
                }
            }
        }
Beispiel #10
0
 public AttilaRegionInfo(ImportantPaths importantPaths, string regionXML, RegionMapper map, FactionsInfo factions)
 {
     this.importantPaths = importantPaths;
     idNum             = 0; idStr = ""; burned = true;
     religionBreakdown = new List <Tuple <string, double> >();
     ck2Regions        = new List <String>();
     readRegionXML(regionXML, factions);
     readPopulation();
     strongestReligion = this.deriveMostPowerfulReligion();
     string[] foundCK2regions = map.getCK2Regions(idStr);
     if (foundCK2regions != null)
     {
         foreach (string region in foundCK2regions)
         {
             ck2Regions.Add(region);
         }
     }
 }
Beispiel #11
0
        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);
        }