Beispiel #1
0
        private static void ParseMiscRules(ParadoxParser parser, string tag)
        {
            switch (tag)
            {
            case "liege_culture_chance":
                m_ruleset.LiegeCultureChance = parser.ReadInt32();
                break;

            case "liege_religion_chance":
                m_ruleset.LiegeReligionChance = parser.ReadInt32();
                break;

            case "female_ruler_chance":
                m_ruleset.FemaleRulerChance = parser.ReadInt32();
                break;

            case "ruler_spouse_chance":
                m_ruleset.RulerSpouseChance = parser.ReadInt32();
                break;

            case "reps_force_custom_duchies":
                m_ruleset.RepsForceCustomDuchies = parser.ReadBool();
                break;

            case "rep_expand_chance":
                m_ruleset.RepublicExpandChance = parser.ReadInt32();
                break;

            case "rep_expand_max":
                m_ruleset.RepublicExpandMax = parser.ReadInt32();
                break;

            case "empire_min_size":
                m_ruleset.EmpireMinSize = parser.ReadInt32();
                break;

            case "kingdom_min_size":
                m_ruleset.KingdomMinSize = parser.ReadInt32();
                break;

            case "duchy_min_size":
                m_ruleset.DuchyMinSize = parser.ReadInt32();
                break;

            case "clear_characters":
                m_ruleset.ClearCharacters = parser.ReadBool();
                break;

            case "character_start_id":
                m_ruleset.CharacterStartID = parser.ReadInt32();
                break;
            }
        }
Beispiel #2
0
        partial void unrecognizedToken(ParadoxParser parser, string token)
        {
#if THOROUGH_PARSING
            if (parser.ReadBool())
                Buildings.Add(token);
#endif
        }
Beispiel #3
0
		private static void ParseMiscRules( ParadoxParser parser, string tag )
		{
			switch ( tag )
			{
				case "liege_culture_chance":
					m_ruleset.LiegeCultureChance = parser.ReadInt32();
					break;
				case "liege_religion_chance":
					m_ruleset.LiegeReligionChance = parser.ReadInt32();
					break;
				case "female_ruler_chance":
					m_ruleset.FemaleRulerChance = parser.ReadInt32();
					break;
				case "ruler_spouse_chance":
					m_ruleset.RulerSpouseChance = parser.ReadInt32();
					break;

				case "reps_force_custom_duchies":
					m_ruleset.RepsForceCustomDuchies = parser.ReadBool();
					break;
				case "rep_expand_chance":
					m_ruleset.RepublicExpandChance = parser.ReadInt32();
					break;
				case "rep_expand_max":
					m_ruleset.RepublicExpandMax = parser.ReadInt32();
					break;
				case "empire_min_size":
					m_ruleset.EmpireMinSize = parser.ReadInt32();
					break;

				case "kingdom_min_size":
					m_ruleset.KingdomMinSize = parser.ReadInt32();
					break;
				case "duchy_min_size":
					m_ruleset.DuchyMinSize = parser.ReadInt32();
					break;
				case "clear_characters":
					m_ruleset.ClearCharacters = parser.ReadBool();
					break;
				case "character_start_id":
					m_ruleset.CharacterStartID = parser.ReadInt32();
					break;
			}
		}
Beispiel #4
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}\"");
            }
        }
        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;
            }
        }