示例#1
0
        public override void Perform(Sim sim, DiseaseVector vector)
        {
            if (sim.OccultManager == null)
            {
                return;
            }

            if (mRemove)
            {
                OccultTypeHelper.Remove(sim.SimDescription, mOccult, true);
            }
            else
            {
                if (sim.OccultManager.HasOccultType(mOccult))
                {
                    return;
                }

                if (mDropOthers)
                {
                    foreach (OccultTypes type in Enum.GetValues(typeof(OccultTypes)))
                    {
                        if (type == OccultTypes.None)
                        {
                            continue;
                        }

                        OccultTypeHelper.Remove(sim.SimDescription, type, true);
                    }
                }

                OccultTypeHelper.Add(sim.SimDescription, mOccult, false, true);
            }
        }
示例#2
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (!base.PrivateUpdate(frame))
            {
                return(false);
            }

            OccultTypeHelper.Add(Target, mOccult, false, true);

            return(true);
        }
示例#3
0
        public override bool InRabbitHole()
        {
            try
            {
                SimDescription oldSim = Actor.SimDescription;
                SimDescription newSim = Genetics.MakeDescendant(oldSim, oldSim, CASAgeGenderFlags.Child, oldSim.Gender, 100f, new Random(), false, true, true);
                newSim.WasCasCreated = false;

                /*
                 * if (!Household.ActiveHousehold.CanAddSpeciesToHousehold(Actor.SimDescription.Species))
                 * {
                 *  newSim.Dispose();
                 *  return false;
                 * }
                 */

                oldSim.Household.Add(newSim);
                newSim.FirstName = StringInputDialog.Show(Localization.LocalizeString("Gameplay/Objects/RabbitHoles/ScienceLab:NameCloneTitle", new object[0x0]), Localization.LocalizeString("Gameplay/Objects/RabbitHoles/ScienceLab:NameCloneDesc", new object[0x0]), string.Empty, 256, StringInputDialog.Validation.SimNameText);
                Target.SetupNewClone(oldSim, newSim, "ep4CloneTransitionChild");

                // Custom
                foreach (OccultTypes type in OccultTypeHelper.CreateList(oldSim))
                {
                    OccultTypeHelper.Add(newSim, type, false, false);
                }

                IGameObject voucher = Actor.Inventory.Find <IVoucherCloneMe>();
                if (voucher != null)
                {
                    Actor.Inventory.RemoveByForce(voucher);
                    voucher.Destroy();
                    voucher = null;
                }

                EventTracker.SendEvent(EventTypeId.kNewOffspring, Actor, newSim.CreatedSim);
                EventTracker.SendEvent(EventTypeId.kParentAdded, newSim.CreatedSim, Actor);
                EventTracker.SendEvent(EventTypeId.kChildBornOrAdopted, null, newSim.CreatedSim);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
示例#4
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!base.Run(me, singleSelection))
            {
                return(false);
            }

            foreach (SelectionCriteria.Occult.Values type in mTypes)
            {
                if (type.mOccult != OccultTypes.None)
                {
                    OccultTypeHelper.Add(me, type.mOccult, false, true);
                }
                else
                {
                    Urnstones.SimToPlayableGhost(me, type.mDeathType);
                }
            }

            return(true);
        }
