Exemplo n.º 1
0
        public Title Add(
            Governorship governorship,
            Country country,
            Imperator.Characters.CharacterCollection imperatorCharacters,
            bool regionHasMultipleGovernorships,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            CoaMapper coaMapper,
            TagTitleMapper tagTitleMapper,
            DefiniteFormMapper definiteFormMapper,
            ImperatorRegionMapper imperatorRegionMapper
            )
        {
            var newTitle = new Title(this,
                                     governorship,
                                     country,
                                     imperatorCharacters,
                                     regionHasMultipleGovernorships,
                                     locDB,
                                     provinceMapper,
                                     coaMapper,
                                     tagTitleMapper,
                                     definiteFormMapper,
                                     imperatorRegionMapper
                                     );

            dict[newTitle.Id] = newTitle;
            return(newTitle);
        }
Exemplo n.º 2
0
        public void ImportImperatorCharacters(Imperator.World impWorld,
                                              ReligionMapper religionMapper,
                                              CultureMapper cultureMapper,
                                              TraitMapper traitMapper,
                                              NicknameMapper nicknameMapper,
                                              LocDB locDB,
                                              ProvinceMapper provinceMapper,
                                              DeathReasonMapper deathReasonMapper,
                                              Date endDate,
                                              Date ck3BookmarkDate
                                              )
        {
            Logger.Info("Importing Imperator Characters...");

            foreach (var character in impWorld.Characters)
            {
                ImportImperatorCharacter(
                    character,
                    religionMapper,
                    cultureMapper,
                    traitMapper,
                    nicknameMapper,
                    locDB,
                    provinceMapper,
                    deathReasonMapper,
                    endDate,
                    ck3BookmarkDate
                    );
            }
            Logger.Info($"{Count} total characters recognized.");

            LinkMothersAndFathers();
            LinkSpouses();
            LinkPrisoners();
        }
Exemplo n.º 3
0
 private Title(
     LandedTitles parentCollection,
     Governorship governorship,
     Country country,
     Imperator.Characters.CharacterCollection imperatorCharacters,
     bool regionHasMultipleGovernorships,
     LocDB locDB,
     ProvinceMapper provinceMapper,
     CoaMapper coaMapper,
     TagTitleMapper tagTitleMapper,
     DefiniteFormMapper definiteFormMapper,
     ImperatorRegionMapper imperatorRegionMapper
     )
 {
     this.parentCollection = parentCollection;
     Id = DetermineName(governorship, country, tagTitleMapper);
     SetRank();
     InitializeFromGovernorship(
         governorship,
         country,
         imperatorCharacters,
         regionHasMultipleGovernorships,
         locDB,
         provinceMapper,
         definiteFormMapper,
         imperatorRegionMapper
         );
 }
Exemplo n.º 4
0
        private void ImportImperatorCharacter(
            Imperator.Characters.Character character,
            ReligionMapper religionMapper,
            CultureMapper cultureMapper,
            TraitMapper traitMapper,
            NicknameMapper nicknameMapper,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            DeathReasonMapper deathReasonMapper,
            Date endDate,
            Date ck3BookmarkDate
            )
        {
            // Create a new CK3 character
            var newCharacter = new Character(
                character,
                religionMapper,
                cultureMapper,
                traitMapper,
                nicknameMapper,
                locDB,
                provinceMapper,
                deathReasonMapper,
                endDate,
                ck3BookmarkDate
                );

            character.CK3Character = newCharacter;
            Add(newCharacter);
        }
Exemplo n.º 5
0
        private void ImportImperatorCountry(
            Country country,
            CountryCollection imperatorCountries,
            TagTitleMapper tagTitleMapper,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            CoaMapper coaMapper,
            GovernmentMapper governmentMapper,
            SuccessionLawMapper successionLawMapper,
            DefiniteFormMapper definiteFormMapper,
            ReligionMapper religionMapper,
            CultureMapper cultureMapper,
            NicknameMapper nicknameMapper,
            CharacterCollection characters,
            Date conversionDate
            )
        {
            // Create a new title or update existing title
            var name = DetermineName(country, imperatorCountries, tagTitleMapper, locDB);

            if (TryGetValue(name, out var existingTitle))
            {
                existingTitle.InitializeFromTag(
                    country,
                    imperatorCountries,
                    locDB,
                    provinceMapper,
                    coaMapper,
                    governmentMapper,
                    successionLawMapper,
                    definiteFormMapper,
                    religionMapper,
                    cultureMapper,
                    nicknameMapper,
                    characters,
                    conversionDate
                    );
            }
            else
            {
                Add(
                    country,
                    imperatorCountries,
                    locDB,
                    provinceMapper,
                    coaMapper,
                    tagTitleMapper,
                    governmentMapper,
                    successionLawMapper,
                    definiteFormMapper,
                    religionMapper,
                    cultureMapper,
                    nicknameMapper,
                    characters,
                    conversionDate
                    );
            }
        }
