Beispiel #1
0
        private void ParseDynasties(ParadoxParser parser, string tag)
        {
            Dynasty dyn = new Dynasty();

            dyn.ID       = Int32.Parse(tag);
            dyn.Filename = m_lastFileName;

            Dynasties[dyn.ID] = dyn;


            Action <ParadoxParser, string> getOptions = (p, s) =>
            {
                if (s == "name")
                {
                    dyn.Name = p.ReadString();
                }
                else if (s == "culture")
                {
                    dyn.CultureString = p.ReadString();
                }
                else if (s == "coat_of_arms")
                {
                    ParseCoatOfArms(dyn, p, s);
                }
            };

            parser.Parse(getOptions);
        }
Beispiel #2
0
        private void ParseCoatOfArms(Dynasty dyn, ParadoxParser parser, string tag)
        {
            Option.ParseGeneric(parser, tag);
            GroupOption og = (GroupOption)Option.GetLastRoot();

            dyn.CoatOfArms = og;
        }
Beispiel #3
0
        public Dynasty GetDynastyByCulture(Dictionary <int, Dynasty> availDynasties, Culture.Culture cul, Random rand)
        {
            List <Dynasty> dynList = GetDynastyListByCulture(availDynasties, cul);

            Dynasty dyn = dynList.RandomItem(rand);

            if (dyn == null)
            {
                //Find one in the same culture group
                List <Culture.Culture> culList = cul.Group.Cultures.Select(c => c.Value).ToList();
                culList.Remove(cul);
                while (dyn == null && culList.Count > 0)
                {
                    cul = culList.RandomItem(rand);
                    culList.Remove(cul);

                    dynList = GetDynastyListByCulture(availDynasties, cul);

                    dyn = dynList.RandomItem(rand);
                }
            }
            return(dyn);
        }