Exemplo n.º 1
0
        public LocBlock?GetNameLocBlock(LocDB locDB, CountryCollection imperatorCountries)
        {
            var directNameLocMatch = locDB.GetLocBlockForKey(Name);

            if (directNameLocMatch is null || Name != "CIVILWAR_FACTION_NAME")
            {
                return(directNameLocMatch);
            }

            // special case for revolts
            if (BaseName is null)
            {
                return(directNameLocMatch);
            }
            var baseAdjLoc = BaseName.GetAdjectiveLocBlock(locDB, imperatorCountries);

            if (baseAdjLoc is null)
            {
                return(directNameLocMatch);
            }
            directNameLocMatch.ModifyForEveryLanguage(baseAdjLoc,
                                                      (orig, modifying) => orig.Replace("$ADJ$", modifying)
                                                      );
            return(directNameLocMatch);
        }
Exemplo n.º 2
0
        public static CountryCollection ParseBloc(BufferedReader reader)
        {
            var blocParser = new Parser();
            CountryCollection countries = new();

            blocParser.RegisterKeyword("country_database", reader =>
                                       countries = new CountryCollection(reader)
                                       );
            blocParser.RegisterRegex(CommonRegexes.Catchall, ParserHelpers.IgnoreAndLogItem);

            blocParser.ParseStream(reader);
            blocParser.ClearRegisteredRules();
            Logger.Debug($"Ignored CountryCurrencies tokens: {string.Join(", ", CountryCurrencies.IgnoredTokens)}");
            Logger.Debug($"Ignored RulerTerm tokens: {string.Join(", ", RulerTerm.IgnoredTokens)}");
            Logger.Debug($"Ignored Country tokens: {string.Join(", ", Country.IgnoredTokens)}");
            return(countries);
        }
Exemplo n.º 3
0
        public LocBlock?GetAdjectiveLocBlock(LocDB locDB, CountryCollection imperatorCountries)
        {
            var adj = GetAdjective();
            var directAdjLocMatch = locDB.GetLocBlockForKey(adj);

            if (directAdjLocMatch is not null && adj == "CIVILWAR_FACTION_ADJECTIVE")
            {
                // special case for revolts
                var baseAdjLoc = BaseName?.GetAdjectiveLocBlock(locDB, imperatorCountries);
                if (baseAdjLoc is not null)
                {
                    directAdjLocMatch.ModifyForEveryLanguage(baseAdjLoc, (orig, modifying) =>
                                                             orig.Replace("$ADJ$", modifying)
                                                             );
                    return(directAdjLocMatch);
                }
            }