Exemplo n.º 6
0
        public void EmptyMappingsDefaultToEmpty()
        {
            var reader = new BufferedReader(
                "0.0.0.0 = {\n" +
                "}"
                );
            var mapper = new ProvinceMapper(reader);

            Assert.Empty(mapper.GetImperatorProvinceNumbers(1));
        }
Exemplo n.º 7
0
        public void CanLookupCK3Provinces()
        {
            var reader = new BufferedReader(
                "0.0.0.0 = {\n" +
                "	link = { ck3 = 2 ck3 = 1 imp = 2 imp = 1 }\n"+
                "}"
                );
            var mapper = new ProvinceMapper(reader);

            Assert.Equal(2, mapper.GetCK3ProvinceNumbers(1).Count);
            Assert.Equal((ulong)2, mapper.GetCK3ProvinceNumbers(1)[0]);
            Assert.Equal((ulong)1, mapper.GetCK3ProvinceNumbers(1)[1]);
            Assert.Equal(2, mapper.GetCK3ProvinceNumbers(2).Count);
            Assert.Equal((ulong)2, mapper.GetCK3ProvinceNumbers(2)[0]);
            Assert.Equal((ulong)1, mapper.GetCK3ProvinceNumbers(2)[1]);
        }
Exemplo n.º 8
0
        public void ImportImperatorCountries(
            CountryCollection imperatorCountries,
            TagTitleMapper tagTitleMapper,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            CoaMapper coaMapper,
            GovernmentMapper governmentMapper,
            SuccessionLawMapper successionLawMapper,
            DefiniteFormMapper definiteFormMapper,
            ReligionMapper religionMapper,
            CultureMapper cultureMapper,
            NicknameMapper nicknameMapper,
            CharacterCollection characters,
            Date conversionDate
            )
        {
            Logger.Info("Importing Imperator Countries...");

            // landedTitles holds all titles imported from CK3. We'll now overwrite some and
            // add new ones from Imperator tags.
            var counter = 0;

            // We don't need pirates, barbarians etc.
            foreach (var country in imperatorCountries.Where(c => c.CountryType == CountryType.real))
            {
                ImportImperatorCountry(
                    country,
                    imperatorCountries,
                    tagTitleMapper,
                    locDB,
                    provinceMapper,
                    coaMapper,
                    governmentMapper,
                    successionLawMapper,
                    definiteFormMapper,
                    religionMapper,
                    cultureMapper,
                    nicknameMapper,
                    characters,
                    conversionDate
                    );
                ++counter;
            }
            Logger.Info($"Imported {counter} countries from I:R.");
        }
Exemplo n.º 9
0
        private void ImportImperatorGovernorship(
            Governorship governorship,
            CountryCollection imperatorCountries,
            Imperator.Characters.CharacterCollection imperatorCharacters,
            bool regionHasMultipleGovernorships,
            TagTitleMapper tagTitleMapper,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            DefiniteFormMapper definiteFormMapper,
            ImperatorRegionMapper imperatorRegionMapper,
            CoaMapper coaMapper)
        {
            var country = imperatorCountries[governorship.CountryId];
            // Create a new title or update existing title
            var name = DetermineName(governorship, country, tagTitleMapper);

            if (TryGetValue(name, out var existingTitle))
            {
                existingTitle.InitializeFromGovernorship(
                    governorship,
                    country,
                    imperatorCharacters,
                    regionHasMultipleGovernorships,
                    locDB,
                    provinceMapper,
                    definiteFormMapper,
                    imperatorRegionMapper
                    );
            }
            else
            {
                Add(
                    governorship,
                    country,
                    imperatorCharacters,
                    regionHasMultipleGovernorships,
                    locDB,
                    provinceMapper,
                    coaMapper,
                    tagTitleMapper,
                    definiteFormMapper,
                    imperatorRegionMapper
                    );
            }
        }