示例#5
0
            public void Restore(SimDescription sim)
            {
                try
                {
                    sim.mGenderPreferenceMale   = mMalePreference;
                    sim.mGenderPreferenceFemale = mFemalePreference;

                    if (sim.Pregnancy != null)
                    {
                        sim.Pregnancy.mGender = mPregnantGender;
                    }

                    if (sim.CreatedSim != null)
                    {
                        if (mPreviousOutfitCategory != OutfitCategories.None)
                        {
                            SimOutfit outfit = sim.GetOutfit(mPreviousOutfitCategory, mPreviousOutfitIndex);
                            if (outfit != null)
                            {
                                sim.CreatedSim.mPreviousOutfitKey = outfit.Key;
                            }
                        }

                        if (sim.CreatedSim.DreamsAndPromisesManager != null)
                        {
                            ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode;
                            if (node != null)
                            {
                                node.InternalCount = mLifetimeWishTally;
                            }
                        }
                    }

                    foreach (TraitNames trait in mTraits)
                    {
                        if (sim.TraitManager.HasElement(trait))
                        {
                            continue;
                        }

                        sim.TraitManager.AddElement(trait);
                    }

                    SocialNetworkingSkill networkSkill = sim.SkillManager.GetSkill <SocialNetworkingSkill>(SkillNames.SocialNetworking);
                    if (networkSkill != null)
                    {
                        networkSkill.mNumberOfFollowers = mNumberOfFollowers;
                        networkSkill.mBlogsCreated      = mBlogsCreated;
                    }

                    RockBand bandSkill = sim.SkillManager.GetSkill <RockBand>(SkillNames.RockBand);
                    if (bandSkill != null)
                    {
                        bandSkill.mBandInfo = mBandInfo;
                    }

                    Collecting collecting = sim.SkillManager.GetSkill <Collecting>(SkillNames.Collecting);
                    if (collecting != null)
                    {
                        collecting.mGlowBugData        = mGlowBugData;
                        collecting.mMushroomsCollected = mMushroomsCollected;
                    }

                    NectarSkill nectar = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);
                    if (nectar != null)
                    {
                        nectar.mHashesMade = mNectarHashesMade;
                    }

                    Photography photography = sim.SkillManager.GetSkill <Photography>(SkillNames.Photography);
                    if (photography != null)
                    {
                        // Forces a recalculation of the completion count
                        // photography.mCollectionsCompleted = uint.MaxValue;
                        photography.mCollectionsCompleted = mCollectionsCompleted;

                        if (mSubjectRecords != null)
                        {
                            photography.mSubjectRecords = mSubjectRecords;
                        }

                        if (mStyleRecords != null)
                        {
                            photography.mStyleRecords = mStyleRecords;
                        }

                        if (mSizeRecords != null)
                        {
                            photography.mSizeRecords = mSizeRecords;
                        }
                    }

                    RidingSkill riding = sim.SkillManager.GetSkill <RidingSkill>(SkillNames.Riding);
                    if (riding != null)
                    {
                        if (mCrossCountryCompetitionsWon != null)
                        {
                            riding.mCrossCountryCompetitionsWon = mCrossCountryCompetitionsWon.ToArray();
                        }

                        if (mJumpCompetitionsWon != null)
                        {
                            riding.mJumpCompetitionsWon = mJumpCompetitionsWon.ToArray();
                        }
                    }

                    Bartending mixology = sim.SkillManager.GetSkill <Bartending>(SkillNames.Bartending);
                    if (mixology != null)
                    {
                        if (mCustomDrinks != null)
                        {
                            mixology.mUniqueDrinks = mCustomDrinks;
                        }
                    }

                    if (mOccult != null)
                    {
                        foreach (OccultBaseClass occult in mOccult)
                        {
                            if (OccultTypeHelper.Add(sim, occult.ClassOccultType, false, false))
                            {
                                OccultTransfer transfer = OccultTransfer.Get(occult.ClassOccultType);
                                if (transfer != null)
                                {
                                    transfer.Perform(sim, occult);
                                }
                            }
                        }
                    }

                    mOccult = null;

                    if (mOutfitCache != null)
                    {
                        foreach (SavedOutfit.Cache.Key outfit in mOutfitCache.Outfits)
                        {
                            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, outfit.mKey, false))
                            {
                                builder.Builder.SkinTone      = mSkinToneKey;
                                builder.Builder.SkinToneIndex = mSkinToneIndex;

                                outfit.Apply(builder, true, null, null);
                            }
                        }

                        foreach (SavedOutfit.Cache.Key outfit in mOutfitCache.AltOutfits)
                        {
                            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, outfit.mKey, true))
                            {
                                builder.Builder.SkinTone      = mSkinToneKey;
                                builder.Builder.SkinToneIndex = mSkinToneIndex;

                                outfit.Apply(builder, true, null, null);
                            }
                        }

                        int count         = 0;
                        int originalCount = mOutfitCache.GetOutfitCount(OutfitCategories.Everyday, false);

                        while ((originalCount > 0) && (originalCount < sim.GetOutfitCount(OutfitCategories.Everyday)) && (count < originalCount))
                        {
                            CASParts.RemoveOutfit(sim, new CASParts.Key(OutfitCategories.Everyday, sim.GetOutfitCount(OutfitCategories.Everyday) - 1), false);
                            count++;
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(sim, e);
                }
            }
