Exemplo n.º 1
0
        public static void AddAllCustom()
        {
            NameBank nameBank = PawnNameDatabaseShuffled.BankOf(PawnNameCategory.HumanStandard);

            foreach (RandomNameDef curDef in DefDatabase <RandomNameDef> .AllDefs)
            {
                nameBank.AddNamesDedup(curDef.slot, curDef.gender, curDef.shuffledNames);
            }
        }
        public override string Generate()
        {
            NameBank nameBank = PawnNameDatabaseShuffled.BankOf(PawnNameCategory.HumanStandard);
            Gender   gender   = this.gender;

            if (gender == Gender.None)
            {
                gender = ((Rand.Value < 0.5f) ? Gender.Male : Gender.Female);
            }
            return(nameBank.GetName(PawnNameSlot.First, gender, checkIfAlreadyUsed: false));
        }
Exemplo n.º 3
0
        public static void TranslateVanilla()
        {
            NameBank nameBank = PawnNameDatabaseShuffled.BankOf(PawnNameCategory.HumanStandard);

            nameBank.Clear();
            foreach (ShuffledNameDef curDef in DefDatabase <ShuffledNameDef> .AllDefs)
            {
                nameBank.AddNames(curDef.slot, curDef.gender, curDef.shuffledNames);
            }
            nameBank.ErrorCheck();
        }
        public override string Generate()
        {
            NameBank nameBank = PawnNameDatabaseShuffled.BankOf(PawnNameCategory.HumanStandard);
            Gender   gender   = this.gender;

            if (gender == Gender.None)
            {
                gender = (Gender)((Rand.Value < 0.5) ? 1 : 2);
            }
            return(nameBank.GetName(PawnNameSlot.First, gender));
        }
Exemplo n.º 5
0
        private void GiveRandomName()
        {
            // Hack namegen to avoid weird error
            List <string> names =
                (List <string>)
                typeof(NameBank).GetMethod("NamesFor", BindingFlags.NonPublic | BindingFlags.Instance)
                .Invoke(PawnNameDatabaseShuffled.BankOf(PawnNameCategory.HumanStandard),
                        new object[] { gender, PawnNameSlot.Nick });

            //Name = new NameSingle(names.RandomElement()); //NameGenerator.GenerateName(this); << throws weird error
            Name = new NameTriple("Mechanoid", names.RandomElement(), def.LabelCap);
        }
Exemplo n.º 6
0
        public static void Debug()
        {
            NameBank nameBank = PawnNameDatabaseShuffled.BankOf(PawnNameCategory.HumanStandard);

            Log.Message($"PawnNameDatabaseShuffled {PawnNameSlot.First} {Gender.Male} {nameBank.NamesFor(PawnNameSlot.First, Gender.Male).Count}");
            Log.Message($"PawnNameDatabaseShuffled {PawnNameSlot.First} {Gender.Female} {nameBank.NamesFor(PawnNameSlot.First, Gender.Female).Count}");
            Log.Message($"PawnNameDatabaseShuffled {PawnNameSlot.Nick} {Gender.Male} {nameBank.NamesFor(PawnNameSlot.Nick, Gender.Male).Count}");
            Log.Message($"PawnNameDatabaseShuffled {PawnNameSlot.Nick} {Gender.Female} {nameBank.NamesFor(PawnNameSlot.Nick, Gender.Female).Count}");
            Log.Message($"PawnNameDatabaseShuffled {PawnNameSlot.Nick} {Gender.None} {nameBank.NamesFor(PawnNameSlot.Nick, Gender.None).Count}");
            Log.Message($"PawnNameDatabaseShuffled {PawnNameSlot.Last} {Gender.None} {nameBank.NamesFor(PawnNameSlot.Last, Gender.None).Count}");
            Log.Message($"PawnNameDatabaseSolid {PawnNameDatabaseSolid.AllNames().Count()}");
        }
Exemplo n.º 7
0
        private static NameTriple GeneratePawnName_Shuffled(Pawn pawn, string forcedLastName = null)
        {
            PawnNameCategory pawnNameCategory = pawn.RaceProps.nameCategory;

            if (pawnNameCategory == PawnNameCategory.NoName)
            {
                Log.Message("ProPawnBioAndNameGenerator.GeneratePawnName_Shuddled: Can't create a name of type NoName. Defaulting to HumanStandard.");
                pawnNameCategory = PawnNameCategory.HumanStandard;
            }
            NameBank nameBank = PawnNameDatabaseShuffled.BankOf(pawnNameCategory);
            string   name     = nameBank.GetName(PawnNameSlot.First, pawn.gender);
            string   text;

            if (forcedLastName != null)
            {
                text = forcedLastName;
            }
            else
            {
                text = nameBank.GetName(PawnNameSlot.Last, Gender.None);
            }
            int    num = 0;
            string nick;

            do
            {
                num++;
                if (Rand.Value < 0.15f)
                {
                    Gender gender = pawn.gender;
                    if (Rand.Value < 0.5f)
                    {
                        gender = Gender.None;
                    }
                    nick = nameBank.GetName(PawnNameSlot.Nick, gender);
                }
                else if (Rand.Value < 0.5f)
                {
                    nick = name;
                }
                else
                {
                    nick = text;
                }
            }while (num < 50 && NameUseChecker.AllPawnsNamesEverUsed.Any(delegate(Name x)
            {
                NameTriple nameTriple = x as NameTriple;
                return(nameTriple != null && nameTriple.Nick == nick);
            }));
            return(new NameTriple(name, nick, text));
        }
