예제 #1
0
 public NameBank(PawnNameCategory ID)
 {
     nameType = ID;
     names    = new List <string> [numGenders, numSlots];
     for (int i = 0; i < numGenders; i++)
     {
         for (int j = 0; j < numSlots; j++)
         {
             names[i, j] = new List <string>();
         }
     }
 }
예제 #2
0
 public REB_NameBank(PawnNameCategory ID)
 {
     this.nameType = ID;
     this.names    = new List <string> [REB_NameBank.numGenders, REB_NameBank.numSlots];
     for (int i = 0; i < REB_NameBank.numGenders; i++)
     {
         for (int j = 0; j < REB_NameBank.numSlots; j++)
         {
             this.names[i, j] = new List <string>();
         }
     }
 }
        private static NameTriple GeneratePawnName_Shuffled(Pawn pawn, string forcedLastName = null)
        {
            PawnNameCategory pawnNameCategory = pawn.RaceProps.nameCategory;

            if (pawnNameCategory == PawnNameCategory.NoName)
            {
                Log.Message("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));
        }
예제 #4
0
 public NameBank(PawnNameCategory ID)
 {
     this.nameType = ID;
     this.names    = new List <string> [NameBank.numGenders, NameBank.numSlots];
     for (int i = 0; i < NameBank.numGenders; i++)
     {
         for (int j = 0; j < NameBank.numSlots; j++)
         {
             List <string>[,] array = this.names;
             int           num  = i;
             int           num2 = j;
             List <string> list = new List <string>();
             array[num, num2] = list;
         }
     }
 }
예제 #5
0
        static PawnNameDatabaseShuffled()
        {
            banks = new Dictionary <PawnNameCategory, NameBank>();
            IEnumerator enumerator = Enum.GetValues(typeof(PawnNameCategory)).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    PawnNameCategory pawnNameCategory = (PawnNameCategory)enumerator.Current;
                    if (pawnNameCategory != 0)
                    {
                        banks.Add(pawnNameCategory, new NameBank(pawnNameCategory));
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            NameBank nameBank = BankOf(PawnNameCategory.HumanStandard);

            nameBank.AddNamesFromFile(PawnNameSlot.First, Gender.Male, "First_Male");
            nameBank.AddNamesFromFile(PawnNameSlot.First, Gender.Female, "First_Female");
            nameBank.AddNamesFromFile(PawnNameSlot.Nick, Gender.Male, "Nick_Male");
            nameBank.AddNamesFromFile(PawnNameSlot.Nick, Gender.Female, "Nick_Female");
            nameBank.AddNamesFromFile(PawnNameSlot.Nick, Gender.None, "Nick_Unisex");
            nameBank.AddNamesFromFile(PawnNameSlot.Last, Gender.None, "Last");
            foreach (NameBank value in banks.Values)
            {
                value.ErrorCheck();
            }
        }
        static PawnNameDatabaseShuffled()
        {
            IEnumerator enumerator = Enum.GetValues(typeof(PawnNameCategory)).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    object           obj = enumerator.Current;
                    PawnNameCategory pawnNameCategory = (PawnNameCategory)obj;
                    if (pawnNameCategory != PawnNameCategory.NoName)
                    {
                        PawnNameDatabaseShuffled.banks.Add(pawnNameCategory, new NameBank(pawnNameCategory));
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
            NameBank nameBank = PawnNameDatabaseShuffled.BankOf(PawnNameCategory.HumanStandard);

            nameBank.AddNamesFromFile(PawnNameSlot.First, Gender.Male, "First_Male");
            nameBank.AddNamesFromFile(PawnNameSlot.First, Gender.Female, "First_Female");
            nameBank.AddNamesFromFile(PawnNameSlot.Nick, Gender.Male, "Nick_Male");
            nameBank.AddNamesFromFile(PawnNameSlot.Nick, Gender.Female, "Nick_Female");
            nameBank.AddNamesFromFile(PawnNameSlot.Nick, Gender.None, "Nick_Unisex");
            nameBank.AddNamesFromFile(PawnNameSlot.Last, Gender.None, "Last");
            foreach (NameBank nameBank2 in PawnNameDatabaseShuffled.banks.Values)
            {
                nameBank2.ErrorCheck();
            }
        }
예제 #7
0
 public static NameBank BankOf(PawnNameCategory category)
 {
     return(banks[category]);
 }
예제 #8
0
 public static RTPN_NameBank BankOf(PawnNameCategory category)
 {
     return(RTPN_Initializer.banks[category]);
 }
예제 #9
0
 public static NameBank BankOf(PawnNameCategory category)
 {
     return(PawnNameDatabaseShuffled.banks[category]);
 }
예제 #10
0
        public RacePropertiesStats(RaceProperties p)
        {
            this.intelligence              = p.intelligence;
            this.hasGenders                = p.hasGenders;
            this.needsRest                 = p.needsRest;
            this.nameCategory              = p.nameCategory;
            this.foodType                  = p.foodType;
            this.makesFootprints           = p.makesFootprints;
            this.executionRange            = p.executionRange;
            this.lifeExpectancy            = p.lifeExpectancy;
            this.herdAnimal                = p.herdAnimal;
            this.packAnimal                = p.packAnimal;
            this.predator                  = p.predator;
            this.maxPreyBodySize           = p.maxPreyBodySize;
            this.wildness                  = p.wildness;
            this.petness                   = p.petness;
            this.nuzzleMtbHours            = p.nuzzleMtbHours;
            this.manhunterOnDamageChance   = p.manhunterOnDamageChance;
            this.manhunterOnTameFailChance = p.manhunterOnTameFailChance;
            this.canBePredatorPrey         = p.canBePredatorPrey;
            this.herdMigrationAllowed      = p.herdMigrationAllowed;
            this.gestationPeriodDays       = p.gestationPeriodDays;
            this.mateMtbHours              = p.mateMtbHours;
            this.nameOnTameChance          = p.nameOnTameChance;
            //this.nameOnNuzzleChance = p.nameOnNuzzleChance;
            this.baseBodySize    = p.baseBodySize;
            this.baseHealthScale = p.baseHealthScale;
            this.baseHungerRate  = p.baseHungerRate;
            this.meatLabel       = p.meatLabel;
            this.meatMarketValue = p.meatMarketValue;

            this.meatColor = new ColorStats(p.meatColor);
            if (p.specialShadowData != null)
            {
                this.specialShadowData = new ShadowDataStats(p.specialShadowData);
            }
            if (p.soundCallIntervalRange != null)
            {
                this.soundCallIntervalRange = new MinMaxIntStats(p.soundCallIntervalRange);
            }
            if (p.ageGenerationCurve != null)
            {
                this.ageGenerationCurve = new SimpleCurveStats(p.ageGenerationCurve);
            }
            if (p.litterSizeCurve != null)
            {
                this.litterSizeCurve = new SimpleCurveStats(p.litterSizeCurve);
            }

            Util.Populate(out this.wildBiomes, p.wildBiomes, (v) => new FloatValueDefStat <BiomeDef>(v.biome, v.commonality));
            Util.Populate(out this.lifeStageAges, p.lifeStageAges, (v) => new LifeStageAgeStats(v));
            Util.Populate(out this.untrainableTags, p.untrainableTags);
            Util.Populate(out this.trainableTags, p.trainableTags);

            Util.AssignDefStat(GetFleshType(p), out this.fleshType);
            Util.AssignDefStat(GetBloodDef(p), out this.bloodDef);
            Util.AssignDefStat(p.thinkTreeMain, out this.thinkTreeMain);
            Util.AssignDefStat(p.thinkTreeConstant, out this.thinkTreeConstant);
            Util.AssignDefStat(p.body, out this.body);
            Util.AssignDefStat(p.trainability, out this.trainability);
            Util.AssignDefStat(GetNameGenerator(p), out this.nameGenerator);
            Util.AssignDefStat(GetNameGeneratorFemale(p), out this.nameGeneratorFemale);
            Util.AssignDefStat(p.useMeatFrom, out this.useMeatFrom);
            Util.AssignDefStat(p.useLeatherFrom, out this.useLeatherFrom);
            Util.AssignDefStat(p.leatherDef, out this.leatherDef);
            Util.AssignDefStat(p.soundMeleeHitPawn, out this.soundMeleeHitPawn);
            Util.AssignDefStat(p.soundMeleeHitBuilding, out this.soundMeleeHitBuilding);
            Util.AssignDefStat(p.soundMeleeMiss, out this.soundMeleeMiss);
            Util.AssignDefStat(p.meatDef, out this.meatDef);
            Util.AssignDefStat(p.corpseDef, out this.corpseDef);

            this.hediffGiverSets = Util.CreateDefStatList(p.hediffGiverSets);
        }