示例#6
0
        public static bool ApplyOccultChance(SimDescription sim, List <OccultTypes> validTypes, int chanceOfOccult, int chanceOfMutation, int maximumOccultPerSim)
        {
            if (sim == null)
            {
                return(false);
            }

            if (FutureDescendantServiceEx.OccultProcessed.Contains(sim.SimDescriptionId))
            {
                return(false);
            }

            List <OccultTypes> possibleOccults = OccultTypeHelper.CreateListOfAllOccults(true);

            int occultsAdded = -1;

            if (OccultTypeHelper.CreateList(sim).Count > 0) // this handles the possible occult added by EA when the Sim was generated
            {
                occultsAdded = 0;
            }

            foreach (OccultTypes type in validTypes)
            {
                if (occultsAdded >= maximumOccultPerSim)
                {
                    break;
                }

                if (!RandomUtil.RandomChance(chanceOfOccult))
                {
                    continue;
                }

                if (RandomUtil.RandomChance(chanceOfMutation) && possibleOccults.Count > 0)
                {
                    while (possibleOccults.Count > 0)
                    {
                        OccultTypes mutationType = RandomUtil.GetRandomObjectFromList <OccultTypes>(possibleOccults);

                        if (OccultTypeHelper.Add(sim, mutationType, false, false))
                        {
                            possibleOccults.Remove(mutationType);
                            occultsAdded++;
                            break;
                        }

                        possibleOccults.Remove(mutationType);
                    }
                }

                if (OccultTypeHelper.Add(sim, type, false, false))
                {
                    occultsAdded++;
                }
            }

            OccultTypeHelper.ValidateOccult(sim, null);
            FutureDescendantServiceEx.OccultProcessed.Add(sim.SimDescriptionId);

            if (occultsAdded > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#7
0
        public static void AlienRefreshCallback()
        {
            string msg = "Alien Household Refresh" + Common.NewLine;

            if (Household.AlienHousehold == null)
            {
                msg += " - Alien household is null";
                Common.DebugNotify(msg);
                return;
            }

            if (Household.AlienHousehold.NumMembers < AlienUtils.kAlienHouseholdNumMembers)
            {
                msg += " - Adding new alien" + Common.NewLine;

                CASAgeGenderFlags age         = RandomUtil.GetRandomObjectFromList(Aliens.Settings.mValidAlienAges);
                CASAgeGenderFlags gender      = RandomUtil.CoinFlip() ? CASAgeGenderFlags.Male : CASAgeGenderFlags.Female;
                SimDescription    description = MakeAlien(age, gender, GameUtils.GetCurrentWorld(), 1f, true);

                if (Aliens.Settings.mAllowOccultAliens && RandomUtil.RandomChance(Aliens.Settings.mOccultAlienChance))
                {
                    msg += " -- Creating occult alien" + Common.NewLine;

                    int numOccults = RandomUtil.GetInt(1, Aliens.Settings.mMaxAlienOccults);
                    List <OccultTypes> validOccults = new List <OccultTypes>(Aliens.Settings.mValidAlienOccults);

                    for (int i = 0; i < numOccults; i++)
                    {
                        if (validOccults.Count == 0)
                        {
                            break;
                        }

                        OccultTypes type = RandomUtil.GetRandomObjectFromList(validOccults);

                        if (type != OccultTypes.Ghost)
                        {
                            OccultTypeHelper.Add(description, type, false, false);

                            msg += " --- " + OccultTypeHelper.GetLocalizedName(type) + Common.NewLine;
                        }
                        else
                        {
                            SimDescription.DeathType deathType =
                                RandomUtil.GetRandomObjectFromList((SimDescription.DeathType[])Enum.GetValues(typeof(SimDescription.DeathType)));
                            Urnstones.SimToPlayableGhost(description, deathType);

                            msg += " --- " + Urnstones.GetLocalizedString(description.IsFemale, deathType) + Common.NewLine;
                        }

                        validOccults.Remove(type);
                    }
                }

                msg += " -- Adding baseline skills" + Common.NewLine;

                Skill element = null;

                element = description.SkillManager.AddElement(SkillNames.Logic);

                if (element != null)
                {
                    element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mLogicSkill[0], Aliens.Settings.mLogicSkill[1]));
                }

                msg += " --- " + element.Name + Common.NewLine;

                element = description.SkillManager.AddElement(SkillNames.Handiness);

                if (element != null)
                {
                    element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mHandinessSkill[0], Aliens.Settings.mHandinessSkill[1]));
                }

                msg += " --- " + element.Name + Common.NewLine;

                try
                {
                    if (Aliens.Settings.mFutureSim)
                    {
                        msg += " -- Adding Adv Tech skill" + Common.NewLine;

                        description.TraitManager.AddElement(TraitNames.FutureSim);
                        element = description.SkillManager.AddElement(SkillNames.Future);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mFutureSkill[0], Aliens.Settings.mFutureSkill[1]));
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Adv Tech skill", e);
                }

                /*
                 * if (age == CASAgeGenderFlags.Teen)
                 * {
                 *  element = description.SkillManager.AddElement(SkillNames.LearnToDrive);
                 *
                 *  if (element != null)
                 *      element.ForceSkillLevelUp(SkillManager.GetMaximumSupportedSkillLevel(SkillNames.LearnToDrive));
                 * }
                 */

                try
                {
                    if (Aliens.Settings.mAlienScience)
                    {
                        msg += " -- Adding Science skill" + Common.NewLine;

                        //Sim temp = description.InstantiateOffScreen(LotManager.GetFarthestLot(Household.ActiveHouseholdLot));
                        element = description.SkillManager.AddElement(SkillNames.Science);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mScienceSkill[0], Aliens.Settings.mScienceSkill[1]));
                        }

                        //temp.Destroy();
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Science skill", e);
                }

                try
                {
                    if (OccultTypeHelper.HasType(description, OccultTypes.Fairy) || OccultTypeHelper.HasType(description, OccultTypes.PlantSim))
                    {
                        msg += " -- Adding Gardening skill" + Common.NewLine;

                        element = description.SkillManager.AddElement(SkillNames.Gardening);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(3, 6));
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Gardening skill", e);
                }

                try
                {
                    if (OccultTypeHelper.HasType(description, OccultTypes.Fairy))
                    {
                        msg += " -- Adding Fairy Magic skill" + Common.NewLine;

                        element = description.SkillManager.AddElement(SkillNames.FairyMagic);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mFairyMagicSkill[0], Aliens.Settings.mFairyMagicSkill[1]));
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Fairy Magic skill", e);
                }

                try
                {
                    if (OccultTypeHelper.HasType(description, OccultTypes.Werewolf))
                    {
                        msg += " -- Adding Lycanthropy skill" + Common.NewLine;

                        element = description.SkillManager.AddElement(SkillNames.Lycanthropy);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(Aliens.Settings.mLycanthropySkill[0], Aliens.Settings.mLycanthropySkill[1]));
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add Lycanthropy skill", e);
                }

                try
                {
                    if (OccultTypeHelper.HasType(description, OccultTypes.Witch))
                    {
                        msg += " -- Adding witch skills" + Common.NewLine;

                        element = description.SkillManager.AddElement(SkillNames.Spellcasting);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(3, 6));
                        }

                        element = description.SkillManager.AddElement(SkillNames.Spellcraft);

                        if (element != null)
                        {
                            element.ForceSkillLevelUp(RandomUtil.GetInt(3, 6));
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("AlienUtilsEx.AlienRefresh" + Common.NewLine + " - Failed to add witch skills", e);
                }

                msg += " -- Adding alien to household";

                Household.AlienHousehold.AddSilent(description);
                description.OnHouseholdChanged(Household.AlienHousehold, false);

                Common.DebugNotify(msg);
            }
        }