Exemplo n.º 10
0
        public void ImportImperatorGovernorships(
            Imperator.World impWorld,
            TagTitleMapper tagTitleMapper,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            DefiniteFormMapper definiteFormMapper,
            ImperatorRegionMapper imperatorRegionMapper,
            CoaMapper coaMapper
            )
        {
            Logger.Info("Importing Imperator Governorships...");

            var governorships      = impWorld.Jobs.Governorships;
            var imperatorCountries = impWorld.Countries;

            var governorshipsPerRegion = governorships.GroupBy(g => g.RegionName)
                                         .ToDictionary(g => g.Key, g => g.Count());

            // landedTitles holds all titles imported from CK3. We'll now overwrite some and
            // add new ones from Imperator governorships.
            var counter = 0;

            foreach (var governorship in governorships)
            {
                ImportImperatorGovernorship(
                    governorship,
                    imperatorCountries,
                    impWorld.Characters,
                    governorshipsPerRegion[governorship.RegionName] > 1,
                    tagTitleMapper,
                    locDB,
                    provinceMapper,
                    definiteFormMapper,
                    imperatorRegionMapper,
                    coaMapper
                    );
                ++counter;
            }
            Logger.Info($"Imported {counter} governorships from I:R.");
        }
Exemplo n.º 11
0
    public RulerTerm(
        Imperator.Countries.RulerTerm imperatorRulerTerm,
        Characters.CharacterCollection characters,
        GovernmentMapper governmentMapper,
        LocDB locDB,
        ReligionMapper religionMapper,
        CultureMapper cultureMapper,
        NicknameMapper nicknameMapper,
        ProvinceMapper provinceMapper
        )
    {
        if (imperatorRulerTerm.CharacterId is not null)
        {
            CharacterId = $"imperator{imperatorRulerTerm.CharacterId}";
        }
        StartDate = imperatorRulerTerm.StartDate;
        if (imperatorRulerTerm.Government is not null)
        {
            Government = governmentMapper.GetCK3GovernmentForImperatorGovernment(imperatorRulerTerm.Government);
        }

        PreImperatorRuler = imperatorRulerTerm.PreImperatorRuler;
        if (PreImperatorRuler?.Country is not null)
        {
            // create a new ruler character
            var character = new Character(
                PreImperatorRuler,
                StartDate,
                PreImperatorRuler.Country,
                locDB,
                religionMapper,
                cultureMapper,
                nicknameMapper,
                provinceMapper
                );
            characters.Add(character);
            CharacterId = character.Id;
        }
    }
Exemplo n.º 12
0
        public Title Add(
            Country country,
            CountryCollection imperatorCountries,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            CoaMapper coaMapper,
            TagTitleMapper tagTitleMapper,
            GovernmentMapper governmentMapper,
            SuccessionLawMapper successionLawMapper,
            DefiniteFormMapper definiteFormMapper,
            ReligionMapper religionMapper,
            CultureMapper cultureMapper,
            NicknameMapper nicknameMapper,
            CharacterCollection characters,
            Date conversionDate
            )
        {
            var newTitle = new Title(this,
                                     country,
                                     imperatorCountries,
                                     locDB,
                                     provinceMapper,
                                     coaMapper,
                                     tagTitleMapper,
                                     governmentMapper,
                                     successionLawMapper,
                                     definiteFormMapper,
                                     religionMapper,
                                     cultureMapper,
                                     nicknameMapper,
                                     characters,
                                     conversionDate
                                     );

            dict[newTitle.Id] = newTitle;
            return(newTitle);
        }