Exemplo n.º 8
0
        public static void Setup()
        {
            if (ModsConfig.ActiveModsInLoadOrder.Any(mod => mod.Name.Contains("[RF] Editable Pawn Names")))
            {
                detectedREPN = true;
            }
            if (Controller.Settings.useLiteMode.Equals(false))
            {
                foreach (KeyValuePair <string, Backstory> story in BackstoryDatabase.allBackstories)
                {
                    if (story.Key.Equals("ColonySettler43"))
                    {
                        break;
                    }
                    REB_Initializer.REB_Backstories.Add(story.Key, story.Value);
                    if (story.Value.slot == BackstorySlot.Childhood)
                    {
                        if (story.Value.shuffleable.Equals(true))
                        {
                            childCountHAR++;
                        }
                        else
                        {
                            childNSCountHAR++;
                        }
                    }
                    else
                    {
                        if (story.Value.shuffleable.Equals(true))
                        {
                            adultCountHAR++;
                        }
                        else
                        {
                            adultNSCountHAR++;
                        }
                    }
                }
                BackstoryDatabase.allBackstories.Clear();
                BackstoryDatabase.allBackstories = REB_Backstories;
            }
            Log.Message("||========================================");
            Log.Message("|| Setting up Editable Backstories (EB)");
            Log.Message("||========================================");
            if (Controller.Settings.useLiteMode.Equals(true))
            {
                Log.Message("|| 'Lite Mode' in Use.");
                Log.Message("|| Vanilla Backstory Database *NOT* Cleared.");
                Log.Message("|| EB Backstories Added to Vanilla Backstory Database:");
                Log.Message("||    Childhood Backstories (shuffleable): " + childCount);
                Log.Message("||    Childhood Backstories (non-shuffleable): " + childNSCount);
                Log.Message("||    Adulthood Backstories (shuffleable): " + adultCount);
                Log.Message("||    Adulthood Backstories (non-shuffleable): " + adultNSCount);
                Log.Message("||========================================");
            }
            else
            {
                Log.Message("|| Vanilla Backstory Database Cleared.");
                Log.Message("|| Backstories in EB Backstory Database:");
                Log.Message("||    Childhood Backstories (shuffleable): " + childCount);
                Log.Message("||    Childhood Backstories (non-shuffleable): " + childNSCount);
                Log.Message("||    Adulthood Backstories (shuffleable): " + adultCount);
                Log.Message("||    Adulthood Backstories (non-shuffleable): " + adultNSCount);
                Log.Message("|| Humanoid Alien Races (HAR) Backstories Added to REB Database:");
                Log.Message("||    HAR Childhood Backstories (shuffleable): " + childCountHAR);
                Log.Message("||    HAR Childhood Backstories (non-shuffleable): " + childNSCountHAR);
                Log.Message("||    HAR Adulthood Backstories (shuffleable): " + adultCountHAR);
                Log.Message("||    HAR Adulthood Backstories (non-shuffleable): " + adultNSCountHAR);
                Log.Message("||========================================");
            }
            if (detectedREPN.Equals(true))
            {
                Log.Message("|| \"Editable Pawn Names\" (EPN) Detected.");
                Log.Message("|| Names Added to EPN Name Database:");
                Log.Message("||    Full Names (with bios): " + fullBioCount);
                Log.Message("||========================================");
            }
            else
            {
                Log.Message("|| Vanilla Name Database *NOT* Cleared.");
                Log.Message("|| Names Added to Vanilla Name Database:");
                Log.Message("||    First Names: " + firstCount);
                Log.Message("||    Nicknames: " + nickCount);
                Log.Message("||    Last Names: " + lastCount);
                Log.Message("||    Full Names (without bios): " + fullCount);
                Log.Message("||    Full Names (with bios): " + fullBioCount);
                Log.Message("||========================================");
            }
            NameBank nameBank = PawnNameDatabaseShuffled.BankOf(PawnNameCategory.HumanStandard);

            if (NamesFirstMale != null)
            {
                nameBank.AddNames(PawnNameSlot.First, Gender.Male, NamesFirstMale);
            }
            if (NamesFirstFemale != null)
            {
                nameBank.AddNames(PawnNameSlot.First, Gender.Female, NamesFirstFemale);
            }
            if (NamesNicksMale != null)
            {
                nameBank.AddNames(PawnNameSlot.Nick, Gender.Male, NamesNicksMale);
            }
            if (NamesNicksFemale != null)
            {
                nameBank.AddNames(PawnNameSlot.Nick, Gender.Female, NamesNicksFemale);
            }
            if (NamesNicksUnisex != null)
            {
                nameBank.AddNames(PawnNameSlot.Nick, Gender.None, NamesNicksUnisex);
            }
            if (NamesLast != null)
            {
                nameBank.AddNames(PawnNameSlot.Last, Gender.None, NamesLast);
            }
        }