Esempio n. 1
0
        public Vic2Culture(string eu4Name, Vic2World vic2World, string vic2Name, Vic2CultureGroup group, string prefix, bool neoCulture = false)
        {
            Group = group;
            Name  = vic2Name;

            World       = vic2World;
            eu4Cultures = new List <Eu4Culture>();
            eu4Cultures.Add(vic2World.Eu4Save.Cultures[eu4Name]);
            var display = string.Empty;

            if (isNeoCulture)
            {
                var culture = vic2World.Cultures[vic2World.V2Mapper.GetV2Culture(eu4Cultures[0].Name)];
                display = culture.DisplayName;
            }
            else
            {
                display = eu4Cultures[0].DisplayName;
            }
            DisplayName  = (string.IsNullOrEmpty(prefix) ? string.Empty : (prefix + "-")) + display;
            FirstNames   = eu4Cultures[0].MaleNames.ToList();
            isNeoCulture = neoCulture;

            LastNames = eu4Cultures[0].DynastyNames;
            if (vic2World.PrimaryNations)
            {
                SetupPrimaryNation(vic2World);
            }
        }
Esempio n. 2
0
        public string GetV2Culture(string eu4Culture, Eu4ProvinceBase prov, Vic2Province vProv)
        {
            var culture = Map(Culture, eu4Culture);

            if (prov != null)
            {
                Vic2CultureGroup group = null;
                if (World.Cultures.ContainsKey(culture))
                {
                    group = World.Cultures[culture].Group;
                }
                else if (World.CultureGroups.ContainsKey(culture))
                {
                    group = World.CultureGroups[culture];
                }
                else
                {
                    group = new Vic2CultureGroup(World.Eu4Save.Cultures[eu4Culture].Group, World);
                }
                var dist = group.GetDistance(vProv);
                if (dist > 20)                 //diff cul, same group

                // different cultures for off colonies
                {
                    var neoEu4Culture = $"{eu4Culture}:{prov.Continent.Name}";
                    var neoCulture    = Map(Culture, neoEu4Culture);
                    if (neoCulture == null)
                    {
                        // todo: fix what this will do to nations on borders between continents such as the ottomans
                        neoCulture = World.GenerateCulture(eu4Culture, culture + '_' + prov.Continent.Name + 'n', World.Eu4Save.Localisation[prov.Continent.Name], true);

                        NeoCultures[neoCulture] = culture;
                        Culture.Add(neoEu4Culture, neoCulture);
                    }
                    return(neoCulture);
                }
            }

            if (culture == null || !World.Cultures.ContainsKey(culture))
            {
                culture = World.GenerateCulture(eu4Culture, culture);
                if (!Culture.ContainsKey(eu4Culture))
                {
                    Culture.Add(eu4Culture, culture);
                }
            }
            return(culture);
        }
Esempio n. 3
0
        private void LoadVicCulture()
        {
            Console.WriteLine("Loading Vic2 Cultures...");
            CultureGroups = new Dictionary <string, Vic2CultureGroup>();
            Cultures      = new Dictionary <string, Vic2Culture>();
            var cultures = PdxSublist.ReadFile(Path.Combine(VIC2_DIR, @"common\cultures.txt"));

            foreach (var culGroup in cultures.Sublists)
            {
                var nextGroup = new Vic2CultureGroup(this, culGroup.Value);
                CultureGroups[culGroup.Key] = nextGroup;
                nextGroup.Cultures.ForEach(c => Cultures.Add(c.Name, c));
            }

            Console.WriteLine("Loading cultureNations.txt");
            CultureNations = PdxSublist.ReadFile("cultureNations.txt");
        }
Esempio n. 4
0
 public Vic2Culture(Vic2World world, PdxSublist data, Vic2CultureGroup group)
 {
     World       = world;
     Group       = group;
     Name        = data.Key;
     DisplayName = world.VanillaLocalisation[Name];
     FirstNames  = data.GetSublist("first_names").Values;
     LastNames   = data.GetSublist("last_names").Values;
     Colour      = new Colour(data.GetSublist("color").FloatValues[string.Empty]);
     eu4Cultures = world.V2Mapper.Culture.Where(c => c.Value == Name).Select(s => world.Eu4Save.Cultures.ContainsKey(s.Key) ? world.Eu4Save.Cultures[s.Key] : null).Where(s => s != null).ToList();
     if (data.KeyValuePairs.ContainsKey("primary"))
     {
         primaryKey = data.GetString("primary");
     }
     if (world.PrimaryNations)
     {
         SetupPrimaryNation(world);
     }
 }
Esempio n. 5
0
 public Vic2Country(Vic2World world, string tag, Vic2CultureGroup cultureGroup) : this(world, tag, world.Vic2Countries.Where(c => cultureGroup.Cultures.Find(cul => c.PrimaryCulture == cul.Name) != null), cultureGroup.Cultures.First())
 {
 }
Esempio n. 6
0
 public Vic2Culture(string name, Vic2World vic2World, Vic2CultureGroup group) : this(name, vic2World, name, group, "")
 {
 }