Esempio n. 1
0
 public CK2CountyRegionInfo(RegionMapper map, string provinceHistoryPath)
 {
     shallBeAltered          = false; terrain = null;
     provinceHistoryFilename = System.IO.Path.GetFileName(provinceHistoryPath);
     baronies = new HashSet <String>();
     using (var provinceHistoryReader = new StreamReader(provinceHistoryPath)) {
         while (!provinceHistoryReader.EndOfStream)
         {
             string line = provinceHistoryReader.ReadLine().Trim();
             if (line.StartsWith("title"))
             {
                 regionID = line.Split('=')[1].Trim();
                 if (map.shallBeAltered(regionID))
                 {
                     shallBeAltered = true;
                 }
                 else
                 {
                     shallBeAltered = false;
                 }
             }
             else if (line.StartsWith("max_settlements"))
             {
                 maxSettlements = Int32.Parse(line.Split('=')[1].Trim());
             }
             else if (line.StartsWith("b_"))
             {
                 int    eqSignLoc = line.IndexOf('=');
                 string barony;
                 if (eqSignLoc < 0)
                 {
                     barony = line.Substring(0).Trim();
                 }
                 else
                 {
                     barony = line.Substring(0, eqSignLoc).Trim();
                 }
                 baronies.Add(barony);
             }
             else if (line.StartsWith("#b_"))
             {
                 int    eqSignLoc = line.IndexOf('=');
                 string barony;
                 if (eqSignLoc < 0)
                 {
                     barony = line.Substring(1).Trim();
                 }
                 else
                 {
                     barony = line.Substring(1, eqSignLoc - 1).Trim();
                 }
                 baronies.Add(barony);
             }
             else if (line.StartsWith("terrain"))
             {
                 terrain = line.Split('=')[1].Trim();
             }
         }
     }
 }
Esempio n. 2
0
        public AttilaRegionsInfo(ImportantPaths importantPaths, RegionMapper map, FactionsInfo factions)
        {
            this.importantPaths = importantPaths;
            getRegionXMLInfo(map, factions);
            AttilaRegionsInfoComparer attilaComp = new AttilaRegionsInfoComparer();

            attilaRegionMappings.Sort(attilaComp);
        }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        public CK2CountyRegionsInfo(RegionMapper map)
        {
            counties = new Dictionary <string, CK2CountyRegionInfo>();
            string provinceHistoryPath = ImportantPaths.conversionInfoPath() + "\\region\\provinceHistory";

            string[] histories = Directory.GetFiles(provinceHistoryPath);
            foreach (string historyPath in histories)
            {
                CK2CountyRegionInfo county = new CK2CountyRegionInfo(map, historyPath);
                if (county.countyShallBeAltered())
                {
                    counties.Add(county.getID(), county);
                }
            }
        }
Esempio n. 5
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);
         }
     }
 }
Esempio n. 6
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);
        }