Пример #1
0
        public void Init()
        {
            LanguageManager.instance.Add("norse", StarNames.Generate(Rand.Next(1000000)));
            LanguageManager.instance.Add("pagan", StarNames.Generate(Rand.Next(1000000)));

            Script s = new Script();

            script = s;
            s.Name = Globals.ModDir + "common\\cultures\\00_cultures.txt";
            s.Root = new ScriptScope();
            CultureGroupParser r = AddCultureGroup("barbarian");

            //  r.Init();
            AllCultureGroups.Add(r);

            var cul = r.AddCulture("norse");

            cul.dna       = CulturalDnaManager.instance.GetNewFromVanillaCulture();
            cul.dna.horde = false;
            //   cul.dna.horde = false;
            cul.DoDetailsForCulture();

            //    cul.Init();
            cul.Name = cul.Scope.Name;
            CultureMap[cul.Scope.Name] = cul;
            AllCultures.Add(cul);
            s.Save();
        }
Пример #2
0
        public void Init()
        {
            Script s = new Script();

            script = s;
            s.Name = Globals.ModDir + "common\\cultures\\00_cultures.txt";
            s.Root = new ScriptScope();
            CultureGroupParser r = AddCultureGroup("barbarian");

            AllCultureGroups.Add(r);
            CultureGroupMap["barbarian"] = r;
            var cul = r.AddCulture("norse");

            r.Name        = "barbarian";
            cul.dna       = CulturalDnaManager.instance.GetNewFromVanillaCulture();
            cul.dna.horde = false;

            cul.DoDetailsForCulture();
            LanguageManager.instance.Add("barbarian", cul.dna.GetPlaceName());

            cul.Name = cul.Scope.Name;
            CultureMap[cul.Scope.Name] = cul;

            AllCultures.Add(cul);
        }
Пример #3
0
        public Government BranchGovernment(Government gov, CultureGroupParser group, CultureParser culture)
        {
            var newGov = gov.Mutate(10);

            {
                if (newGov.type == "nomadic")
                {
                    newGov.type = "tribal";
                    newGov.SetType(newGov.type);
                }
            }

            do
            {
                newGov.name = culture.dna.GetUniqueMaleName();
            } while (LanguageManager.instance.Get(StarNames.SafeName(newGov.name) + "_government") != null);

            string s = newGov.name;

            newGov.name = StarNames.SafeName(newGov.name) + "_government";
            LanguageManager.instance.Add(newGov.name, s);
            group.Governments.Add(newGov);
            if (!newGov.cultureGroupAllow.Contains(culture.Group.Name))
            {
                newGov.cultureGroupAllow.Add(culture.Group.Name);
            }
            return(newGov);
        }
Пример #4
0
        public CultureGroupParser AddCultureGroup(string name, CultureGroupParser group = null)
        {
            ScriptScope scope = new ScriptScope();

            scope.Name = name;
            script.Root.Add(scope);

            CultureGroupParser cgParser = new CultureGroupParser(scope);

            cgParser.Name = scope.Name;
            cgParser.Init();

            if (group != null)
            {
                cgParser.chosenGfx = GetRelatedCultureGfx(group);
            }

            GroupMap[name] = cgParser;

            AllCultureGroups.Add(cgParser);
            AllCultureGroups = AllCultureGroups.Distinct().ToList();

            cgParser.color     = Color.FromArgb(255, Rand.Next(255), Rand.Next(255), Rand.Next(255));
            cgParser.chosenGfx = scope.Scopes[0].Data;

            return(cgParser);
        }
Пример #5
0
        public void LoadVanilla()
        {
            SaveCultures = false;
            var files = ModManager.instance.GetFileKeys("common\\cultures");

            foreach (var file in files)
            {
                Script s = ScriptLoader.instance.LoadKey(file);
                foreach (var rootChild in s.Root.Children)
                {
                    CultureGroupParser p = new CultureGroupParser(rootChild as ScriptScope);

                    AllCultureGroups.Add(p);
                    CultureGroupMap[p.Name] = p;
                    foreach (var scopeChild in p.Scope.Children)
                    {
                        if (scopeChild is ScriptScope)
                        {
                            var sc = scopeChild as ScriptScope;

                            if (sc.Name == "graphical_cultures")
                            {
                                continue;
                            }

                            CultureParser r = new CultureParser(sc, p);
                            AllCultures.Add(r);
                            CultureMap[r.Name] = r;
                            p.Cultures.Add(r);
                            r.Group        = p;
                            r.LanguageName = LanguageManager.instance.Get(r.Name);
                            CulturalDna dna = new CulturalDna();
                            foreach (var scope in r.Scope.Scopes)
                            {
                                if (scope.Name == "male_names" || scope.Name == "female_names")
                                {
                                    String[] male_names = scope.Data.Split(new[] { ' ', '_', '\t' });
                                    foreach (var maleName in male_names)
                                    {
                                        var mName = maleName.Trim();
                                        if (mName.Length > 0)
                                        {
                                            dna.Cannibalize(mName);
                                        }
                                    }
                                }
                            }

                            r.dna = dna;
                        }
                    }
                }
            }
        }
