Ejemplo n.º 1
0
        public void TokenCallback(ParadoxParser parser, string token)
        {
            switch (token)
            {
            case "players_countries":
                PlayerCountries = parser.ReadStringList();
                break;

            case "countries":
                var countriesParser = parser.Parse(new CountriesParser());
                foreach (var country in countriesParser.Countries)
                {
                    Countries.Add(new JProperty(country.Tag, JObject.FromObject(country)));
                }

                break;

            case "diplomacy":
                var diplomacyParser = parser.Parse(new DiplomacyParser());
                foreach (var keyValue in diplomacyParser.DiplomaciesByType)
                {
                    var jArray = new JArray(keyValue.Value.Select(p => JObject.FromObject(p)));
                    Diplomacy.Add(new JProperty(keyValue.Key, jArray));
                }

                break;
            }
        }
Ejemplo n.º 2
0
        public void TokenCallback(ParadoxParser parser, string token)
        {
            switch (token)
            {
            case "name": Name = parser.ReadString(); break;

            case "tax": Tax = parser.ReadDouble(); break;

            case "add_core": Cores.Add(parser.ReadString()); break;

            case "top_provinces": TopProvinces = parser.ReadStringList(); break;

            case "army": Armies.Add(parser.Parse(new Army())); break;
            }
        }
        public void TokenCallback(ParadoxParser parser, string token)
        {
            switch (token)
            {
            case "graphical_cultures":
                Entity.GraphicalCultures = parser.ReadStringList();
                break;

            default:
                CultureDefinition culture = new CultureDefinition();
                culture.Entity.Id = token;

                Entity.Cultures.Add(parser.Parse(culture).Entity);
                break;
            }
        }
Ejemplo n.º 4
0
		private static void ParseRule( ParadoxParser parser, string tag )
		{
			switch( tag )
			{
				case "ignored_titles":
					m_ruleset.IgnoredTitles.AddRange( parser.ReadStringList() );
					break;
				case "muslim_laws":
					m_ruleset.MuslimLawFollowers.AddRange( parser.ReadStringList() );
					break;
				case "male_culture":
					m_ruleset.MaleCultures.AddRange( parser.ReadStringList() );
					break;
				case "female_culture":
					m_ruleset.FemaleCultures.AddRange( parser.ReadStringList() );
					break;
				case "male_religion":
					m_ruleset.MaleReligions.AddRange( parser.ReadStringList() );
					break;
				case "female_religion":
					m_ruleset.FemaleReligions.AddRange( parser.ReadStringList() );
					break;
				case "required_rules":
					m_ruleset.RequiredRules.AddRange( parser.ReadStringList() );
					break;

				case "levy_tax_weight":
					List<int> ltw = (List<int>)parser.ReadIntList();

					if( ltw.Count >= 4 )
					{
						int i = 0;
						m_ruleset.LawRules.LevyTax.Min = ltw[0];
						m_ruleset.LawRules.LevyTax.Normal = ltw[1];
						m_ruleset.LawRules.LevyTax.Large = ltw[2];
						m_ruleset.LawRules.LevyTax.Max = ltw[3];
					}
					break;

				case "character":
					m_ruleset.CharRules.Add( ParseCharacter( parser ) );
					break;
				case "succession_laws":
					ParseLaws( parser, m_ruleset.LawRules.SuccessionLaws );
					break;
				case "gender_laws":
					ParseLaws( parser, m_ruleset.LawRules.GenderLaws );
					break;
				case "misc":
					parser.Parse( ParseMiscRules );
					break;
				case "cul_gen":
					parser.Parse( ParseCultureGenRules );
					break;
			}
		}