示例#8
0
        public static SimDescription MakeAlienBaby(SimDescription alien, SimDescription abductee, CASAgeGenderFlags gender, float averageMood, Random pregoRandom, bool interactive)
        {
            SimBuilder sb = new SimBuilder();

            sb.Age            = CASAgeGenderFlags.Baby;
            sb.Gender         = gender;
            sb.Species        = CASAgeGenderFlags.Human;
            sb.SkinTone       = alien.SkinToneKey;
            sb.SkinToneIndex  = alien.SkinToneIndex;
            sb.TextureSize    = 1024u;
            sb.UseCompression = true;
            ApplyAlienFaceBlend(gender, ref sb);
            float hue = (sb.SkinToneIndex + 0.5f) % 1f;

            Color[] colors = new Color[]
            {
                HSLToRGB(hue, 0.71f, 0.5f),
                HSLToRGB(hue, 0.72f, 0.5f),
                HSLToRGB(hue, 0.73f, 0.5f),
                HSLToRGB(hue, 0.74f, 0.5f),
                HSLToRGB(hue, 0.75f, 0.5f),
                HSLToRGB(hue, 0.76f, 0.5f),
                HSLToRGB(hue, 0.77f, 0.5f),
                HSLToRGB(hue, 0.78f, 0.5f),
                HSLToRGB(hue, 0.79f, 0.5f),
                HSLToRGB(hue, 0.80f, 0.5f)
            };
            SimDescription baby = Genetics.MakeSim(sb, CASAgeGenderFlags.Baby, gender, alien.SkinToneKey, alien.SkinToneIndex, colors,
                                                   GameUtils.GetCurrentWorld(), 4294967295u, true);

            if (baby != null)
            {
                if (interactive)
                {
                    baby.FirstName = string.Empty;
                }
                else
                {
                    baby.FirstName = SimUtils.GetRandomAlienGivenName(baby.IsMale);
                }

                baby.LastName = abductee.LastName;
                Genetics.AssignTraits(baby, null, abductee, interactive, averageMood, pregoRandom);

                if (Aliens.Settings.mFutureSim)
                {
                    baby.TraitManager.AddHiddenElement(TraitNames.FutureSim);
                }

                if (Aliens.Settings.mAllowOccultBabies)
                {
                    List <OccultTypes> toInherit = OccultsToInherit(OccultTypeHelper.CreateList(abductee), OccultTypeHelper.CreateList(alien));

                    if (toInherit != null && toInherit.Count > 0)
                    {
                        for (int i = 0; i < toInherit.Count; i++)
                        {
                            if (toInherit[i] != OccultTypes.Ghost)
                            {
                                OccultTypeHelper.Add(baby, toInherit[i], false, false);
                            }
                            else
                            {
                                SimDescription.DeathType deathType = GetGhostBabyType(abductee, alien);
                                Urnstones.SimToPlayableGhost(baby, deathType);
                            }
                        }

                        if (OccultTypeHelper.HasType(baby, OccultTypes.Fairy))
                        {
                            CASFairyData casFairyData = baby.SupernaturalData as CASFairyData;

                            if (casFairyData != null)
                            {
                                Vector3   wingColor;
                                WingTypes wingType;
                                Genetics.InheritWings(baby, abductee, alien, pregoRandom, out wingColor, out wingType);
                                casFairyData.WingType  = wingType;
                                casFairyData.WingColor = wingColor;
                            }
                        }
                    }
                    else if (RandomUtil.RandomChance01(abductee.Pregnancy.mChanceOfRandomOccultMutation))
                    {
                        OccultTypeHelper.Add(baby, Pregnancy.ChooseARandomOccultMutation(), false, false);
                    }
                }

                baby.CelebrityManager.SetBabyLevel(Genetics.AssignBabyCelebrityLevel(null, abductee));
                abductee.Genealogy.AddChild(baby.Genealogy);

                if (alien != null)
                {
                    alien.Genealogy.AddChild(baby.Genealogy);
                }
            }

            return(baby);
        }
