Example #1
0
 public static void Initialise()
 {
     if (s_Cultures == null)
     {
         s_Cultures = CultureLoader.LoadCultures();
     }
 }
Example #2
0
 public async Task Load()
 {
     await Task.WhenAll(IssueLoader.Load(),
                        DecisionsLoader.Load(),
                        EventsLoader.Load(),
                        InventionsLoader.Load(),
                        TechnologiesLoader.Load(),
                        PopLoader.Load(),
                        UnitLoader.Load(),
                        ProvinceLoader.Load(),
                        PopTypeLoader.Load(),
                        DiplomacyLoader.Load(),
                        OobLoader.Load(),
                        WarLoader.Load(),
                        BookmarkLoader.Load(),
                        BuildingLoader.Load(),
                        CbLoader.Load(),
                        CotColorLoader.Load(),
                        NationalFocusLoader.Load(),
                        GraphicalCultureLoader.Load(),
                        IdeologyLoader.Load(),
                        CountryLoader.Load(),
                        CountryColorsLoader.Load(),
                        CrimeLoader.Load(),
                        CultureLoader.Load(),
                        DefinesLoader.Load(),
                        EventModifiersLoader.Load(),
                        GoodsLoader.Load(),
                        GovernmentsLoader.Load(),
                        NationalValueLoader.Load(),
                        OnActionsLoader.Load(),
                        PopTypeLoader.Load(),
                        ProductionTypeLoader.Load(),
                        RebelTypeLoader.Load(),
                        ReligionLoader.Load(),
                        StaticModifiersLoader.Load(),
                        TechSchoolLoader.Load(),
                        TraitsLoader.Load(),
                        TriggeredModifiersLoader.Load(),
                        CountryDirectoryLoader.Load()
                        );
 }
Example #3
0
        public static void Initialise()
        {
            s_Cultures = new Dictionary <string, CultureType>();

            s_Cultures = CultureLoader.LoadCultures();
        }
Example #4
0
        private static void Execute()
        {
            // Set up the configuration and generator.
            Config config = null;

            try
            {
                var configJson = File.ReadAllText("config.json");
                config = JsonConvert.DeserializeObject <Config>(configJson);
            }
            catch (FileNotFoundException) { throw new CharGenException("config.json could not be found. Please restart the program with this file present."); }
            catch (JsonReaderException jrex)
            {
                bool isPathError = jrex.Message.Contains("ckii_folder_path") || jrex.Message.Contains("mod_folder_path");

                if (isPathError)
                {
                    throw new CharGenException("config.json was not readable due to a malformed path. Please make sure to escape the paths by using \\\\ instead of a single \\.");
                }
                throw new CharGenException("config.json was not readable due to \"" + jrex.Message + "\".");
            }

            // Parse the cultures.
            var cultureLoader = new CultureLoader();

            cultureLoader.Load(cultureLoader.GetDirectory(config.ModPath));
            var culture = cultureLoader[config.Culture];

            // Make sure that the culture was correct.
            if (culture == null)
            {
                throw new CharGenException("Culture \'" + config.Culture + "\' was not found. Did you make a typo?");
            }

            var dynastyLoader = new DynastyLoader();

            dynastyLoader.Load(dynastyLoader.GetDirectory(config.ModPath));
            var dynasty = dynastyLoader[config.DynastyId.ToString()];

            // Generate some characters.
            var characterGenerator = new CharacterGenerator(new CharacterGenerator.Config()
            {
                Culture     = culture,
                Dynasty     = dynasty,
                Year        = new Range(config.MinimumYear, config.MaximumYear),
                FertileAge  = new Range(config.MinimumFertileAge, config.MaximumFertileAge),
                Age         = new Range(config.MinimumAge, config.MaximumAge),
                FirstCharId = config.FirstCharId.ToString(),
                ReligionId  = config.Religion
            });

            characterGenerator.Generate();

            // Write the characters to a file.
            var filename = dynasty.Culture.ToLower() + "_" + dynasty.Id + "_" + dynasty.Name.ToLower() + ".txt";

            characterGenerator.Write(filename);

            // Generate title history.
            var titleHistoryGenerator = new TitleHistoryGenerator(new TitleHistoryGenerator.Config()
            {
                MaximumSuccessionYear = config.MaximumSuccessionYear,
                Characters            = characterGenerator.Items
            });

            titleHistoryGenerator.Generate();
            titleHistoryGenerator.Write("titles.txt");
        }