Ejemplo n.º 5
0
        public void TokenCallback(ParadoxParser parser, string token)
        {
            switch (token)
            {
            case "parent":
                Entity.ParentId = parser.ReadString();
                break;

            case "graphical_cultures":
                Entity.GraphicalCultures = parser.ReadStringList();
                break;

            case "unit_graphical_cultures":
                Entity.UnitGraphicalCultures = parser.ReadStringList();
                break;

            case "secondary_event_pictures":
                Entity.SecondaryEventPictures = parser.ReadString();
                break;

            case "used_for_random":
                Entity.IsAvailableRandomly = parser.ReadBool();
                break;

            case "nomadic_in_alt_start":
                Entity.IsNomadicInAlternateStart = parser.ReadBool();
                break;

            case "horde":
                Entity.IsHorde = parser.ReadBool();
                break;

            case "color":
                Entity.Colour = parser.ReadIntList().ToArray();
                break;

            case "male_names":
                Entity.MaleNames = parser.ReadStringList();
                break;

            case "female_names":
                Entity.FemaleNames = parser.ReadStringList();
                break;

            case "from_dynasty_prefix":
                Entity.FromDynastyPrefix = parser.ReadString();
                break;

            case "bastard_dynasty_prefix":
                Entity.BastardDynastyPrefix = parser.ReadString();
                break;

            case "grammar_transform":
                Entity.GrammarTransformation = parser.ReadString();
                break;

            case "male_patronym":
                Entity.MalePatronym = parser.ReadString();
                break;

            case "female_patronym":
                Entity.FemalePatronym = parser.ReadString();
                break;

            case "prefix":
                Entity.IsPatronymPrefix = parser.ReadBool();
                break;

            case "dynasty_name_first":
                Entity.IsDynastyNameFirst = parser.ReadBool();
                break;

            case "pat_grf_name_chance":
                Entity.PatrilinealGrandfatherNameChance = parser.ReadInt16();
                break;

            case "pat_grm_name_chance":
                Entity.PatrilinealGrandmotherNameChance = parser.ReadInt16();
                break;

            case "mat_grf_name_chance":
                Entity.MatrilinealGrandfatherNameChance = parser.ReadInt16();
                break;

            case "mat_grm_name_chance":
                Entity.MatrilinealGrandmotherNameChance = parser.ReadInt16();
                break;

            case "father_name_chance":
                Entity.FatherNameChance = parser.ReadInt16();
                break;

            case "mother_name_chance":
                Entity.MotherNameChance = parser.ReadInt16();
                break;

            case "dukes_called_kings":
                Entity.AreDukesCalledKings = parser.ReadBool();
                break;

            case "baron_titles_hidden":
                Entity.AreBaronTitlesHidden = parser.ReadBool();
                break;

            case "count_titles_hidden":
                Entity.AreCountTitlesHidden = parser.ReadBool();
                break;

            case "founder_named_dynasties":
                Entity.AreDynastiesNamedByFounders = parser.ReadBool();
                break;

            case "dynasty_title_names":
                Entity.HasDynasticTitleNames = parser.ReadBool();
                break;

            case "castes":
                Entity.HasCastes = parser.ReadBool();
                break;

            case "disinherit_from_blinding":
                Entity.IsDisinheritedFromBlinding = parser.ReadBool();
                break;

            case "allow_looting":
                Entity.IsAllowedToLoot = parser.ReadBool();
                break;

            case "seafarer":
                Entity.IsSeafarer = parser.ReadBool();
                break;

            case "tribal_name":
                Entity.TribalName = parser.ReadString();
                break;

            case "modifier":
                Entity.CulturalModifier = parser.ReadString();
                break;

            default:
                throw new InvalidOperationException($"Unexpected token \"{token}\"");
            }
        }
Ejemplo n.º 6
0
 public void TokenCallback(ParadoxParser parser, string token)
 {
     switch (token)
     {
     case "name": Name = parser.ReadString(); break;
     case "tax": Tax = parser.ReadDouble(); break;
     case "add_core": Cores.Add(parser.ReadString()); break;
     case "top_provinces": TopProvinces = parser.ReadStringList(); break;
     case "army": Armies.Add(parser.Parse(new Army())); break;
     }
 }