示例#9
0
        public SimDescription CreateNewSim(SimDescription mom, SimDescription dad, CASAgeGenderFlags ages, CASAgeGenderFlags genders, CASAgeGenderFlags species, bool updateGenealogy)
        {
            if (dad == null)
            {
                dad = GetSim(CASAgeGenderFlags.Male, species, mom);
                if (dad == null)
                {
                    dad = GetSim(CASAgeGenderFlags.Female, species, mom);
                    if (dad == null)
                    {
                        return(null);
                    }
                }
            }

            CASAgeGenderFlags gender = (CASAgeGenderFlags)RandomUtil.SelectOneRandomBit((uint)(genders));
            CASAgeGenderFlags age    = (CASAgeGenderFlags)RandomUtil.SelectOneRandomBit((uint)(ages));

            if (dad.CelebrityManager == null)
            {
                dad.Fixup();
            }

            if (mom.CelebrityManager == null)
            {
                mom.Fixup();
            }

            SimDescription newSim = null;

            try
            {
                if (mom.Species == CASAgeGenderFlags.Human)
                {
                    newSim = Genetics.MakeDescendant(dad, mom, age, gender, 100, new Random(), false, updateGenealogy, true, GetGeneticWorld(), false);

                    newSim.HomeWorld = GameUtils.GetCurrentWorld();
                }
                else
                {
                    newSim = GeneticsPet.MakePetDescendant(dad, mom, age, gender, mom.Species, new Random(), updateGenealogy, GeneticsPet.SetName.SetNameNonInteractive, 0, OccultTypes.None);
                }
            }
            catch (Exception e)
            {
                Common.Exception(dad, mom, e);
            }

            if (newSim == null)
            {
                return(null);
            }

            if (!updateGenealogy)
            {
                FacialBlends.RandomizeBlends(mStats.AddStat, newSim, new Vector2(0f, 0f), true, Manager.GetValue <MutationUnsetRangeOption <TManager>, Vector2>(), true, Manager.GetValue <AllowAlienHouseholdOption <TManager>, bool>());
            }

            List <OccultTypes> occults = new List <OccultTypes>();

            occults.AddRange(OccultTypeHelper.CreateList(mom.OccultManager.CurrentOccultTypes, true));
            occults.AddRange(OccultTypeHelper.CreateList(dad.OccultManager.CurrentOccultTypes, true));

            if (updateGenealogy)
            {
                Manager.Sims.ApplyOccultChance(Manager, newSim, occults, Manager.GetValue <ChanceOfHybridOption <TManager>, int>(), Manager.GetValue <MaximumOccultOption <TManager>, int>());
            }
            else if (species == CASAgeGenderFlags.Human)
            {
                int maxCelebrityLevel = Manager.GetValue <MaxCelebrityLevelOption <TManager>, int>();

                if (maxCelebrityLevel >= 0)
                {
                    newSim.CelebrityManager.mOwner = newSim;

                    Skill scienceSkill = SkillManager.GetStaticSkill(SkillNames.Science);
                    if (scienceSkill != null)
                    {
                        scienceSkill.mNonPersistableData.SkillCategory |= SkillCategory.Hidden;
                    }

                    try
                    {
                        newSim.CelebrityManager.ForceSetLevel((uint)RandomUtil.GetInt(maxCelebrityLevel));
                    }
                    finally
                    {
                        if (scienceSkill != null)
                        {
                            scienceSkill.mNonPersistableData.SkillCategory &= ~SkillCategory.Hidden;
                        }
                    }
                }

                occults.AddRange(Manager.GetValue <ImmigrantOccultOption <TManager>, List <OccultTypes> >());
                if (occults.Count > 0)
                {
                    if (RandomUtil.RandomChance(Manager.GetValue <ChanceOfOccultOption <TManager>, int>()))
                    {
                        OccultTypeHelper.Add(newSim, RandomUtil.GetRandomObjectFromList(occults), false, false);
                    }
                }
            }

            Manager.Sims.ApplyOccultChance(Manager, newSim, occults, Manager.GetValue <ChanceOfHybridOption <TManager>, int>(), Manager.GetValue <MaximumOccultOption <TManager>, int>());

            OccultTypeHelper.ValidateOccult(newSim, null);

            OccultTypeHelper.TestAndRebuildWerewolfOutfit(newSim);

            newSim.FirstName = Manager.Sims.EnsureUniqueName(newSim);

            List <Trait> traits = new List <Trait>(newSim.TraitManager.List);

            foreach (Trait trait in traits)
            {
                if (trait.IsHidden)
                {
                    newSim.TraitManager.RemoveElement(trait.Guid);
                }
            }

            List <Trait> choices = AgingManager.GetValidTraits(newSim, true, true, true);

            if (choices.Count > 0)
            {
                while (!newSim.TraitManager.TraitsMaxed())
                {
                    Trait choice = RandomUtil.GetRandomObjectFromList <Trait>(choices);
                    if (!newSim.TraitManager.AddElement(choice.Guid))
                    {
                        break;
                    }
                }
            }

            if (SimFromBinEvents.OnGeneticSkinBlend != null)
            {
                SimFromBinEvents.OnGeneticSkinBlend(mStats, newSim, mom, dad, Manager);
            }

            FixInvisibleTask.Perform(newSim, true);

            if (SimFromBinEvents.OnSimFromBinUpdate != null)
            {
                SimFromBinEvents.OnSimFromBinUpdate(mStats, newSim, mom, dad, Manager);
            }

            INameTakeOption nameTake = Manager.GetOption <NameTakeOption <TManager> >();

            if ((!updateGenealogy) && (nameTake != null))
            {
                bool wasEither;
                newSim.LastName = Manager.Sims.HandleName(nameTake, mom, dad, out wasEither);
            }
            else if (mom != null)
            {
                newSim.LastName = mom.LastName;
            }
            else if (dad != null)
            {
                newSim.LastName = dad.LastName;
            }

            if (!updateGenealogy && Manager.GetValue <CustomNamesOnlyOption <TManager>, bool>())
            {
                newSim.LastName = LastNameListBooter.GetRandomName(!Manager.GetValue <CustomNamesOnlyOption <TManager>, bool>(), newSim.Species, newSim.IsFemale);
            }

            return(newSim);
        }