public void TokenCallback(ParadoxParser parser, string token) { if (token == "setgameplayoptions") { options = parser.ReadIntList(); } }
public void TokenCallback(ParadoxParser parser, string token) { switch (token) { case "revolutionary_colors": RevolutionaryColors = parser.ReadIntList(); break; case "map_color": MapColor = parser.ReadIntList(); break; case "country_color": CountryColor = parser.ReadIntList(); break; } }
/// <summary> /// used to parse group options of the type: tag = { tag2 = data ... } /// </summary> /// <param name="tag">The *last* read tag.</param> /// <returns>Parsed option can be retrieved using GetLastRoot()</returns> public static void ParseGeneric(ParadoxParser parser, string tag) { Option opt; if (parser.NextIsBracketed()) { if (tag == "data") { opt = new IntListOption(tag, parser.ReadIntList()); } else { if (tag.Contains(".") && tag.IndexOf(".", StringComparison.Ordinal) != tag.LastIndexOf(".", StringComparison.Ordinal)) { opt = new EventOption(tag); } else { opt = new GroupOption(tag); } m_optionStack.Push(opt); parser.Parse(ParseGeneric); m_optionStack.Pop(); } } else { opt = ParseSingle(tag, parser.ReadString()); } if (m_optionStack.Count == 0) // We're in the root. { m_lastParsedOptionRoot = opt; } else { Option parent = m_optionStack.Peek(); if (parent.Type == OptionType.Group) { ((GroupOption)parent).SubOptions.Add(opt); } else if (parent.Type == OptionType.Event) { ((EventOption)parent).SubOptions.Add(opt); } } }
public void TokenCallback(ParadoxParser parser, string token) { switch (token) { case "development": Development = parser.ReadFloat(); break; case "raw_development": RawDevelopment = parser.ReadFloat(); break; case "capped_development": CappedDevelopment = parser.ReadFloat(); break; case "realm_development": RealmDevelopment = parser.ReadFloat(); break; case "institutions": Institutions = parser.ReadIntList(); break; case "colors": Colors = parser.Parse(new Colors()); break; case "estimated_monthly_income": EstimatedMonthlyIncome = parser.ReadFloat(); break; case "technology": Technology = parser.Parse(new Technology()); break; case "great_power_score": GreatPowerScore = parser.ReadFloat(); break; case "score_rating": ScoreRatings = parser.ReadDoubleList(); break; } }
private void ParseMap(ParadoxParser parser, string s) { IList <int> intList; switch (s) { case "max_provinces": MaxProvinces = parser.ReadInt32(); break; #region File List case "definitions": Definitions = parser.ReadString(); break; case "provinces": Provinces = parser.ReadString(); break; case "positions": Positions = parser.ReadString(); break; case "terrain": Terrain = parser.ReadString(); break; case "rivers": Rivers = parser.ReadString(); break; case "terrain_definition": TerrainDefinition = parser.ReadString(); break; case "heightmap": Heightmap = parser.ReadString(); break; case "tree_definition": TreeDefinition = parser.ReadString(); break; case "continent": Continent = parser.ReadString(); break; case "adjacencies": Adjacencies = parser.ReadString(); break; case "climate": Climate = parser.ReadString(); break; case "region": Region = parser.ReadString(); break; case "static": Static = parser.ReadString(); break; #endregion case "sea_zones": intList = parser.ReadIntList(); SeaZones.Add(new SeaZone(intList[0], intList[1])); break; case "ocean_region": parser.ReadString(); OceanRegions.Add(parser.ReadIntList().ToList()); break; case "tree": Tree.AddRange(parser.ReadIntList().ToList()); break; case "major_rivers": MajorRivers.AddRange(parser.ReadIntList()); break; } }
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) { 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}\""); } }
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; } }