Exemplo n.º 13
0
 private Title(LandedTitles parentCollection,
               Country country,
               CountryCollection imperatorCountries,
               LocDB locDB,
               ProvinceMapper provinceMapper,
               CoaMapper coaMapper,
               TagTitleMapper tagTitleMapper,
               GovernmentMapper governmentMapper,
               SuccessionLawMapper successionLawMapper,
               DefiniteFormMapper definiteFormMapper,
               ReligionMapper religionMapper,
               CultureMapper cultureMapper,
               NicknameMapper nicknameMapper,
               CharacterCollection characters,
               Date conversionDate
               )
 {
     this.parentCollection = parentCollection;
     Id = DetermineName(country, imperatorCountries, tagTitleMapper, locDB);
     SetRank();
     InitializeFromTag(
         country,
         imperatorCountries,
         locDB,
         provinceMapper,
         coaMapper,
         governmentMapper,
         successionLawMapper,
         definiteFormMapper,
         religionMapper,
         cultureMapper,
         nicknameMapper,
         characters,
         conversionDate
         );
 }
Exemplo n.º 14
0
    public void InitializeFromTag(
        Country country,
        CountryCollection imperatorCountries,
        LocDB locDB,
        ProvinceMapper provinceMapper,
        CoaMapper coaMapper,
        GovernmentMapper governmentMapper,
        SuccessionLawMapper successionLawMapper,
        DefiniteFormMapper definiteFormMapper,
        ReligionMapper religionMapper,
        CultureMapper cultureMapper,
        NicknameMapper nicknameMapper,
        CharacterCollection characters,
        Date conversionDate
        )
    {
        IsImportedOrUpdatedFromImperator = true;
        ImperatorCountry          = country;
        ImperatorCountry.CK3Title = this;

        LocBlock?validatedName = GetValidatedName(country, imperatorCountries, locDB);

        HasDefiniteForm.Value    = definiteFormMapper.IsDefiniteForm(ImperatorCountry.Name);
        RulerUsesTitleName.Value = false;

        PlayerCountry = ImperatorCountry.PlayerCountry;

        ClearHolderSpecificHistory();

        FillHolderAndGovernmentHistory();

        // ------------------ determine color
        var color1Opt = ImperatorCountry.Color1;

        if (color1Opt is not null)
        {
            Color1 = color1Opt;
        }
        var color2Opt = ImperatorCountry.Color2;

        if (color2Opt is not null)
        {
            Color2 = color2Opt;
        }

        // determine successions laws
        history.InternalHistory.AddFieldValue("succession_laws",
                                              successionLawMapper.GetCK3LawsForImperatorLaws(ImperatorCountry.GetLaws()),
                                              conversionDate,
                                              "succession_laws"
                                              );

        // determine CoA
        CoA = coaMapper.GetCoaForFlagName(ImperatorCountry.Flag);

        // determine other attributes
        var srcCapital = ImperatorCountry.Capital;

        if (srcCapital is not null)
        {
            var provMappingsForImperatorCapital = provinceMapper.GetCK3ProvinceNumbers((ulong)srcCapital);
            if (provMappingsForImperatorCapital.Count > 0)
            {
                var foundCounty = parentCollection.GetCountyForProvince(provMappingsForImperatorCapital[0]);
                if (foundCounty is not null)
                {
                    CapitalCounty = foundCounty;
                }
            }
        }

        // determine country name localization
        var nameSet = false;

        if (validatedName is not null)
        {
            var nameLocBlock = Localizations.AddLocBlock(Id);
            nameLocBlock.CopyFrom(validatedName);
            nameSet = true;
        }
        if (!nameSet)
        {
            var impTagLoc = locDB.GetLocBlockForKey(ImperatorCountry.Tag);
            if (impTagLoc is not null)
            {
                var nameLocBlock = Localizations.AddLocBlock(Id);
                nameLocBlock.CopyFrom(impTagLoc);
                nameSet = true;
            }
        }
        if (!nameSet)
        {
            // use unlocalized name if not empty
            var name = ImperatorCountry.Name;
            if (!string.IsNullOrEmpty(name))
            {
                Logger.Warn($"Using unlocalized Imperator name {name} as name for {Id}!");
                var nameLocBlock = Localizations.AddLocBlock(Id);
                nameLocBlock["english"] = name;
                nameLocBlock.FillMissingLocWithBaseLanguageLoc();
                nameSet = true;
            }
        }
        // giving up
        if (!nameSet)
        {
            Logger.Warn($"{Id} needs help with localization! {ImperatorCountry.Name}?");
        }

        // determine adjective localization
        TrySetAdjectiveLoc(locDB, imperatorCountries);

        void FillHolderAndGovernmentHistory()
        {
            // ------------------ determine previous and current holders
            // there was no 0 AD, but year 0 works in game and serves well for adding BC characters to holder history
            var firstPossibleDate = new Date(0, 1, 1);

            foreach (var impRulerTerm in ImperatorCountry.RulerTerms)
            {
                var rulerTerm = new RulerTerm(
                    impRulerTerm,
                    characters,
                    governmentMapper,
                    locDB,
                    religionMapper,
                    cultureMapper,
                    nicknameMapper,
                    provinceMapper
                    );

                var characterId = rulerTerm.CharacterId;
                var gov         = rulerTerm.Government;

                var startDate = new Date(rulerTerm.StartDate);
                if (startDate < firstPossibleDate)
                {
                    startDate = new Date(firstPossibleDate);                     // TODO: remove this workaround if CK3 supports negative dates
                    firstPossibleDate.ChangeByDays(1);
                }

                history.InternalHistory.AddFieldValue("holder", characterId, startDate, "holder");
                if (gov is not null)
                {
                    history.InternalHistory.AddFieldValue("government", gov, startDate, "government");
                }
            }

            if (ImperatorCountry.Government is not null)
            {
                var lastCK3TermGov = history.GetGovernment(conversionDate);
                var ck3CountryGov  = governmentMapper.GetCK3GovernmentForImperatorGovernment(ImperatorCountry.Government);
                if (lastCK3TermGov != ck3CountryGov && ck3CountryGov is not null)
                {
                    history.InternalHistory.AddFieldValue("government", ck3CountryGov, conversionDate, "government");
                }
            }
        }
    }