Ejemplo n.º 7
0
        private static void ParseRule(ParadoxParser parser, string tag)
        {
            switch (tag)
            {
            case "ignored_titles":
                m_ruleset.IgnoredTitles.AddRange(parser.ReadStringList());
                break;

            case "muslim_laws":
                m_ruleset.MuslimLawFollowers.AddRange(parser.ReadStringList());
                break;

            case "male_culture":
                m_ruleset.MaleCultures.AddRange(parser.ReadStringList());
                break;

            case "female_culture":
                m_ruleset.FemaleCultures.AddRange(parser.ReadStringList());
                break;

            case "male_religion":
                m_ruleset.MaleReligions.AddRange(parser.ReadStringList());
                break;

            case "female_religion":
                m_ruleset.FemaleReligions.AddRange(parser.ReadStringList());
                break;

            case "required_rules":
                m_ruleset.RequiredRules.AddRange(parser.ReadStringList());
                break;

            case "levy_tax_weight":
                List <int> ltw = (List <int>)parser.ReadIntList();

                if (ltw.Count >= 4)
                {
                    int i = 0;
                    m_ruleset.LawRules.LevyTax.Min    = ltw[0];
                    m_ruleset.LawRules.LevyTax.Normal = ltw[1];
                    m_ruleset.LawRules.LevyTax.Large  = ltw[2];
                    m_ruleset.LawRules.LevyTax.Max    = ltw[3];
                }
                break;

            case "character":
                m_ruleset.CharRules.Add(ParseCharacter(parser));
                break;

            case "succession_laws":
                ParseLaws(parser, m_ruleset.LawRules.SuccessionLaws);
                break;

            case "gender_laws":
                ParseLaws(parser, m_ruleset.LawRules.GenderLaws);
                break;

            case "misc":
                parser.Parse(ParseMiscRules);
                break;

            case "cul_gen":
                parser.Parse(ParseCultureGenRules);
                break;
            }
        }
        public void TokenCallback(ParadoxParser parser, string token)
        {
            if (token[1] == '_') // Like e_something or c_something
            {
                LandedTitleDefinition landedTitle = new LandedTitleDefinition();
                landedTitle.Entity.ParentId = Entity.Id;
                landedTitle.Entity.Id       = token;

                Entity.Children.Add(parser.Parse(landedTitle).Entity);
                return;
            }

            switch (token)
            {
            // TODO: Implement these
            case "allow":
            case "coat_of_arms":
            case "gain_effect":
            case "pagan_coa":
                parser.ReadInsideBrackets((p) => { });
                break;

            case "assimilate":
                Entity.AllowsAssimilation = parser.ReadBool();
                break;

            case "color":
                Entity.PrimaryColour = parser.ReadIntList().ToArray();
                break;

            case "color2":
                Entity.SecondaryColour = parser.ReadIntList().ToArray();
                break;

            case "caliphate":
                Entity.IsCaliphate = parser.ReadBool();
                break;

            case "capital":
                Entity.CapitalId = parser.ReadInt32();
                break;

            case "controls_religion":
                Entity.ControlledReligionId = parser.ReadString();
                break;

            case "creation_requires_capital":
                Entity.CreationRequiresCapital = parser.ReadBool();
                break;

            case "culture":
                Entity.CultureId = parser.ReadString();
                break;

            case "dignity":
                Entity.Dignity = parser.ReadInt32();
                break;

            case "dynasty_title_names":
                Entity.UseDynastyTitleNames = parser.ReadBool();
                break;

            case "female_names":
                Entity.FemaleNames = parser.ReadStringList();
                break;

            case "foa":
                Entity.TitleFormOfAddress = parser.ReadString();
                break;

            case "graphical_culture":
                Entity.GraphicalCulture = parser.ReadString();
                break;

            case "has_top_de_jure_capital":
                Entity.HasTopDeJureCapital = parser.ReadBool();
                break;

            case "holy_order":
                Entity.IsHolyOrder = parser.ReadBool();
                break;

            case "holy_site":
                Entity.HolySites.Add(parser.ReadString());
                break;

            case "independent":
                Entity.IsIndependent = parser.ReadBool();
                break;

            case "landless":
                Entity.IsLandless = parser.ReadBool();
                break;

            case "location_ruler_title":
                Entity.TitleContainsCapital = parser.ReadBool();
                break;

            case "male_names":
                Entity.MaleNames = parser.ReadStringList();
                break;

            case "mercenary":
                Entity.IsMercenaryGroup = parser.ReadBool();
                break;

            case "mercenary_type":
                Entity.MercenaryType = parser.ReadString();
                break;

            case "monthly_income":
                Entity.MonthlyIncome = parser.ReadInt32();
                break;

            case "name_tier":
                Entity.TitleNameTierId = parser.ReadString();
                break;

            case "pirate":
                Entity.IsPirate = parser.ReadBool();
                break;

            case "primary":
                Entity.IsPrimaryTitle = parser.ReadBool();
                break;

            case "purple_born_heirs":
                Entity.HasPurpleBornHeirs = parser.ReadBool();
                break;

            case "religion":
                Entity.ReligionId = parser.ReadString();
                break;

            case "short_name":
                Entity.UseShortName = parser.ReadBool();
                break;

            case "strength_growth_per_century":
                Entity.StrengthGrowthPerCentury = parser.ReadFloat();
                break;

            case "title":
                Entity.TitleLocalisationId = parser.ReadString();
                break;

            case "title_female":
                Entity.TitleLocalisationFemaleId = parser.ReadString();
                break;

            case "title_prefix":
                Entity.TitleLocalisationPrefixId = parser.ReadString();
                break;

            case "tribe":
                Entity.IsTribe = parser.ReadBool();
                break;

            default:
                string stringValue = parser.ReadString();
                int    intValue;

                if (int.TryParse(stringValue, out intValue))
                {
                    Entity.ReligiousValues.AddOrUpdate(token, intValue);
                }
                else
                {
                    Entity.DynamicNames.AddOrUpdate(token, stringValue);
                }

                break;
            }
        }