Пример #6
0
        internal static string GetRandomCultureGraphics(CultureGroupParser group = null)
        {
            if (group != null)
            {
                switch (group.chosenGfx)
                {
                case "norsegfx":
                case "germangfx":
                case "frankishgfx":
                case "westerngfx":
                case "saxongfx":
                case "italiangfx":
                case "southerngfx":
                case "occitangfx":
                case "easterngfx":
                case "byzantinegfx":
                case "easternslavicgfx":
                case "westernslavicgfx":
                case "celticgfx":
                    return(wh[Rand.Next(gfx.Count())]);

                case "mongolgfx":
                case "ugricgfx":
                case "turkishgfx":
                case "muslimgfx":
                case "persiangfx":
                case "cumangfx":
                case "arabicgfx":
                case "andalusiangfx":
                case "africangfx":
                case "mesoamericangfx":
                case "indiangfx":
                    return(bl[Rand.Next(gfx.Count())]);

                default:
                    return(gfx[Rand.Next(gfx.Count())]);
                }
            }

            return(gfx[Rand.Next(gfx.Count())]);
        }
Пример #7
0
        public CultureGroupParser AddCultureGroup(string name, CultureGroupParser group = null)
        {
            ScriptScope scope = new ScriptScope();

            scope.Name = name;

            script.Root.Add(scope);

            CultureGroupParser r = new CultureGroupParser(scope);

            r.Init();
            if (group != null)
            {
                r.chosenGfx = GetRelatedCultureGfx(group);
            }
            GroupMap[name] = r;
            AllCultureGroups.Add(r);

            r.chosenGfx = scope.Scopes[0].Data;
            return(r);
        }
Пример #8
0
 private string GetRelatedCultureGfx(CultureGroupParser group)
 {
     return CultureParser.GetRandomCultureGraphics(group);
     
 }
Пример #9
0
 public CultureGroupParser AddCultureGroup(string name, CultureGroupParser group = null)
 {
     ScriptScope scope = new ScriptScope();
     scope.Name = name;
     
     script.Root.Add(scope);
     
     CultureGroupParser r = new CultureGroupParser(scope);
     r.Init();
     if (group != null)
     {
         r.chosenGfx = GetRelatedCultureGfx(group);
     }
     GroupMap[name] = r;
     AllCultureGroups.Add(r);
  
     r.chosenGfx = scope.Scopes[0].Data;
     return r;
 }
Пример #10
0
        internal static string GetRandomCultureGraphics(CultureGroupParser group = null)
        {
            if (group != null)
            {
                if (Rand.Next(3) == 0)
                {
                    switch (group.chosenGfx)
                    {
                        case "norsegfx":
                        case "germangfx":
                        case "frankishgfx":
                        case "westerngfx":
                        case "saxongfx":
                        case "italiangfx":
                        case "celticgfx":
                        case "mongolgfx":
                            return wh[Rand.Next(gfx.Count())];
                            break;
                        case "ugricgfx":
                        case "turkishgfx":
                        case "muslimgfx":
                        case "persiangfx":
                        case "cumangfx":
                        case "arabicgfx":
                        case "andalusiangfx":
                        case "africangfx":
                        case "mesoamericangfx":
                        case "indiangfx":
                            return bl[Rand.Next(gfx.Count())];
                            break;
                    }
                }
                else
                {
                    switch (group.chosenGfx)
                    {
                        case "norsegfx":
                        case "germangfx":
                        case "frankishgfx":
                        case "westerngfx":
                        case "saxongfx":
                        case "italiangfx":
                        case "celticgfx":
                        case "mongolgfx":
                            return bl[Rand.Next(gfx.Count())];
                            break;
                        case "ugricgfx":
                        case "turkishgfx":
                        case "muslimgfx":
                        case "persiangfx":
                        case "cumangfx":
                        case "arabicgfx":
                        case "andalusiangfx":
                        case "africangfx":
                        case "mesoamericangfx":
                        case "indiangfx":
                            return wh[Rand.Next(gfx.Count())];
                            break;
                    }
                }
            }

            return gfx[Rand.Next(gfx.Count())];
        }
Пример #11
0
 private string GetRelatedCultureGfx(CultureGroupParser group)
 {
     return(CultureParser.GetRandomCultureGraphics(group));
 }
Пример #12
0
        internal static string GetRandomCultureGraphics(CultureGroupParser group = null)
        {
            if (group != null)
            {
                if (Rand.Next(3) == 0)
                {
                    switch (group.chosenGfx)
                    {
                    case "norsegfx":
                    case "germangfx":
                    case "frankishgfx":
                    case "westerngfx":
                    case "saxongfx":
                    case "italiangfx":
                    case "celticgfx":
                    case "mongolgfx":
                        return(wh[Rand.Next(gfx.Count())]);

                        break;

                    case "ugricgfx":
                    case "turkishgfx":
                    case "muslimgfx":
                    case "persiangfx":
                    case "cumangfx":
                    case "arabicgfx":
                    case "andalusiangfx":
                    case "africangfx":
                    case "mesoamericangfx":
                    case "indiangfx":
                        return(bl[Rand.Next(gfx.Count())]);

                        break;
                    }
                }
                else
                {
                    switch (group.chosenGfx)
                    {
                    case "norsegfx":
                    case "germangfx":
                    case "frankishgfx":
                    case "westerngfx":
                    case "saxongfx":
                    case "italiangfx":
                    case "celticgfx":
                    case "mongolgfx":
                        return(bl[Rand.Next(gfx.Count())]);

                        break;

                    case "ugricgfx":
                    case "turkishgfx":
                    case "muslimgfx":
                    case "persiangfx":
                    case "cumangfx":
                    case "arabicgfx":
                    case "andalusiangfx":
                    case "africangfx":
                    case "mesoamericangfx":
                    case "indiangfx":
                        return(wh[Rand.Next(gfx.Count())]);

                        break;
                    }
                }
            }

            return(gfx[Rand.Next(gfx.Count())]);
        }
Пример #13
0
 public CultureParser(ScriptScope scope, CultureGroupParser group) : base(scope)
 {
     this.group = group;
 }