Exemplo n.º 15
0
    public void ImportImperatorProvinces(Imperator.World impWorld, Title.LandedTitles titles, CultureMapper cultureMapper, ReligionMapper religionMapper, ProvinceMapper provinceMapper)
    {
        Logger.Info("Importing Imperator Provinces...");
        var counter = 0;

        // Imperator provinces map to a subset of CK3 provinces. We'll only rewrite those we are responsible for.
        foreach (var province in this)
        {
            var impProvinces = provinceMapper.GetImperatorProvinceNumbers(province.Id);
            // Provinces we're not affecting will not be in this list.
            if (impProvinces.Count == 0)
            {
                continue;
            }
            // Next, we find what province to use as its initializing source.
            var sourceProvince = DetermineProvinceSource(impProvinces, impWorld);
            if (sourceProvince is null)
            {
                Logger.Warn($"Could not determine source province for CK3 province {province.Id}!");
                continue;                 // MISMAP, or simply have mod provinces loaded we're not using.
            }
            province.InitializeFromImperator(sourceProvince.Value.Value, titles, cultureMapper, religionMapper);
            // And finally, initialize it.
            ++counter;
        }
        Logger.Info($"{impWorld.Provinces.Count} Imperator provinces imported into {counter} CK3 provinces.");
    }
Exemplo n.º 16
0
        public void InitializeFromGovernorship(
            Imperator.Countries.Country country,
            Imperator.Jobs.Governorship governorship,
            Dictionary <ulong, Imperator.Characters.Character> imperatorCharacters,
            LocalizationMapper localizationMapper,
            LandedTitles landedTitles,
            ProvinceMapper provinceMapper,
            CoaMapper coaMapper,
            TagTitleMapper tagTitleMapper,
            DefiniteFormMapper definiteFormMapper,
            Mappers.Region.ImperatorRegionMapper imperatorRegionMapper
            )
        {
            IsImportedOrUpdatedFromImperator = true;

            // ------------------ determine CK3 title

            if (country.CK3Title is null)
            {
                throw new ArgumentException($"{country.Tag} governorship of {governorship.RegionName} could not be mapped to CK3 title: liege doesn't exist!");
            }

            HasDefiniteForm = definiteFormMapper.IsDefiniteForm(governorship.RegionName);

            string?title = null;

            title        = tagTitleMapper.GetTitleForGovernorship(governorship.RegionName, country.Tag, country.CK3Title.Name);
            DeJureLiege  = country.CK3Title;
            DeFactoLiege = country.CK3Title;
            if (title is null)
            {
                throw new ArgumentException($"{country.Tag} governorship of {governorship.RegionName} could not be mapped to CK3 title!");
            }

            Name = title;

            SetRank();

            PlayerCountry = false;

            var impGovernor         = imperatorCharacters[governorship.CharacterID];
            var normalizedStartDate = governorship.StartDate.Year > 0 ? governorship.StartDate : new Date(1, 1, 1);

            // ------------------ determine holder
            history.InternalHistory.AddSimpleFieldValue("holder", $"imperator{impGovernor.ID}", normalizedStartDate);

            // ------------------ determine government
            var ck3LiegeGov = country.CK3Title.GetGovernment(governorship.StartDate);

            if (ck3LiegeGov is not null)
            {
                history.InternalHistory.AddSimpleFieldValue("government", ck3LiegeGov, normalizedStartDate);
            }

            // ------------------ determine color
            var color1Opt = country.Color1;

            if (color1Opt is not null)
            {
                Color1 = color1Opt;
            }
            var color2Opt = country.Color2;

            if (color2Opt is not null)
            {
                Color2 = color2Opt;
            }

            // determine successions laws
            // https://github.com/ParadoxGameConverters/ImperatorToCK3/issues/90#issuecomment-817178552
            SuccessionLaws = new() { "high_partition_succession_law" };

            // ------------------ determine CoA
            CoA = null;             // using game-randomized CoA

            // ------------------ determine capital
            var governorProvince = impGovernor.ProvinceID;

            if (imperatorRegionMapper.ProvinceIsInRegion(governorProvince, governorship.RegionName))
            {
                foreach (var ck3Prov in provinceMapper.GetCK3ProvinceNumbers(governorProvince))
                {
                    var foundCounty = landedTitles.GetCountyForProvince(ck3Prov);
                    if (foundCounty is not null)
                    {
                        CapitalCounty = new(foundCounty.Name, foundCounty);
                        break;
                    }
                }
            }

            // ------------------ Country Name Locs
            var      nameSet                  = false;
            LocBlock?regionLocBlock           = localizationMapper.GetLocBlockForKey(governorship.RegionName);
            var      countryAdjectiveLocBlock = country.CK3Title.Localizations[country.CK3Title.Name + "_adj"];

            if (regionLocBlock is not null && countryAdjectiveLocBlock is not null)
            {
                var nameLocBlock = new LocBlock(regionLocBlock);
                nameLocBlock.ModifyForEveryLanguage(countryAdjectiveLocBlock,
                                                    (ref string orig, string adj) => orig = $"{adj} {orig}"
                                                    );
                Localizations.Add(Name, nameLocBlock);
                nameSet = true;
            }
            if (!nameSet && regionLocBlock is not null)
            {
                var nameLocBlock = new LocBlock(regionLocBlock);
                Localizations.Add(Name, nameLocBlock);
                nameSet = true;
            }
            if (!nameSet)
            {
                Logger.Warn($"{Name} needs help with localization!");
            }

            // --------------- Adjective Locs
            var adjSet = false;

            if (countryAdjectiveLocBlock is not null)
            {
                var adjLocBlock = new LocBlock(countryAdjectiveLocBlock);
                Localizations.Add(Name + "_adj", adjLocBlock);
                adjSet = true;
            }
            if (!adjSet)
            {
                Logger.Warn($"{Name} needs help with adjective localization!");
            }
        }
Exemplo n.º 17
0
        public void InitializeFromTag(
            Imperator.Countries.Country country,
            Dictionary <ulong, Imperator.Countries.Country> imperatorCountries,
            LocalizationMapper localizationMapper,
            LandedTitles landedTitles,
            ProvinceMapper provinceMapper,
            CoaMapper coaMapper,
            TagTitleMapper tagTitleMapper,
            GovernmentMapper governmentMapper,
            SuccessionLawMapper successionLawMapper,
            DefiniteFormMapper definiteFormMapper
            )
        {
            IsImportedOrUpdatedFromImperator = true;
            ImperatorCountry = country;

            // ------------------ determine CK3 title

            LocBlock?validatedName;

            // hard code for Antigonid Kingdom, Seleucid Empire and Maurya (which use customizable localization for name and adjective)
            if (ImperatorCountry.Name == "PRY_DYN")
            {
                validatedName = localizationMapper.GetLocBlockForKey("get_pry_name_fallback");
            }
            else if (ImperatorCountry.Name == "SEL_DYN")
            {
                validatedName = localizationMapper.GetLocBlockForKey("get_sel_name_fallback");
            }
            else if (ImperatorCountry.Name == "MRY_DYN")
            {
                validatedName = localizationMapper.GetLocBlockForKey("get_mry_name_fallback");
            }
            // normal case
            else
            {
                validatedName = ImperatorCountry.CountryName.GetNameLocBlock(localizationMapper, imperatorCountries);
            }

            HasDefiniteForm = definiteFormMapper.IsDefiniteForm(ImperatorCountry.Name);

            string?title;

            if (validatedName is not null)
            {
                title = tagTitleMapper.GetTitleForTag(ImperatorCountry.Tag, ImperatorCountry.GetCountryRank(), validatedName.english);
            }
            else
            {
                title = tagTitleMapper.GetTitleForTag(ImperatorCountry.Tag, ImperatorCountry.GetCountryRank());
            }

            if (title is null)
            {
                throw new ArgumentException("Country " + ImperatorCountry.Tag + " could not be mapped!");
            }

            Name = title;

            SetRank();

            PlayerCountry = ImperatorCountry.PlayerCountry;

            // ------------------ determine previous and current holders
            history.InternalHistory.SimpleFields.Remove("holder");
            history.InternalHistory.SimpleFields.Remove("government");
            // there was no 0 AD, but year 0 works in game and serves well for adding BC characters to holder history
            var firstPossibleDate = new Date(0, 1, 1);

            foreach (var impRulerTerm in ImperatorCountry.RulerTerms)
            {
                var rulerTerm   = new RulerTerm(impRulerTerm, governmentMapper);
                var characterId = rulerTerm.CharacterId;
                var gov         = rulerTerm.Government;

                var startDate = new Date(rulerTerm.StartDate);
                if (startDate < firstPossibleDate)
                {
                    startDate = new Date(firstPossibleDate);                     // TODO: remove this workaround if CK3 supports negative dates
                    firstPossibleDate.ChangeByDays(1);
                }

                history.InternalHistory.AddSimpleFieldValue("holder", characterId, startDate);
                if (gov is not null)
                {
                    history.InternalHistory.AddSimpleFieldValue("government", gov, startDate);
                }
            }

            // ------------------ determine color
            var color1Opt = ImperatorCountry.Color1;

            if (color1Opt is not null)
            {
                Color1 = color1Opt;
            }
            var color2Opt = ImperatorCountry.Color2;

            if (color2Opt is not null)
            {
                Color2 = color2Opt;
            }

            // determine successions laws
            SuccessionLaws = successionLawMapper.GetCK3LawsForImperatorLaws(ImperatorCountry.GetLaws());

            // ------------------ determine CoA
            CoA = coaMapper.GetCoaForFlagName(ImperatorCountry.Flag);

            // ------------------ determine other attributes

            var srcCapital = ImperatorCountry.Capital;

            if (srcCapital is not null)
            {
                var provMappingsForImperatorCapital = provinceMapper.GetCK3ProvinceNumbers((ulong)srcCapital);
                if (provMappingsForImperatorCapital.Count > 0)
                {
                    var foundCounty = landedTitles.GetCountyForProvince(provMappingsForImperatorCapital[0]);
                    if (foundCounty is not null)
                    {
                        CapitalCounty = new(foundCounty.Name, foundCounty);
                    }
                }
            }

            // ------------------ Country Name Locs

            var nameSet = false;

            if (validatedName is not null)
            {
                Localizations.Add(Name, validatedName);
                nameSet = true;
            }
            if (!nameSet)
            {
                var impTagLoc = localizationMapper.GetLocBlockForKey(ImperatorCountry.Tag);
                if (impTagLoc is not null)
                {
                    Localizations.Add(Name, impTagLoc);
                    nameSet = true;
                }
            }
            // giving up
            if (!nameSet)
            {
                Logger.Warn($"{Name} needs help with localization! {ImperatorCountry.Name}?");
            }

            // --------------- Adjective Locs
            TrySetAdjectiveLoc(localizationMapper, imperatorCountries);
        }