コード例 #1
0
 public static void ChangeSimToTowelOutfit(Sim s, bool romantic)
 {
     if ((s.CurrentOutfitCategory != OutfitCategories.Singed) && !(s.Service is GrimReaper))
     {
         if ((romantic) && (Woohooer.Settings.mNakedOutfitMassage))
         {
             s.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToBathe);
         }
         else
         {
             SimOutfit      outfit         = null;
             SimDescription simDescription = s.SimDescription;
             ResourceKey    key            = ResourceKey.CreateOutfitKey(OutfitUtils.GetAgePrefix(simDescription.Age, true) + OutfitUtils.GetGenderPrefix(simDescription.Gender) + "MassageTowel", 0x2000000);
             outfit = OutfitUtils.CreateOutfitForSim(simDescription, key, OutfitCategories.SkinnyDippingTowel, true);
             if (outfit != null)
             {
                 s.SwitchToOutfitWithSpin(outfit.Key);
             }
             else
             {
                 // Custom
                 s.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.Force, OutfitCategories.Swimwear);
             }
         }
     }
 }
コード例 #2
0
ファイル: SavedOutfit.cs プロジェクト: yakoder/NRaas
            public void Apply(SimBuilder builder)
            {
                Color[] color = ExtractHairColor(mHairPreset);
                if (color != null)
                {
                    OutfitUtils.InjectHairColor(builder, color, BodyTypes.Hair);
                }

                color = ExtractHairColor(mBeardPreset);
                if (color != null)
                {
                    OutfitUtils.InjectHairColor(builder, color, BodyTypes.Beard);
                }

                /*
                 * color = ExtractEyebrowColor(mEyebrowsPreset);
                 * if ((color != null) && (color.Length > 0))
                 * {
                 *  OutfitUtils.InjectEyeBrowHairColor(builder, color[0]);
                 * }
                 *
                 * color = ExtractEyebrowColor(mBodyHairPreset);
                 * if ((color != null) && (color.Length > 0))
                 * {
                 *  OutfitUtils.InjectBodyHairColor(builder, color[0]);
                 * }
                 */
            }
コード例 #3
0
        protected static List <CASParts.Wrapper> GetVisibleCASParts(CASLogic ths, BodyTypes bodyType, uint categories)
        {
            uint alteredCategories = categories;

            ths.AdjustAvailableCategoriesForCASMode(ref alteredCategories);

            SimBuilder builder = ths.mBuilder;

            CASAgeGenderFlags age     = builder.Age;
            CASAgeGenderFlags gender  = builder.Gender;
            CASAgeGenderFlags species = builder.Species;

            List <CASParts.Wrapper> list = new List <CASParts.Wrapper>();

            foreach (CASParts.Wrapper part in CASBase.HairParts)
            {
                InvalidPartBase.Reason reason = InvalidPartBooter.Allow(part, age, gender, species, false, (OutfitCategories)categories);
                if (reason != InvalidPartBase.Reason.None)
                {
                    continue;
                }

                if ((part.mPart.BodyType == bodyType) && OutfitUtils.PartMatchesSim(builder, alteredCategories, part.mPart))
                {
                    list.Add(part);
                }
            }
            return(list);
        }
コード例 #4
0
ファイル: Javpan.cs プロジェクト: niec-and-linc/OpenDGS
        private bool ChangeIntoOutfit(Sim actor)
        {
            if (actor.BuffManager.HasTransformBuff())
            {
                return(false);
            }
            bool result = false;

            actor.RefreshCurrentOutfit(false);
            SimOutfit uniform    = null;
            string    s          = actor.SimDescription.Child ? "c" : "";
            string    outfitName = s + "ArsilChopsticksOutfit";
            bool      flag       = false;

            if (flag || OutfitUtils.TryGenerateSimOutfit(outfitName, ProductVersion.BaseGame, out uniform))
            {
                SimOutfit outfit  = null;
                SimOutfit outfit2 = actor.SimDescription.GetOutfit(actor.CurrentOutfitCategory, actor.CurrentOutfitIndex);
                if (flag || OutfitUtils.TryApplyUniformToOutfit(outfit2, uniform, actor.SimDescription, "ArsilChopsticksOutfit", out outfit))
                {
                    actor.SimDescription.AddSpecialOutfit(outfit, "ArsilChopsticksOutfit");
                    int specialOutfitIndexFromKey = actor.SimDescription.GetSpecialOutfitIndexFromKey(ResourceUtils.HashString32("ArsilChopsticksOutfit"));
                    actor.SwitchToOutfitWithoutSpin(OutfitCategories.Special, specialOutfitIndexFromKey);
                    result = true;
                }
            }
            return(result);
        }
コード例 #5
0
        private new void OnDisplayCAS()
        {
            while ((Sims3.Gameplay.Gameflow.CurrentGameSpeed == Sims3.Gameplay.Gameflow.GameSpeed.Pause) || MoveDialog.InProgress())
            {
                SpeedTrap.Sleep();
            }

            if (Actor.IsSelectable)
            {
                Definition interactionDefinition = InteractionDefinition as Definition;
                switch (interactionDefinition.GetSurgeryType())
                {
                case Hospital.SurgeryTypes.PlasticSurgeryFaceCheap:
                    ApplySurgery(Hospital.SurgeryTypes.PlasticSurgeryFaceCheap, Hospital.kCheapSurgeryFaceCost, Hospital.kCheapSurgeryFailureChance, "Gameplay/Objects/RabbitHoles/Hospital/PlasticSurgery:PlasticSurgeryFaceFailure", "Gameplay/Objects/RabbitHoles/Hospital/PlasticSurgery:PlasticSurgeryFaceSuccess");
                    break;

                case Hospital.SurgeryTypes.PlasticSurgeryFaceExpensive:
                    ApplySurgery(Hospital.SurgeryTypes.PlasticSurgeryFaceExpensive, Hospital.kExpensiveSurgeryFaceCost, Hospital.kExpensiveSurgeryFailureChance, "Gameplay/Objects/RabbitHoles/Hospital/PlasticSurgery:PlasticSurgeryFaceFailure", "Gameplay/Objects/RabbitHoles/Hospital/PlasticSurgery:PlasticSurgeryFaceSuccess");
                    break;

                case Hospital.SurgeryTypes.PlasticSurgeryBodyCheap:
                    ApplySurgery(Hospital.SurgeryTypes.PlasticSurgeryBodyCheap, Hospital.kCheapSurgeryBodyCost, Hospital.kCheapSurgeryFailureChance, "Gameplay/Objects/RabbitHoles/Hospital/PlasticSurgery:PlasticSurgeryBodyFailure", "Gameplay/Objects/RabbitHoles/Hospital/PlasticSurgery:PlasticSurgeryBodySuccess");
                    break;

                case Hospital.SurgeryTypes.PlasticSurgeryBodyExpensive:
                    ApplySurgery(Hospital.SurgeryTypes.PlasticSurgeryBodyExpensive, Hospital.kExpensiveSurgeryBodyCost, Hospital.kExpensiveSurgeryFailureChance, "Gameplay/Objects/RabbitHoles/Hospital/PlasticSurgery:PlasticSurgeryBodyFailure", "Gameplay/Objects/RabbitHoles/Hospital/PlasticSurgery:PlasticSurgeryBodySuccess");
                    break;

                case Hospital.SurgeryTypes.PlasticSurgeryCorrectiveFace:
                    if ((Actor.SimDescription.PreSurgeryFacialBlends != null) && (Actor.FamilyFunds >= Hospital.kCorrectiveFaceSurgeryCost))
                    {
                        Actor.ModifyFunds(-Hospital.kCorrectiveFaceSurgeryCost);
                        OutfitUtils.RestoreFace(Actor);
                        Actor.ShowTNSAndPlayStingIfSelectable(Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Objects/RabbitHoles/Hospital/PlasticSurgery:CorrectiveSurgerySuccess", new object[] { Actor }), StyledNotification.NotificationStyle.kGameMessagePositive, Target.ObjectId, ObjectGuid.InvalidObjectGuid, "sting_plastic_surgery_undo");
                        mReaction = Reaction.Happy;
                    }
                    break;

                case Hospital.SurgeryTypes.PlasticSurgeryCorrectiveBody:
                    if ((Actor.SimDescription.PreSurgeryBodyFitness != -1f) && (Actor.FamilyFunds >= Hospital.kCorrectiveBodySurgeryCost))
                    {
                        Actor.ModifyFunds(-Hospital.kCorrectiveBodySurgeryCost);
                        OutfitUtils.RestoreBody(Actor);
                        Actor.ShowTNSAndPlayStingIfSelectable(Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Objects/RabbitHoles/Hospital/PlasticSurgery:CorrectiveSurgerySuccess", new object[] { Actor }), StyledNotification.NotificationStyle.kGameMessagePositive, Target.ObjectId, ObjectGuid.InvalidObjectGuid, "sting_plastic_surgery_undo");
                        mReaction = Reaction.Happy;
                    }
                    break;
                }

                /*
                 * if (mReaction != Reaction.None)
                 * {
                 *  Actor.RecreateOccupationOutfits();
                 *  (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).NotifySimChanged(Actor.ObjectId);
                 * }
                 */
            }
        }
コード例 #6
0
        private new void ApplySurgery(Hospital.SurgeryTypes type, int cost, float failChance, string failKey, string successKey)
        {
            if (Actor.FamilyFunds > cost)
            {
                Actor.ModifyFunds(-cost);
                if (!RandomUtil.RandomChance01(failChance))
                {
                    if (StartPlasticSurgeryCAS(Actor, type))
                    {
                        Actor.ShowTNSAndPlayStingIfSelectable(Common.LocalizeEAString(Actor.IsFemale, successKey, new object[] { Actor }), StyledNotification.NotificationStyle.kGameMessagePositive, Target.ObjectId, ObjectGuid.InvalidObjectGuid, "sting_plastic_surgery_success");
                        mReaction = Reaction.Happy;
                        switch (type)
                        {
                        case Hospital.SurgeryTypes.PlasticSurgeryFaceCheap:
                        case Hospital.SurgeryTypes.PlasticSurgeryFaceExpensive:
                            Actor.SimDescription.PreSurgeryFacialBlends = null;
                            return;

                        case Hospital.SurgeryTypes.PlasticSurgeryBodyCheap:
                        case Hospital.SurgeryTypes.PlasticSurgeryBodyExpensive:
                            Actor.SimDescription.PreSurgeryBodyFitness = -1f;
                            Actor.SimDescription.PreSurgeryBodyWeight  = -1f;
                            return;

                        case Hospital.SurgeryTypes.PlasticSurgeryCorrectiveFace:
                        case Hospital.SurgeryTypes.PlasticSurgeryCorrectiveBody:
                            return;
                        }
                    }
                    else
                    {
                        Actor.ModifyFunds(cost);
                        Actor.ShowTNSIfSelectable(TNSNames.PlasticSurgeryCancelledTNS, Actor, null, new object[] { Actor });
                        mReaction = Reaction.None;
                    }
                }
                else
                {
                    switch (type)
                    {
                    case Hospital.SurgeryTypes.PlasticSurgeryFaceCheap:
                    case Hospital.SurgeryTypes.PlasticSurgeryFaceExpensive:
                        OutfitUtils.RandomizeFace(Actor);
                        break;

                    case Hospital.SurgeryTypes.PlasticSurgeryBodyCheap:
                    case Hospital.SurgeryTypes.PlasticSurgeryBodyExpensive:
                        OutfitUtils.RandomizeBody(Actor);
                        break;
                    }
                    Actor.ShowTNSAndPlayStingIfSelectable(Common.LocalizeEAString(Actor.IsFemale, failKey, new object[] { Actor }), StyledNotification.NotificationStyle.kGameMessageNegative, Target.ObjectId, ObjectGuid.InvalidObjectGuid, "sting_plastic_surgery_fail");
                    Actor.BuffManager.AddElement(BuffNames.Embarrassed, Origin.FromPlasticSurgery);
                    mReaction = Reaction.Sad;
                }
            }
        }
コード例 #7
0
 public OutfitBuilder(SimDescriptionCore sim, Key key, SimOutfit outfit, bool alternate)
 {
     mBuilder   = new SimBuilder();
     mSim       = sim;
     mKey       = key;
     mAlternate = alternate;
     mOutfit    = outfit;
     if (mOutfit != null)
     {
         OutfitUtils.SetOutfit(mBuilder, mOutfit, sim);
     }
 }
コード例 #8
0
        public FormKey GetLeveledListUsingArmorSets(ISkyrimMod PatchMod, bool createLL = false)
        {
            LeveledItem ll = null;

            if (LLKey == FormKey.Null || createLL)
            {
                var list = Armors.Select(a => a.CreateLeveledList().AsLink <IItemGetter>());
                ll    = OutfitUtils.CreateLeveledList(PatchMod, list, Configuration.Patcher.LeveledListPrefix + Name, 1, Configuration.LeveledListFlag);
                LLKey = ll.FormKey;
            }
            return(LLKey);
        }
コード例 #9
0
        public FormKey CreateLeveledList(ISkyrimMod patchMod, bool forceCreate = false)
        {
            LeveledItem ll = null;

            if (forceCreate || LLFormKey == FormKey.Null)
            {
                var items = Armors.Select(a => a.FormKey.AsLink <IItemGetter>())
                            .Union(Weapons.Select(a => a.AsLink <IItemGetter>()).EmptyIfNull());
                ll        = OutfitUtils.CreateLeveledList(patchMod, items, Prefix, 1, LeveledItem.Flag.UseAll);
                LLFormKey = ll.FormKey;
            }
            return(LLFormKey);
        }
コード例 #10
0
        public static void ProcessAndDistributeJewelary(IPatcherState <ISkyrimMod, ISkyrimModGetter> state)
        {
            Logger.InfoFormat("Creating Leveled list for Jewelary.....");
            ISkyrimMod patchedMod = FileUtils.GetOrAddPatch("ZZZ Jewelry");
            Dictionary <string, HashSet <IArmorGetter> > jewelleries = new Dictionary <string, HashSet <IArmorGetter> >();

            // Adding all the patches to load order
            foreach (IModListing <ISkyrimModGetter> modlist in state.LoadOrder.PriorityOrder
                     .Where(x => Configuration.User.JewelryMods.Contains(x.ModKey.FileName) &&
                            x.Mod.Armors.Count > 0))
            {
                // Getting Jewelary Armors
                ISkyrimModGetter           mod    = modlist.Mod;
                IEnumerable <IArmorGetter> armors = mod.Armors
                                                    .Where(x => ArmorUtils.IsValidArmor(x) &&
                                                           x.Name != null);

                for (int i = 0; i < armors.Count(); i++)
                {
                    IArmorGetter      armor = armors.ElementAtOrDefault(i);
                    IArmorAddonGetter addon = armor.Armature.FirstOrDefault().Resolve(Configuration.Cache);

                    string gender = (addon.WorldModel.Male != null && addon.WorldModel.Female != null
                                    ? "_C_" : addon.WorldModel.Male == null ? "_F_" : "_M_");

                    var bodyFlags = armor.BodyTemplate.FirstPersonFlags;
                    var key       = bodyFlags.ToString() + gender;
                    if (!jewelleries.ContainsKey(key))
                    {
                        jewelleries.Add(key, new HashSet <IArmorGetter>());
                    }
                    jewelleries.GetValueOrDefault(key).Add(armor);
                }
            }

            // Creating leveled list for the jewelleries
            string prefix = Configuration.Patcher.LeveledListPrefix + "_LL_Jewels_";

            jewelleries.Where(x => !Regex.Match(x.Key.ToString(), "Decapitate", RegexOptions.IgnoreCase).Success)
            .ForEach(j =>
            {
                string lvli_eid = prefix + j.Key.ToString().Replace(" ", "_");
                OutfitUtils.CreateLeveledList(patchedMod, j.Value, lvli_eid, 1, LeveledItem.Flag.CalculateForEachItemInCount);
            });
            Logger.InfoFormat("Leveled List created for Jewelary....");

            // Writing patched mod to disk
            DistributeJewelaryUsingSPID(state, patchedMod);
            Logger.InfoFormat("Distribution of Jewelaries is completed...\n\n");
        }
コード例 #11
0
ファイル: CASParts.cs プロジェクト: yakoder/NRaas
 public bool Apply(SimBuilder builder)
 {
     if (builder.AddPart(mPart))
     {
         if (!string.IsNullOrEmpty(mPresetString))
         {
             OutfitUtils.ApplyPresetStringToPart(builder, mPart, mPresetString);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #12
0
ファイル: CASModelProxy.cs プロジェクト: yakoder/NRaas
        protected List <CASParts.Wrapper> SubGetVisibleCASParts(BodyTypes bodyType, uint categories)
        {
            CASLogic logic = mCASModel as CASLogic;

            logic.AdjustAvailableCategoriesForCASMode(ref categories);

            List <CASParts.Wrapper> results = new List <CASParts.Wrapper>();

            foreach (CASParts.Wrapper part in CASBase.sUnboxedParts)
            {
                if ((part.mPart.BodyType == bodyType) && OutfitUtils.PartMatchesSim(logic.mBuilder, categories, part.mPart))
                {
                    results.Add(part);
                }
            }
            return(results);
        }
コード例 #13
0
ファイル: CASParts.cs プロジェクト: yakoder/NRaas
        public static string PartToString(CASPart part)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            msg += Common.NewLine + "Body Type: " + part.BodyType;
            msg += Common.NewLine + "  Instance: 0x" + part.Key.InstanceId.ToString("X16");
            msg += Common.NewLine + "  Group: 0x" + part.Key.GroupId.ToString("X8");
            msg += Common.NewLine + "  Ages: " + (part.AgeGenderSpecies & CASAgeGenderFlags.AgeMask);
            msg += Common.NewLine + "  Genders: " + (part.AgeGenderSpecies & CASAgeGenderFlags.GenderMask);
            msg += Common.NewLine + "  Species: " + (part.AgeGenderSpecies & CASAgeGenderFlags.SpeciesMask);
            msg += Common.NewLine + "  Categories: ";

            foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories)))
            {
                if (category == OutfitCategories.None)
                {
                    continue;
                }

                if ((part.CategoryFlags & (uint)category) == (uint)category)
                {
                    msg += category + ",";
                }
            }

            msg += Common.NewLine + "  Extended: ";

            foreach (OutfitCategoriesExtended category in Enum.GetValues(typeof(OutfitCategoriesExtended)))
            {
                if ((part.CategoryFlags & (uint)category) == (uint)category)
                {
                    msg += category + ",";
                }
            }

            msg += Common.NewLine + "  BotPart: " + OutfitUtils.IsBotPart(part);

            return(msg.ToString());
        }
コード例 #14
0
        public override bool Run()
        {
            Definition definition = InteractionDefinition as Definition;

            string type = definition.mType.ToString();

            string      uniformName;
            ResourceKey key;

            if (definition.mType == ServiceType.GrimReaper)
            {
                uniformName = "YmDeath";

                key = ResourceKey.CreateOutfitKey(uniformName, 0);
            }
            else
            {
                if (!ServiceNPCSpecifications.TryGetUniform(type, Actor.SimDescription.Gender, out key, out uniformName))
                {
                    return(false);
                }
            }

            SimOutfit uniform = new SimOutfit(key);

            if (uniform.IsValid)
            {
                SimOutfit outfit = new SimOutfit(OutfitUtils.ApplyUniformToOutfit(Actor.SimDescription.GetOutfit(OutfitCategories.Everyday, 0), uniform, Actor.SimDescription, "NRaas.Disguise.Run"));
                if (outfit.IsValid)
                {
                    Actor.SimDescription.AddOutfit(outfit, OutfitCategories.Career, true);

                    Actor.PushSwitchToOutfitInteraction(Sim.ClothesChangeReason.GoingToWork, OutfitCategories.Career);
                }
            }

            return(true);
        }
コード例 #15
0
ファイル: AlienGenetics.cs プロジェクト: Duglarogg/Sims3
        public static SimDescription MakeAlien(CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName homeworld, float alienDNAPercentage, bool assignRandomTraits)
        {
            ResourceKey skinTone      = kAlienSkinTones[RandomUtil.GetInt(0, kAlienSkinTones.Length - 1)];
            float       skinToneIndex = GetSkinToneIndex(skinTone);
            SimBuilder  sb            = new SimBuilder();

            sb.Age            = age;
            sb.Gender         = gender;
            sb.Species        = CASAgeGenderFlags.Human;
            sb.SkinTone       = skinTone;
            sb.SkinToneIndex  = skinToneIndex;
            sb.TextureSize    = 1024u;
            sb.UseCompression = true;
            bool flag = (gender == CASAgeGenderFlags.Female);

            SetFacialBlends(sb);
            SimDescription alienDescription = Genetics.MakeSim(sb, age, gender, skinTone, skinToneIndex, kAlienHairColors, homeworld, 4294967295u, true);

            if (alienDescription != null)
            {
                alienDescription.FirstName = SimUtils.GetRandomAlienGivenName(alienDescription.IsMale);
                alienDescription.LastName  = SimUtils.GetRandomAlienFamilyName();
                alienDescription.SetAlienDNAPercentage(alienDNAPercentage);
                alienDescription.VoicePitchModifier = RandomUtil.GetFloat(1.2f, 1.6f);
                alienDescription.VoiceVariation     = (VoiceVariationType)RandomUtil.GetInt(2);

                if (assignRandomTraits)
                {
                    Genetics.AssignRandomTraits(alienDescription);
                }

                if (alienDescription.TeenOrAbove)
                {
                    string s = "a";

                    if (age != CASAgeGenderFlags.Teen)
                    {
                        if (age == CASAgeGenderFlags.Elder)
                        {
                            s = "e";
                        }
                    }
                    else
                    {
                        s = "t";
                    }

                    string      s2     = alienDescription.IsFemale ? "f" : "m";
                    string      name   = s + s2 + "_alienOutfit";
                    ResourceKey key33  = ResourceKey.CreateOutfitKeyFromProductVersion(name, ProductVersion.EP8);
                    SimOutfit   outfit = OutfitUtils.CreateOutfitForSim(alienDescription, key33, OutfitCategories.Everyday, OutfitCategories.Everyday, false);

                    if (outfit != null)
                    {
                        alienDescription.AddOutfit(outfit, OutfitCategories.Everyday, true);
                    }

                    outfit = OutfitUtils.CreateOutfitForSim(alienDescription, key33, OutfitCategories.Formalwear, OutfitCategories.Formalwear, false);

                    if (outfit != null)
                    {
                        alienDescription.AddOutfit(outfit, OutfitCategories.Formalwear, true);
                    }

                    outfit = OutfitUtils.CreateOutfitForSim(alienDescription, key33, OutfitCategories.Outerwear, OutfitCategories.Outerwear, false);

                    if (outfit != null)
                    {
                        alienDescription.AddOutfit(outfit, OutfitCategories.Outerwear, true);
                    }
                }
            }

            return(alienDescription);
        }
コード例 #16
0
 public static void SetFeet(Sim sim, bool addRemove)
 {
     try
     {
         SimBuilder       builder               = new SimBuilder();
         SimDescription   simDescription        = sim.SimDescription;
         OutfitCategories currentOutfitCategory = sim.CurrentOutfitCategory;
         int currentOutfitIndex = sim.CurrentOutfitIndex;
         builder.Clear(false);
         SimOutfit currentOutfit = sim.CurrentOutfit;
         OutfitUtils.SetOutfit(builder, currentOutfit, simDescription);
         if (addRemove)
         {
             sendDebugMsg(sim.FullName + "\nAdding feets.");
             simDescription.AddOutfit(currentOutfit, OutfitCategories.Naked);
             if (simDescription.Child)
             {
                 builder.AddPart(WolfFeetMaskChildUnisex);
             }
             if (simDescription.Teen && simDescription.IsFemale)
             {
                 builder.AddPart(WolfFeetMaskTeenFemale);
             }
             if (simDescription.Teen && simDescription.IsMale)
             {
                 builder.AddPart(WolfFeetMaskTeenMale);
             }
             if (simDescription.Adult && simDescription.YoungAdult && simDescription.IsFemale)
             {
                 builder.AddPart(WolfFeetMaskAdultFemale);
             }
             if (simDescription.Adult && simDescription.YoungAdult && simDescription.IsMale)
             {
                 builder.AddPart(WolfFeetMaskAdultMale);
             }
             if (simDescription.Elder && simDescription.IsFemale)
             {
                 builder.AddPart(WolfFeetMaskElderFemale);
             }
             if (simDescription.Elder && simDescription.IsMale)
             {
                 builder.AddPart(WolfFeetMaskElderMale);
             }
         }
         else
         {
             if (simDescription.Child)
             {
                 builder.RemovePart(WolfFeetMaskChildUnisex);
             }
             if (simDescription.Teen && simDescription.IsFemale)
             {
                 builder.RemovePart(WolfFeetMaskChildUnisex);
             }
             if (simDescription.Teen && simDescription.IsMale)
             {
                 builder.RemovePart(WolfFeetMaskTeenMale);
             }
             if (simDescription.YoungAdult && simDescription.Adult && simDescription.IsMale)
             {
                 builder.RemovePart(WolfFeetMaskAdultMale);
             }
             if (simDescription.YoungAdult && simDescription.Adult && simDescription.IsFemale)
             {
                 builder.RemovePart(WolfFeetMaskAdultFemale);
             }
             if (simDescription.Elder && simDescription.IsFemale)
             {
                 builder.RemovePart(WolfFeetMaskElderFemale);
             }
             if (simDescription.Elder && simDescription.IsMale)
             {
                 builder.RemovePart(WolfFeetMaskElderMale);
             }
         }
         SimOutfit outfit = new SimOutfit(builder.CacheOutfit(simDescription.FullName + currentOutfitCategory.ToString() + currentOutfitIndex.ToString()));
         if (simDescription.GetOutfitCount(currentOutfitCategory) > currentOutfitIndex)
         {
             simDescription.RemoveOutfit(currentOutfitCategory, currentOutfitIndex, true);
         }
         simDescription.AddOutfit(outfit, currentOutfitCategory, currentOutfitIndex);
         if (simDescription.CreatedSim != null)
         {
             sendDebugMsg("Updated: " + currentOutfitCategory.ToString() + "-" + currentOutfitIndex.ToString());
             simDescription.CreatedSim.RefreshCurrentOutfit(false);
         }
         foreach (OutfitCategories categories2 in Enum.GetValues(typeof(OutfitCategories)))
         {
             if (categories2 != OutfitCategories.Special)
             {
                 ArrayList list = simDescription.GetCurrentOutfits()[categories2] as ArrayList;
                 if (list != null)
                 {
                     int count = list.Count;
                     for (int i = 0; i < count; i++)
                     {
                         if ((categories2 != currentOutfitCategory) || (i != currentOutfitIndex))
                         {
                             builder.Clear(false);
                             SimOutfit outfit3 = list[i] as SimOutfit;
                             OutfitUtils.SetOutfit(builder, outfit3, simDescription);
                             if (addRemove)
                             {
                                 simDescription.AddOutfit(currentOutfit, OutfitCategories.Naked);
                                 if (simDescription.Child)
                                 {
                                     builder.AddPart(WolfFeetMaskChildUnisex);
                                 }
                                 if (simDescription.Teen && simDescription.IsFemale)
                                 {
                                     builder.AddPart(WolfFeetMaskTeenFemale);
                                 }
                                 if (simDescription.Teen && simDescription.IsMale)
                                 {
                                     builder.AddPart(WolfFeetMaskTeenMale);
                                 }
                                 if (simDescription.Adult && simDescription.YoungAdult && simDescription.IsFemale)
                                 {
                                     builder.AddPart(WolfFeetMaskAdultFemale);
                                 }
                                 if (simDescription.Adult && simDescription.YoungAdult && simDescription.IsMale)
                                 {
                                     builder.AddPart(WolfFeetMaskAdultMale);
                                 }
                                 if (simDescription.Elder && simDescription.IsFemale)
                                 {
                                     builder.AddPart(WolfFeetMaskElderFemale);
                                 }
                                 if (simDescription.Elder && simDescription.IsMale)
                                 {
                                     builder.AddPart(WolfFeetMaskElderMale);
                                 }
                             }
                             else
                             {
                                 if (simDescription.Child)
                                 {
                                     builder.RemovePart(WolfFeetMaskChildUnisex);
                                 }
                                 if (simDescription.Teen && simDescription.IsFemale)
                                 {
                                     builder.RemovePart(WolfFeetMaskChildUnisex);
                                 }
                                 if (simDescription.Teen && simDescription.IsMale)
                                 {
                                     builder.RemovePart(WolfFeetMaskTeenMale);
                                 }
                                 if (simDescription.YoungAdult && simDescription.Adult && simDescription.IsMale)
                                 {
                                     builder.RemovePart(WolfFeetMaskAdultMale);
                                 }
                                 if (simDescription.YoungAdult && simDescription.Adult && simDescription.IsFemale)
                                 {
                                     builder.RemovePart(WolfFeetMaskAdultFemale);
                                 }
                                 if (simDescription.Elder && simDescription.IsFemale)
                                 {
                                     builder.RemovePart(WolfFeetMaskElderFemale);
                                 }
                                 if (simDescription.Elder && simDescription.IsMale)
                                 {
                                     builder.RemovePart(WolfFeetMaskElderMale);
                                 }
                             }
                             SimOutfit outfit4 = new SimOutfit(builder.CacheOutfit(simDescription.FullName + categories2.ToString() + i.ToString()));
                             if (simDescription.GetOutfitCount(categories2) > i)
                             {
                                 simDescription.RemoveOutfit(categories2, i, true);
                             }
                             simDescription.AddOutfit(outfit4, categories2, i);
                             sendDebugMsg("Updated: " + categories2.ToString() + "-" + i.ToString());
                             Sleep(0);
                         }
                     }
                 }
             }
         }
         SimOutfit outfit5 = simDescription.GetOutfit(OutfitCategories.Everyday, 0);
         if (outfit5 != null)
         {
             ThumbnailManager.GenerateHouseholdSimThumbnail(outfit5.Key, outfit5.Key.InstanceId, 0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, simDescription.AgeGenderSpecies);
         }
     }
     catch (Exception exception)
     {
         SimpleMessageDialog.Show("Werewolf Tweaker - Wolf Feet", sim.Name + "\nApply feet failed!\n" + exception);
     }
 }
コード例 #17
0
        protected static OptionResult ApplyOutfit(SimDescription sim, OutfitCategories category)
        {
            ResourceKey newOutfitKey = ResourceKey.kInvalidResourceKey;

            if (sim.IsMummy)
            {
                newOutfitKey = OccultMummy.CreateMummyUniform(sim.Age, sim.Gender).Key;
            }
            else if (sim.IsFrankenstein)
            {
                newOutfitKey = OccultBaseClass.CreateUniform(OccultFrankenstein.CreateUniformName(sim, sim.OccultManager.mIsLifetimeReward), sim.Age, ProductVersion.EP2, CASSkinTones.NoSkinTone, 0f).Key;
            }
            else if (sim.IsImaginaryFriend)
            {
                OccultImaginaryFriend friend = sim.OccultManager.GetOccultType(OccultTypes.ImaginaryFriend) as OccultImaginaryFriend;

                string name;
                newOutfitKey = OccultImaginaryFriend.CreateImaginaryFriendUniform(sim.Age, friend.Pattern, out name).Key;
            }
            else
            {
                SimOutfit source = null;
                if (sim.GetOutfitCount(OutfitCategories.Naked) > 0)
                {
                    source = sim.GetOutfit(OutfitCategories.Naked, 0);
                }
                else if (sim.GetOutfitCount(category) > 0)
                {
                    source = sim.GetOutfit(category, 0);
                }

                if (source != null)
                {
                    using (SimBuilder builder = new SimBuilder())
                    {
                        OutfitUtils.SetOutfit(builder, source, sim);

                        OutfitUtils.MakeCategoryAppropriate(builder, category, sim);

                        newOutfitKey = builder.CacheOutfit(CASParts.GetOutfitName(sim, category, sim.IsUsingMaternityOutfits));
                    }
                }
            }

            if (newOutfitKey == ResourceKey.kInvalidResourceKey)
            {
                return(OptionResult.Failure);
            }

            sim.AddOutfit(new SimOutfit(newOutfitKey), category, false);

            int index = sim.GetOutfitCount(category) - 1;

            ArrayList list = sim.GetCurrentOutfits()[category] as ArrayList;

            object a = list[0];
            object b = list[index];

            list[0]     = b;
            list[index] = a;

            return(OptionResult.SuccessClose);
        }
コード例 #18
0
        public static SimDescription DGSMakeSSimDescription(SimBuilder builder, CASAgeGenderFlags age, CASAgeGenderFlags gender, ResourceKey skinTone, float skinToneIndex, Color[] hairColors, WorldName homeWorld, uint outfitCategoriesToBuild, bool isAlien)
        {
            if (age == CASAgeGenderFlags.None)
            {
                return(null);
            }
            if (builder == null)
            {
                builder                = new SimBuilder();
                builder.Age            = age;
                builder.Gender         = gender;
                builder.Species        = CASAgeGenderFlags.Human;
                builder.SkinTone       = skinTone;
                builder.SkinToneIndex  = skinToneIndex;
                builder.TextureSize    = 1024u;
                builder.UseCompression = true;
            }
            if (hairColors.Length == 9)
            {
                Color[] array = new Color[10];
                hairColors.CopyTo(array, 0);
                array[9]   = hairColors[0];
                hairColors = array;
            }
            if (hairColors.Length != 10)
            {
                hairColors = Genetics.Black1;
            }
            Color[] array2 = new Color[4];
            Array.Copy(hairColors, 5, array2, 0, 4);
            Color activeEyebrowColor = hairColors[4];
            SimDescriptionCore simDescriptionCore = new SimDescriptionCore();

            simDescriptionCore.HomeWorld = homeWorld;
            bool useDyeColor = age == CASAgeGenderFlags.Elder;

            GeneticColor[] hairColors2 = simDescriptionCore.HairColors;
            for (int i = 0; i < 4; i++)
            {
                hairColors2[i].UseDyeColor = useDyeColor;
            }
            simDescriptionCore.HairColors                = hairColors2;
            simDescriptionCore.ActiveHairColors          = hairColors;
            simDescriptionCore.EyebrowColor.UseDyeColor  = useDyeColor;
            simDescriptionCore.ActiveEyebrowColor        = activeEyebrowColor;
            simDescriptionCore.BodyHairColor.UseDyeColor = useDyeColor;
            simDescriptionCore.ActiveBodyHairColor       = hairColors[9];
            GeneticColor[] facialHairColors = simDescriptionCore.FacialHairColors;
            for (int j = 0; j < 4; j++)
            {
                facialHairColors[j].UseDyeColor = useDyeColor;
            }
            simDescriptionCore.FacialHairColors       = facialHairColors;
            simDescriptionCore.ActiveFacialHairColors = array2;
            Dictionary <ResourceKey, float> dictionary = new Dictionary <ResourceKey, float>();

            if (LocaleConstraints.GetFacialShape(ref dictionary, homeWorld))
            {
                foreach (KeyValuePair <ResourceKey, float> keyValuePair in dictionary)
                {
                    builder.SetFacialBlend(keyValuePair.Key, keyValuePair.Value);
                }
            }
            OutfitUtils.AddMissingParts(builder, (OutfitCategories)2097154u, true, simDescriptionCore, isAlien);
            Genetics.SleepIfPossible();
            OutfitUtils.AddMissingParts(builder, OutfitCategories.Everyday, true, simDescriptionCore, isAlien);
            Genetics.SleepIfPossible();
            ResourceKey key = default(ResourceKey);

            if (LocaleConstraints.GetUniform(ref key, homeWorld, age, gender, OutfitCategories.Everyday))
            {
                OutfitUtils.SetOutfit(builder, new SimOutfit(key), simDescriptionCore);
            }
            OutfitUtils.SetAutomaticModifiers(builder);
            ResourceKey key2 = builder.CacheOutfit(string.Format("Genetics.MakeSim_{0}_{1}_{2}", builder.Age, Simulator.TicksElapsed(), OutfitCategories.Everyday));

            if (key2.InstanceId == 0UL)
            {
                return(null);
            }
            OutfitCategories[] array3 = new OutfitCategories[]
            {
                OutfitCategories.Naked,
                OutfitCategories.Athletic,
                OutfitCategories.Formalwear,
                OutfitCategories.Sleepwear,
                OutfitCategories.Swimwear
            };
            SimOutfit      simOutfit      = new SimOutfit(key2);
            SimDescription simDescription = new SimDescription(simOutfit);

            simDescription.HairColors       = simDescriptionCore.HairColors;
            simDescription.FacialHairColors = simDescriptionCore.FacialHairColors;
            simDescription.EyebrowColor     = simDescriptionCore.EyebrowColor;
            simDescription.BodyHairColor    = simDescriptionCore.BodyHairColor;
            simDescription.AddOutfit(simOutfit, OutfitCategories.Everyday, true);
            foreach (OutfitCategories outfitCategories in array3)
            {
                if ((outfitCategoriesToBuild & (uint)outfitCategories) != 0u)
                {
                    OutfitUtils.MakeCategoryAppropriate(builder, outfitCategories, simDescription);
                    if (LocaleConstraints.GetUniform(ref key, homeWorld, age, gender, outfitCategories))
                    {
                        OutfitUtils.SetOutfit(builder, new SimOutfit(key), simDescriptionCore);
                    }
                    ResourceKey key3 = builder.CacheOutfit(string.Format("Genetics.MakeSim_{0}_{1}_{2}", builder.Age, Simulator.TicksElapsed(), outfitCategories));
                    simDescription.AddOutfit(new SimOutfit(key3), outfitCategories);
                    Genetics.SleepIfPossible();
                }
            }
            simDescription.RandomizePreferences();
            TraitNames cultureSpecificTrait = Genetics.GetCultureSpecificTrait(homeWorld);

            if (cultureSpecificTrait == TraitNames.FutureSim)
            {
                simDescription.TraitManager.AddHiddenElement(cultureSpecificTrait);
                Skill skill = simDescription.SkillManager.AddElement(SkillNames.Future);
                if ((skill.AvailableAgeSpecies & simDescription.GetCASAGSAvailabilityFlags()) != CASAGSAvailabilityFlags.None)
                {
                    while (simDescription.SkillManager.GetSkillLevel(SkillNames.Future) < skill.MaxSkillLevel)
                    {
                        simDescription.SkillManager.ForceGainPointsForLevelUp(SkillNames.Future);
                    }
                }
            }
            else if (cultureSpecificTrait != TraitNames.Unknown)
            {
                simDescription.TraitManager.AddHiddenElement(cultureSpecificTrait);
            }
            builder.Dispose();
            builder = null;
            simDescription.HomeWorld = GameUtils.GetCurrentWorld();
            return(simDescription);
        }
コード例 #19
0
        private static SimDescription MakeAlien(CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName homeworld, float alienDNAPercentage, bool assignRandomTraits)
        {
            ResourceKey skinTone      = new ResourceKey(0xb93c88cd44494517, 55867754u, 0u);
            float       skinToneIndex = RandomUtil.GetFloat(1f);

            SimBuilder sb = new SimBuilder();

            sb.Age            = age;
            sb.Gender         = gender;
            sb.Species        = CASAgeGenderFlags.Human;
            sb.SkinTone       = skinTone;
            sb.SkinToneIndex  = skinToneIndex;
            sb.TextureSize    = 1024u;
            sb.UseCompression = true;
            ApplyAlienFaceBlend(gender, ref sb);
            float hue        = (skinToneIndex + 0.5f) % 1f;
            float saturation = age == CASAgeGenderFlags.Elder ? 0.25f : 0.75f;

            Color[]        colors           = new Color[] { HSLToRGB(hue, saturation, 0.5f) };
            SimDescription alienDescription = Genetics.MakeSim(sb, age, gender, skinTone, skinToneIndex, colors, homeworld, 4294967295u, true);

            if (alienDescription != null)
            {
                alienDescription.FirstName = SimUtils.GetRandomAlienGivenName(alienDescription.IsMale);
                alienDescription.LastName  = SimUtils.GetRandomAlienFamilyName();
                alienDescription.SetAlienDNAPercentage(alienDNAPercentage);
                alienDescription.VoicePitchModifier = RandomUtil.GetFloat(1.2f, 1.6f);
                alienDescription.VoiceVariation     = (VoiceVariationType)RandomUtil.GetInt(2);

                if (assignRandomTraits)
                {
                    Genetics.AssignRandomTraits(alienDescription);
                }

                if (alienDescription.TeenOrAbove)
                {
                    string s = "a";

                    if (age != CASAgeGenderFlags.Teen)
                    {
                        if (age == CASAgeGenderFlags.Elder)
                        {
                            s = "e";
                        }
                    }
                    else
                    {
                        s = "t";
                    }

                    string      s2     = alienDescription.IsFemale ? "f" : "m";
                    string      name   = s + s2 + "_alienOutfit";
                    ResourceKey key33  = ResourceKey.CreateOutfitKeyFromProductVersion(name, ProductVersion.EP8);
                    SimOutfit   outfit = OutfitUtils.CreateOutfitForSim(alienDescription, key33, OutfitCategories.Everyday, OutfitCategories.Everyday, false);

                    if (outfit != null)
                    {
                        alienDescription.AddOutfit(outfit, OutfitCategories.Everyday, true);
                    }

                    outfit = OutfitUtils.CreateOutfitForSim(alienDescription, key33, OutfitCategories.Formalwear, OutfitCategories.Formalwear, false);

                    if (outfit != null)
                    {
                        alienDescription.AddOutfit(outfit, OutfitCategories.Formalwear, true);
                    }

                    outfit = OutfitUtils.CreateOutfitForSim(alienDescription, key33, OutfitCategories.Outerwear, OutfitCategories.Outerwear, false);

                    if (outfit != null)
                    {
                        alienDescription.AddOutfit(outfit, OutfitCategories.Outerwear, true);
                    }
                }
            }

            return(alienDescription);
        }
コード例 #20
0
        public static void   FixInvisibleSim(SimDescription sim, bool force = false, bool reset = false)
        {
            try{
                OutfitCategories[] categoriesArray = null;
                switch (sim.Species)
                {
                case CASAgeGenderFlags.Human:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked,
                                                               OutfitCategories.Athletic,
                                                               OutfitCategories.Formalwear,
                                                               OutfitCategories.Sleepwear,
                                                               OutfitCategories.Swimwear };
                    break;

                case CASAgeGenderFlags.Horse:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked,
                                                               OutfitCategories.Racing,
                                                               OutfitCategories.Bridle,
                                                               OutfitCategories.Jumping };
                    break;

                default:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday,
                                                               OutfitCategories.Naked };
                    break;
                }
                bool necessary = force;
                if (!necessary)
                {
                    foreach (OutfitCategories category in categoriesArray)
                    {
                        if (sim.IsHuman)
                        {
                            if (category == OutfitCategories.Naked)
                            {
                                continue;
                            }
                        }
                        SimOutfit outfit2 = sim.GetOutfit(category, 0);
                        if ((outfit2 == null) || (!outfit2.IsValid))
                        {
                            necessary = true;
                        }
                    }
                }
                if (!necessary)
                {
                    return;
                }
                SimOutfit sourceOutfit = null;
                for (int i = 0; i < 2; i++)
                {
                    OutfitCategoryMap map = null;
                    if (i == 0)
                    {
                        map = sim.mOutfits;
                    }
                    else
                    {
                        map = sim.mMaternityOutfits;
                    }
                    if (map == null)
                    {
                        continue;
                    }
                    foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories)))
                    {
                        if (category == OutfitCategories.Supernatural)
                        {
                            continue;
                        }
                        ArrayList outfits = map[category] as ArrayList;
                        if (outfits == null)
                        {
                            continue;
                        }
                        foreach (SimOutfit anyOutfit in outfits)
                        {
                            if ((anyOutfit != null) && (anyOutfit.IsValid))
                            {
                                sourceOutfit = anyOutfit;
                                break;
                            }
                        }
                    }
                }
                SimBuilder builder = new SimBuilder();
                builder.UseCompression = true;
                var simTone = sim.SkinToneKey;
                List <ResourceKey> choiceTones = new List <ResourceKey>();
                KeySearch          tones       = new KeySearch(0x0354796a);
                foreach (ResourceKey tone in tones)
                {
                    choiceTones.Add(tone);
                }
                tones.Reset();
                if ((simTone.InstanceId == 0) || (!choiceTones.Contains(simTone)))
                {
                    simTone = RandomUtil.GetRandomObjectFromList(choiceTones);
                }
                ResourceKey newTone = simTone;

                builder.Age           = sim.Age;
                builder.Gender        = sim.Gender;
                builder.Species       = sim.Species;
                builder.SkinTone      = newTone;
                builder.SkinToneIndex = sim.SkinToneIndex;
                builder.MorphFat      = sim.mCurrentShape.Fat;
                builder.MorphFit      = sim.mCurrentShape.Fit;
                builder.MorphThin     = sim.mCurrentShape.Thin;
                GeneticsPet.SpeciesSpecificData speciesData = OutfitUtils.GetSpeciesSpecificData(sim);
                try{
                    if (sourceOutfit != null)
                    {
                        foreach (SimOutfit.BlendInfo blend in sourceOutfit.Blends)
                        {
                            builder.SetFacialBlend(blend.key, blend.amount);
                        }
                        CASParts.OutfitBuilder.CopyGeneticParts(builder, sourceOutfit);
                    }
                    else
                    {
                        if (sim.Genealogy != null)
                        {
                            List <SimDescription> parents      = new List <SimDescription>();
                            List <SimDescription> grandParents = new List <SimDescription>();
                            if (sim.Genealogy.Parents != null)
                            {
                                foreach (Genealogy gene in sim.Genealogy.Parents)
                                {
                                    SimDescription relative = gene.SimDescription;
                                    if (relative == null)
                                    {
                                        continue;
                                    }
                                    parents.Add(relative);
                                    if (relative.Genealogy != null)
                                    {
                                        if (relative.Genealogy.Parents != null)
                                        {
                                            foreach (Genealogy grandGene in relative.Genealogy.Parents)
                                            {
                                                var grandRelative = grandGene.SimDescription;
                                                if (grandRelative == null)
                                                {
                                                    continue;
                                                }
                                                grandParents.Add(grandRelative);
                                            }
                                        }
                                    }
                                }
                            }
                            if (parents.Count > 0)
                            {
                                if (sim.IsHuman)
                                {
                                    Genetics.InheritFacialBlends(builder, parents.ToArray(), new Random());
                                }
                                else
                                {
                                    GeneticsPet.InheritBodyShape(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritBasePeltLayer(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritPeltLayers(builder, parents, grandParents, new Random());
                                }
                            }
                        }
                    }
                }catch (Exception exception) {
                    Alive.WriteLog(exception.Message + "\n\n" +
                                   exception.StackTrace + "\n\n" +
                                   exception.Source);
                }
                if (sim.IsRobot)
                {
                    OutfitUtils.AddMissingPartsBots(builder, (OutfitCategories)0x200002, true, sim);
                    Sleep();
                    OutfitUtils.AddMissingPartsBots(builder, OutfitCategories.Everyday, true, sim);
                    Sleep();
                }
                else
                if (sim.IsHuman)
                {
                    OutfitUtils.AddMissingParts(builder, (OutfitCategories)0x200002, true, sim, sim.IsAlien);
                    Sleep();
                    OutfitUtils.AddMissingParts(builder, OutfitCategories.Everyday, true, sim, sim.IsAlien);
                    Sleep();
                }
                else
                {
                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday | (OutfitCategories)0x200000, true, sim, speciesData);
                    Sleep();
                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday, true, sim, speciesData);
                    Sleep();
                }
                ResourceKey uniformKey = new ResourceKey();
                if (sim.IsHuman)
                {
                    if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, OutfitCategories.Everyday))
                    {
                        OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                    }
                }
                OutfitUtils.SetAutomaticModifiers(builder);
                sim.ClearOutfits(OutfitCategories.Career, false);
                sim.ClearOutfits(OutfitCategories.MartialArts, false);
                sim.ClearOutfits(OutfitCategories.Special, false);
                foreach (OutfitCategories category in categoriesArray)
                {
                    ArrayList outfits = null;
                    if (!force)
                    {
                        outfits = sim.Outfits[category] as ArrayList;
                        if (outfits != null)
                        {
                            int index = 0;
                            while (index < outfits.Count)
                            {
                                SimOutfit anyOutfit = outfits[index] as SimOutfit;
                                if (anyOutfit == null)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else
                                if (!anyOutfit.IsValid)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else
                                {
                                    index++;
                                }
                            }
                        }
                    }

                    if ((outfits == null) || (outfits.Count == 0))
                    {
                        OutfitUtils.MakeCategoryAppropriate(builder, category, sim);
                        if (sim.IsHuman)
                        {
                            if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, category))
                            {
                                OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                            }
                        }
                        sim.RemoveOutfits(category, false);
                        CASParts.AddOutfit(sim, category, builder, true);
                    }
                    if (sim.IsUsingMaternityOutfits)
                    {
                        sim.BuildPregnantOutfit(category);
                    }
                }
                if (sim.IsMummy)
                {
                    OccultMummy
                    .OnMerge(sim);
                }
                else
                if (sim.IsFrankenstein)
                {
                    OccultFrankenstein
                    .OnMerge(sim, sim.OccultManager.mIsLifetimeReward);
                }
                else
                if (sim.IsGenie)
                {
                    OccultGenie
                    .OverlayUniform(sim, OccultGenie.CreateUniformName(sim.Age, sim.Gender), ProductVersion.EP6, OutfitCategories.Everyday, CASSkinTones.BlueSkinTone, 0.68f);
                }
                else
                if (sim.IsImaginaryFriend)
                {
                    OccultImaginaryFriend friend = sim.OccultManager.GetOccultType(Sims3.UI.Hud.OccultTypes.ImaginaryFriend) as OccultImaginaryFriend;
                    OccultBaseClass
                    .OverlayUniform(sim, OccultImaginaryFriend.CreateUniformName(sim.Age, friend.Pattern), ProductVersion.EP4, OutfitCategories.Special, CASSkinTones.NoSkinTone, 0f);
                }
                if (sim.IsMermaid)
                {
                    OccultMermaid
                    .AddOutfits(sim, null);
                }
                if (sim.IsWerewolf)
                {
                    if (sim.ChildOrAbove)
                    {
                        SimOutfit newWerewolfOutfit =
                            OccultWerewolf
                            .GetNewWerewolfOutfit(sim.Age, sim.Gender);
                        if (newWerewolfOutfit != null)
                        {
                            sim.AddOutfit(newWerewolfOutfit, OutfitCategories.Supernatural, 0x0);
                        }
                    }
                }
                SimOutfit currentOutfit = null;
                if (sim.CreatedSim != null)
                {
                    if (reset)
                    {
                        StuckSimData stuckSim;
                        if (!StuckSims.TryGetValue(sim.SimDescriptionId, out stuckSim))
                        {
                            stuckSim = new StuckSimData();
                            StuckSims.Add(sim.SimDescriptionId, stuckSim);
                        }
                        if (!stuckSim.Resetting)
                        {
                            stuckSim.Detections++;
                            Vector3 destination = Vector3.Invalid;
                            if (sim.CreatedSim.RoutingComponent != null)
                            {
                                sim.CreatedSim.RoutingComponent.GetDestination(out destination);
                            }
                            if (stuckSim.resetTask == null)
                            {
                                stuckSim.resetTask = new ResetStuckSimTask(sim.CreatedSim, destination, "Invisible");
                            }
                            else
                            {
                                stuckSim.resetTask.Renew();
                            }
                        }
                    }
                    try{
                        sim.CreatedSim.SwitchToOutfitWithoutSpin(Sim.ClothesChangeReason.GoingOutside, OutfitCategories.Everyday, true);
                    }catch (Exception exception) {
                        Alive.WriteLog(exception.Message + "\n\n" +
                                       exception.StackTrace + "\n\n" +
                                       exception.Source);
                    }
                    currentOutfit = sim.CreatedSim.CurrentOutfit;
                }
                else
                {
                    currentOutfit = sim.GetOutfit(OutfitCategories.Everyday, 0);
                }
                if (currentOutfit != null)
                {
                    ThumbnailManager.GenerateHouseholdSimThumbnail(currentOutfit.Key, currentOutfit.Key.InstanceId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, sim.AgeGenderSpecies);
                }
            }catch (Exception exception) {
                Alive.WriteLog(exception.Message + "\n\n" +
                               exception.StackTrace + "\n\n" +
                               exception.Source + "\n\n" +
                               "FixInvisibleSim");
            }finally{
            }
        }
コード例 #21
0
ファイル: OccultUnicornEx.cs プロジェクト: yakoder/NRaas
        public static void OnAddition(OccultUnicorn ths, SimDescription simDes, bool alterOutfit)
        {
            if (alterOutfit)
            {
                if (simDes.HorseManager == null)
                {
                    return;
                }

                Color[] maneColors = simDes.HorseManager.ActiveManeHairColors;
                simDes.HorseManager.ActiveUnicornBeardHairColors = maneColors;

                if (sParts == null)
                {
                    sParts = CASParts.GetParts(PartMatches);
                }

                List <CASParts.PartPreset> parts = new List <CASParts.PartPreset>();
                foreach (CASParts.Wrapper part in sParts)
                {
                    if (!part.ValidFor(simDes))
                    {
                        continue;
                    }

                    CASParts.PartPreset preset = part.GetRandomPreset();
                    if (preset == null)
                    {
                        continue;
                    }

                    parts.Add(preset);
                }

                if (parts.Count > 0)
                {
                    GeneticsPet.SpeciesSpecificData speciesData = new GeneticsPet.SpeciesSpecificData();
                    speciesData.UnicornBeardHairColors = simDes.HorseManager.ActiveUnicornBeardHairColors;

                    foreach (OutfitCategories category in simDes.ListOfCategories)
                    {
                        switch (category)
                        {
                        case OutfitCategories.All:
                        case OutfitCategories.CategoryMask:
                        case OutfitCategories.None:
                        case OutfitCategories.PrimaryCategories:
                        case OutfitCategories.PrimaryHorseCategories:
                        case OutfitCategories.Special:
                            continue;

                        default:
                            for (int i = 0x0; i < simDes.GetOutfitCount(category); i++)
                            {
                                using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(simDes, new CASParts.Key(category, i)))
                                {
                                    foreach (CASParts.PartPreset part in parts)
                                    {
                                        builder.Builder.RemoveParts(new BodyTypes[] { part.mPart.BodyType });
                                        builder.ApplyPartPreset(part);
                                        if (part.mPart.BodyType == BodyTypes.PetBeard)
                                        {
                                            OutfitUtils.AdjustPresetForHorseHairColor(builder.Builder, part.mPart, speciesData);
                                        }
                                    }
                                }
                            }
                            break;
                        }
                    }

                    if (simDes.CreatedSim != null)
                    {
                        simDes.CreatedSim.UpdateOutfitInfo();
                        simDes.CreatedSim.RefreshCurrentOutfit(false);
                    }
                }
            }
        }
コード例 #22
0
ファイル: FixInvisibleTask.cs プロジェクト: yakoder/NRaas
        public static Approach Perform(SimDescription sim, bool force, bool reset)
        {
            try
            {
                OutfitCategories[] categoriesArray = null;

                switch (sim.Species)
                {
                case CASAgeGenderFlags.Human:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday, OutfitCategories.Naked, OutfitCategories.Athletic, OutfitCategories.Formalwear, OutfitCategories.Sleepwear, OutfitCategories.Swimwear };
                    break;

                case CASAgeGenderFlags.Horse:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday, OutfitCategories.Naked, OutfitCategories.Racing, OutfitCategories.Bridle, OutfitCategories.Jumping };
                    break;

                default:
                    categoriesArray = new OutfitCategories[] { OutfitCategories.Everyday, OutfitCategories.Naked };
                    break;
                }

                bool necessary = force;

                if (!necessary)
                {
                    foreach (OutfitCategories category in categoriesArray)
                    {
                        if (sim.IsHuman)
                        {
                            if (category == OutfitCategories.Naked)
                            {
                                continue;
                            }
                        }

                        SimOutfit outfit2 = sim.GetOutfit(category, 0);
                        if ((outfit2 == null) || (!outfit2.IsValid))
                        {
                            necessary = true;
                        }
                    }
                }

                if (!necessary)
                {
                    return(Approach.None);
                }

                SimOutfit sourceOutfit = null;

                for (int i = 0; i < 2; i++)
                {
                    OutfitCategoryMap map = null;
                    if (i == 0)
                    {
                        map = sim.mOutfits;
                    }
                    else
                    {
                        map = sim.mMaternityOutfits;
                    }

                    if (map == null)
                    {
                        continue;
                    }

                    foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories)))
                    {
                        if (category == OutfitCategories.Supernatural)
                        {
                            continue;
                        }

                        ArrayList outfits = map[category] as ArrayList;
                        if (outfits == null)
                        {
                            continue;
                        }

                        foreach (SimOutfit anyOutfit in outfits)
                        {
                            if ((anyOutfit != null) && (anyOutfit.IsValid))
                            {
                                sourceOutfit = anyOutfit;
                                break;
                            }
                        }
                    }
                }

                SimBuilder builder = new SimBuilder();
                builder.UseCompression = true;

                ResourceKey newTone = ValidateSkinTone(sim.SkinToneKey);

                builder.Age           = sim.Age;
                builder.Gender        = sim.Gender;
                builder.Species       = sim.Species;
                builder.SkinTone      = newTone;
                builder.SkinToneIndex = sim.SkinToneIndex;
                builder.MorphFat      = sim.mCurrentShape.Fat;
                builder.MorphFit      = sim.mCurrentShape.Fit;
                builder.MorphThin     = sim.mCurrentShape.Thin;

                Approach approach = Approach.Rerolled;

                GeneticsPet.SpeciesSpecificData speciesData = OutfitUtils.GetSpeciesSpecificData(sim);

                try
                {
                    if (sourceOutfit != null)
                    {
                        foreach (SimOutfit.BlendInfo blend in sourceOutfit.Blends)
                        {
                            builder.SetFacialBlend(blend.key, blend.amount);
                        }

                        CASParts.OutfitBuilder.CopyGeneticParts(builder, sourceOutfit);

                        approach = Approach.Recovered;
                    }
                    else
                    {
                        if (sim.Genealogy != null)
                        {
                            List <SimDescription> parents      = new List <SimDescription>();
                            List <SimDescription> grandParents = new List <SimDescription>();

                            foreach (SimDescription parent in Relationships.GetParents(sim))
                            {
                                parents.Add(parent);

                                foreach (SimDescription grandParent in Relationships.GetParents(parent))
                                {
                                    grandParents.Add(grandParent);
                                }
                            }

                            if (parents.Count > 0)
                            {
                                if (sim.IsHuman)
                                {
                                    Genetics.InheritFacialBlends(builder, parents.ToArray(), new Random());
                                }
                                else
                                {
                                    GeneticsPet.InheritBodyShape(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritBasePeltLayer(builder, parents, grandParents, new Random());
                                    GeneticsPet.InheritPeltLayers(builder, parents, grandParents, new Random());
                                }

                                approach = Approach.Reinherited;
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(sim, null, "Primary Outfit Creation", e);
                    return(Approach.None);
                }

                if (sim.IsRobot)
                {
                    OutfitUtils.AddMissingPartsBots(builder, (OutfitCategories)0x200002, true, sim);

                    Common.Sleep();

                    OutfitUtils.AddMissingPartsBots(builder, OutfitCategories.Everyday, true, sim);

                    Common.Sleep();
                }
                else if (sim.IsHuman)
                {
                    OutfitUtils.AddMissingParts(builder, (OutfitCategories)0x200002, true, sim, sim.IsAlien);

                    Common.Sleep();

                    OutfitUtils.AddMissingParts(builder, OutfitCategories.Everyday, true, sim, sim.IsAlien);

                    Common.Sleep();
                }
                else
                {
                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday | (OutfitCategories)0x200000, true, sim, speciesData);

                    Common.Sleep();

                    OutfitUtils.AddMissingPartsPet(builder, OutfitCategories.Everyday, true, sim, speciesData);

                    Common.Sleep();
                }

                ResourceKey uniformKey = new ResourceKey();
                if (sim.IsHuman)
                {
                    if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, OutfitCategories.Everyday))
                    {
                        OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                    }
                }

                OutfitUtils.SetAutomaticModifiers(builder);

                sim.ClearOutfits(OutfitCategories.Career, false);
                sim.ClearOutfits(OutfitCategories.MartialArts, false);
                sim.ClearOutfits(OutfitCategories.Special, false);

                foreach (OutfitCategories category in categoriesArray)
                {
                    ArrayList outfits = null;

                    if (!force)
                    {
                        outfits = sim.Outfits[category] as ArrayList;
                        if (outfits != null)
                        {
                            int index = 0;
                            while (index < outfits.Count)
                            {
                                SimOutfit anyOutfit = outfits[index] as SimOutfit;
                                if (anyOutfit == null)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else if (!anyOutfit.IsValid)
                                {
                                    outfits.RemoveAt(index);
                                }
                                else
                                {
                                    index++;
                                }
                            }
                        }
                    }

                    if ((outfits == null) || (outfits.Count == 0))
                    {
                        OutfitUtils.MakeCategoryAppropriate(builder, category, sim);

                        if (sim.IsHuman)
                        {
                            if (LocaleConstraints.GetUniform(ref uniformKey, sim.HomeWorld, builder.Age, builder.Gender, category))
                            {
                                OutfitUtils.SetOutfit(builder, new SimOutfit(uniformKey), sim);
                            }
                        }

                        sim.RemoveOutfits(category, false);

                        CASParts.AddOutfit(sim, category, builder, true);
                    }

                    if (sim.IsUsingMaternityOutfits)
                    {
                        sim.BuildPregnantOutfit(category);
                    }
                }

                if (sim.IsMummy)
                {
                    OccultMummy.OnMerge(sim);
                }
                else if (sim.IsFrankenstein)
                {
                    OccultFrankenstein.OnMerge(sim, sim.OccultManager.mIsLifetimeReward);
                }
                else if (sim.IsGenie)
                {
                    OccultGenie.OverlayUniform(sim, OccultGenie.CreateUniformName(sim.Age, sim.Gender), ProductVersion.EP6, OutfitCategories.Everyday, CASSkinTones.BlueSkinTone, 0.68f);
                }
                else if (sim.IsImaginaryFriend)
                {
                    OccultImaginaryFriend friend = sim.OccultManager.GetOccultType(Sims3.UI.Hud.OccultTypes.ImaginaryFriend) as OccultImaginaryFriend;

                    OccultBaseClass.OverlayUniform(sim, OccultImaginaryFriend.CreateUniformName(sim.Age, friend.Pattern), ProductVersion.EP4, OutfitCategories.Special, CASSkinTones.NoSkinTone, 0f);
                }

                if (sim.IsMermaid)
                {
                    OccultMermaid.AddOutfits(sim, null);
                }


                if (sim.IsWerewolf)
                {
                    if (sim.ChildOrAbove)
                    {
                        SimOutfit newWerewolfOutfit = OccultWerewolf.GetNewWerewolfOutfit(sim.Age, sim.Gender);
                        if (newWerewolfOutfit != null)
                        {
                            sim.AddOutfit(newWerewolfOutfit, OutfitCategories.Supernatural, 0x0);
                        }
                    }
                }

                SimOutfit currentOutfit = null;
                if (sim.CreatedSim != null)
                {
                    if (reset)
                    {
                        ResetSimTask.Perform(sim.CreatedSim, false);
                    }

                    try
                    {
                        sim.CreatedSim.SwitchToOutfitWithoutSpin(Sim.ClothesChangeReason.GoingOutside, OutfitCategories.Everyday, true);
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(sim, e);
                    }

                    currentOutfit = sim.CreatedSim.CurrentOutfit;
                }
                else
                {
                    currentOutfit = sim.GetOutfit(OutfitCategories.Everyday, 0);
                }

                if (currentOutfit != null)
                {
                    ThumbnailManager.GenerateHouseholdSimThumbnail(currentOutfit.Key, currentOutfit.Key.InstanceId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, sim.AgeGenderSpecies);
                }

                return(approach);
            }
            catch (Exception e)
            {
                Common.Exception(sim, e);
                return(Approach.None);
            }
        }
コード例 #23
0
ファイル: FacialBlends.cs プロジェクト: pepoluan/NRaas
        public static bool CopyGenetics(SimDescriptionCore source, SimDescriptionCore destination, bool onlyNonZero, bool onlySliders)
        {
            SimOutfit sourceOutfit = CASParts.GetOutfit(source, CASParts.sPrimary, false);

            if (sourceOutfit == null)
            {
                return(false);
            }

            SimOutfit sourceWerewolfOutfit = CASParts.GetOutfit(source, new CASParts.Key(OutfitCategories.Supernatural, 0), false);

            SimDescription sourceDesc = source as SimDescription;
            SimDescription destDesc   = destination as SimDescription;

            if ((!onlySliders) && (!SimTypes.IsSkinJob(sourceDesc)) && (!SimTypes.IsSkinJob(destDesc)))
            {
                destDesc.SkinToneKey   = sourceDesc.SkinToneKey;
                destDesc.SkinToneIndex = sourceDesc.SkinToneIndex;
            }

            destDesc.SecondaryNormalMapWeights = sourceDesc.SecondaryNormalMapWeights.Clone() as float[];

            using (SimBuilder sourceBuilder = new SimBuilder())
            {
                OutfitUtils.SetOutfit(sourceBuilder, sourceOutfit, source);

                using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(destination, CASParts.sPrimary))
                {
                    if (!builder.OutfitValid)
                    {
                        return(false);
                    }

                    if ((!onlySliders) && (destDesc != null))
                    {
                        builder.Builder.SkinTone      = destDesc.SkinToneKey;
                        builder.Builder.SkinToneIndex = destDesc.SkinToneIndex;
                    }

                    foreach (FacialBlend blend in FaceBlends)
                    {
                        float amount = GetBlendAmount(sourceBuilder, blend);

                        if (onlyNonZero)
                        {
                            if (amount == 0.0)
                            {
                                continue;
                            }
                        }

                        SetBlendAmount(builder.Builder, blend, amount);
                    }

                    foreach (FacialBlend blend in FurBlends)
                    {
                        float amount = GetBlendAmount(sourceBuilder, blend);

                        if (onlyNonZero)
                        {
                            if (amount == 0.0)
                            {
                                continue;
                            }
                        }

                        SetBlendAmount(builder.Builder, blend, amount);
                    }

                    if (!onlySliders)
                    {
                        builder.CopyGeneticParts(sourceOutfit);
                    }
                }

                sourceBuilder.Clear();

                if ((sourceWerewolfOutfit != null) && (destDesc.IsWerewolf))
                {
                    OutfitUtils.SetOutfit(sourceBuilder, sourceWerewolfOutfit, source);

                    using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(destination, new CASParts.Key(OutfitCategories.Supernatural, 0)))
                    {
                        if ((!onlySliders) && (destDesc != null))
                        {
                            builder.Builder.SkinTone      = destDesc.SkinToneKey;
                            builder.Builder.SkinToneIndex = destDesc.SkinToneIndex;
                        }

                        foreach (FacialBlend blend in FaceBlends)
                        {
                            float amount = GetBlendAmount(sourceBuilder, blend);

                            if (onlyNonZero)
                            {
                                if (amount == 0.0)
                                {
                                    continue;
                                }
                            }

                            SetBlendAmount(builder.Builder, blend, amount);
                        }

                        builder.Components = CASLogic.sWerewolfPreserveComponents;
                    }
                }
            }

            return(true);
        }
コード例 #24
0
        public static void OnRemoval(OccultPlantSim ths, SimDescription simDes, bool alterOutfit)
        {
            Sim createdSim = simDes.CreatedSim;
            int index      = simDes.HasOutfit(OutfitCategories.Everyday, ths.mOccultOutfitKey);

            if (index >= 0x0)
            {
                simDes.RemoveOutfit(OutfitCategories.Everyday, index, true);
            }
            if (createdSim != null)
            {
                createdSim.Motives.RemoveMotive(CommodityKind.BePlantSim);
                createdSim.Motives.EnableMotive(CommodityKind.Bladder);
                createdSim.Motives.EnableMotive(CommodityKind.Hunger);
                createdSim.BuffManager.RemoveElement(BuffNames.PlantSimDehydrated);
                createdSim.BuffManager.RemoveElement(BuffNames.PlantSimHydrated);
                createdSim.TraitManager.RemoveElement(TraitNames.PlantSim);
                ActiveTopic.RemoveTopicFromSim(createdSim, "PlantSim Trait Topic");
                createdSim.Motives.UpdateMotives(1f, createdSim);
                (createdSim.RoutingComponent as SimRoutingComponent).RemoveOccultWalkingEffects(OccultTypes.PlantSim);
                ResourceKey skinToneKey = new ResourceKey(0xe8a7d5f0fec3d90bL, 0x354796a, 0x0);
                if (ths.mOldSkinToneKey != ResourceKey.kInvalidResourceKey)
                {
                    skinToneKey = ths.mOldSkinToneKey;
                }

                if (alterOutfit)
                {
                    simDes.SetSkinAndHairForAllOutfits(simDes.Age, skinToneKey, ths.mOldSkinIndex, ResourceKey.kInvalidResourceKey, true, ths.mOldHairColor);
                    simDes.RemoveBodyTypeFromAllOutfits(BodyTypes.BirthMark);
                    simDes.RemoveBodyTypeFromAllOutfits(BodyTypes.Beard);
                }

                HudModel hudModel = Responder.Instance.HudModel as HudModel;
                if ((hudModel != null) && (hudModel.GetSimInfo(createdSim.ObjectId) != null))
                {
                    if (alterOutfit)
                    {
                        SimBuilder builder = new SimBuilder();
                        builder.Clear();
                        SimOutfit outfit = simDes.GetOutfit(OutfitCategories.Everyday, 0x0);
                        OutfitUtils.SetOutfit(builder, outfit, null);
                        OutfitUtils.ExtractOutfitHairColor(simDes, builder);
                        ths.mOutfitIsReady = false;
                        createdSim.SwitchToOutfitDelayed(outfit, new CASUtils.SwapReadyCallback(ths.PlayConcealEffectAndSwapOutfit));
                        for (int i = 0x0; !ths.mOutfitIsReady && (i < 0xc350); i++)
                        {
                            Common.Sleep(0xa);
                        }
                        ths.SwapOutfit();
                    }

                    hudModel.OnSimAppearanceChanged(createdSim.ObjectId);
                    hudModel.NotifyNameChanged(createdSim.ObjectId);
                }
                else
                {
                    createdSim.SwitchToOutfitWithoutSpin(Sim.ClothesChangeReason.Force, createdSim.CurrentOutfitCategory, true);
                }

                createdSim.Motives.RemoveMotive(CommodityKind.BePlantSim);
                createdSim.Motives.EnableMotive(CommodityKind.Bladder);
                createdSim.Motives.EnableMotive(CommodityKind.Hunger);
                createdSim.BuffManager.RemoveElement(BuffNames.PlantSimDehydrated);
                createdSim.BuffManager.RemoveElement(BuffNames.PlantSimHydrated);
                createdSim.TraitManager.RemoveElement(TraitNames.PlantSim);
                ActiveTopic.RemoveTopicFromSim(createdSim, "PlantSim Trait Topic");
                hudModel.NotifyNameChanged(createdSim.ObjectId);
                createdSim.Motives.UpdateMotives(1f, createdSim);
            }
        }
コード例 #25
0
ファイル: Thirst.cs プロジェクト: ferferga/TS3VampireTweaker
 public static void MakeupManagement(Sim sim, bool addRemove)
 {
     try
     {
         SimBuilder       builder               = new SimBuilder();
         SimDescription   simDescription        = sim.SimDescription;
         OutfitCategories currentOutfitCategory = sim.CurrentOutfitCategory;
         int currentOutfitIndex = sim.CurrentOutfitIndex;
         builder.Clear(false);
         SimOutfit currentOutfit = sim.CurrentOutfit;
         OutfitUtils.SetOutfit(builder, currentOutfit, simDescription);
         if (addRemove)
         {
             sendDebugMsg(sim.FullName + "\nAdding eyes.");
             string designPreset = CASUtils.PartDataGetPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex));
             builder.AddPart(ThirstMask);
             if (sim.SimDescription.YoungAdultOrAbove)
             {
                 sim.BuffManager.AddElement(0xB110CC43B0C44B1C, (Origin)ResourceUtils.HashString64("ByAppearanceOfRedEyes"));
             }
             CASUtils.ApplyPresetToPart(builder, ThirstMask, designPreset);
             builder.SetPartPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex), designPreset);
         }
         else
         {
             builder.RemovePart(ThirstMask);
             sim.BuffManager.RemoveElement(0xB110CC43B0C44B1C);
         }
         SimOutfit outfit = new SimOutfit(builder.CacheOutfit(simDescription.FullName + currentOutfitCategory.ToString() + currentOutfitIndex.ToString()));
         if (simDescription.GetOutfitCount(currentOutfitCategory) > currentOutfitIndex)
         {
             simDescription.RemoveOutfit(currentOutfitCategory, currentOutfitIndex, true);
         }
         simDescription.AddOutfit(outfit, currentOutfitCategory, currentOutfitIndex);
         if (simDescription.CreatedSim != null)
         {
             sendDebugMsg("Updated: " + currentOutfitCategory.ToString() + "-" + currentOutfitIndex.ToString());
             simDescription.CreatedSim.RefreshCurrentOutfit(false);
         }
         foreach (OutfitCategories categories2 in Enum.GetValues(typeof(OutfitCategories)))
         {
             if (categories2 != OutfitCategories.Special)
             {
                 ArrayList list = simDescription.GetCurrentOutfits()[categories2] as ArrayList;
                 if (list != null)
                 {
                     int count = list.Count;
                     for (int i = 0; i < count; i++)
                     {
                         if ((categories2 != currentOutfitCategory) || (i != currentOutfitIndex))
                         {
                             builder.Clear(false);
                             SimOutfit outfit3 = list[i] as SimOutfit;
                             OutfitUtils.SetOutfit(builder, outfit3, simDescription);
                             if (addRemove)
                             {
                                 string str2 = CASUtils.PartDataGetPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex));
                                 builder.AddPart(ThirstMask);
                                 sim.BuffManager.AddElement(0xB110CC43B0C44B1C, (Origin)ResourceUtils.HashString64("ByAppearanceOfRedEyes"));
                                 CASUtils.ApplyPresetToPart(builder, ThirstMask, str2);
                                 builder.SetPartPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex), str2);
                             }
                             else
                             {
                                 builder.RemovePart(ThirstMask);
                                 sim.BuffManager.RemoveElement(0xB110CC43B0C44B1C);
                             }
                             SimOutfit outfit4 = new SimOutfit(builder.CacheOutfit(simDescription.FullName + categories2.ToString() + i.ToString()));
                             if (simDescription.GetOutfitCount(categories2) > i)
                             {
                                 simDescription.RemoveOutfit(categories2, i, true);
                             }
                             simDescription.AddOutfit(outfit4, categories2, i);
                             sendDebugMsg("Updated: " + categories2.ToString() + "-" + i.ToString());
                             Sleep(0);
                         }
                     }
                 }
             }
         }
         SimOutfit outfit5 = simDescription.GetOutfit(OutfitCategories.Everyday, 0);
         if (outfit5 != null)
         {
             ThumbnailManager.GenerateHouseholdSimThumbnail(outfit5.Key, outfit5.Key.InstanceId, 0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, simDescription.AgeGenderSpecies);
         }
     }
     catch (Exception exception)
     {
         SimpleMessageDialog.Show("Vampire Tweaker - Thirst Effect", sim.Name + "\nApply makeup failed!\n" + exception);
     }
 }
コード例 #26
0
        public static SimDescription MakeDescendant(SimDescription dad, SimDescription mom, SimDescription robotDad, SimDescription robotMom,
                                                    CASAgeGenderFlags age, CASAgeGenderFlags gender, float averageMood, Random pregoRandom, bool interactive, bool updateGenealogy,
                                                    bool setName, WorldName homeWorld, bool plantSimBaby, Pregnancy.BabyCustomizeData customizeData)
        {
            if (robotDad == null && robotMom == null)
            {
                Common.DebugNotify("CommonSurrogatePregnancy.MakeDescendant" + Common.NewLine + " - Fail: Robot Parnets Null");
                return(null);
            }

            SimBuilder simBuilder = new SimBuilder();

            simBuilder.Age            = age;
            simBuilder.Gender         = gender;
            simBuilder.Species        = CASAgeGenderFlags.Human;
            simBuilder.TextureSize    = 1024u;
            simBuilder.UseCompression = true;
            List <SimDescription> list = new List <SimDescription>();

            if (mom != null)
            {
                list.Add(mom);
            }

            if (dad != null)
            {
                list.Add(dad);
            }

            float alienDNAPercentage = SimDescription.GetAlienDNAPercentage(dad, mom, true);

            SimDescription[] array = list.ToArray();
            bool             flag  = alienDNAPercentage >= SimDescription.kMinAlienDNAPercentToBeAlien;

            if (plantSimBaby)
            {
                float skinToneIndex = OccultPlantSim.kBaseGreenSkinIndex + RandomUtil.GetFloat(1f - OccultPlantSim.kBaseGreenSkinIndex);
                simBuilder.SkinTone      = new ResourceKey(2751605866008866797uL, 55867754u, 0u);
                simBuilder.SkinToneIndex = skinToneIndex;
            }
            else
            {
                Genetics.InheritSkinColor(simBuilder, array, pregoRandom, homeWorld);
            }

            if (customizeData.IsBabyCustomized)
            {
                CASPart mPart = customizeData.EyeColorPreset.mPart;

                if (simBuilder.AddPart(mPart))
                {
                    string mPresetString = customizeData.EyeColorPreset.mPresetString;

                    if (!string.IsNullOrEmpty(mPresetString))
                    {
                        OutfitUtils.ApplyPresetStringToPart(simBuilder, mPart, mPresetString);
                    }
                }
            }
            else
            {
                Genetics.InheritEyeColor(simBuilder, array, pregoRandom);
            }

            Genetics.InheritFacialBlends(simBuilder, array, pregoRandom);
            ResourceKey geneticHairstyleKey = Genetics.InheritHairStyle(gender, dad, mom, pregoRandom, flag);

            Genetics.InheritBodyShape(simBuilder, array, pregoRandom);
            bool  flag2 = pregoRandom.Next(0, 2) == 0;
            float num   = (float)pregoRandom.NextDouble() * 100f;

            Color[] array2;

            if (customizeData.IsBabyCustomized)
            {
                array2 = new Color[10];

                for (int i = 0; i < 4; i++)
                {
                    array2[i]     = customizeData.HairColor[i];
                    array2[i + 5] = customizeData.HairColor[i];
                }

                array2[4] = customizeData.HairColor[0];
                array2[9] = customizeData.HairColor[0];
            }
            else if (age == CASAgeGenderFlags.Elder)
            {
                array2 = Genetics.GetRandomElderHairColor();
            }
            else
            {
                array2 = Genetics.InheritHairColor(simBuilder, array, pregoRandom);
            }

            SimDescription baby = Genetics.MakeSim(simBuilder, CASAgeGenderFlags.Baby, gender, simBuilder.SkinTone, simBuilder.SkinToneIndex, array2, homeWorld, 4294967295u, false);

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

            baby.SetAlienDNAPercentage(alienDNAPercentage);
            baby.GeneticHairstyleKey = geneticHairstyleKey;
            bool flag3 = false;

            if (num < Genetics.kInheritMomHiddenBodyHairStyleChance)
            {
                flag3 |= Genetics.InheritBodyHairstyle(baby, mom);
            }

            if (!flag3 || num < Genetics.kInheritDadBodyHairStyleChance + Genetics.kInheritMomHiddenBodyHairStyleChance)
            {
                Genetics.InheritBodyHairstyle(baby, dad);
            }

            if (customizeData.IsBabyCustomized)
            {
                Genetics.TraitOutcome traitOutcome = Genetics.AssignTraits(baby, dad, mom, false, averageMood, pregoRandom);
                List <TraitNames>     list2        = new List <TraitNames>();
                List <Trait>          list3        = new List <Trait>();

                foreach (Trait current in baby.TraitManager.List)
                {
                    if (!current.IsVisible)
                    {
                        list3.Add(current);
                    }
                }

                baby.TraitManager.RemoveAllElements();

                if (customizeData.CurrentTraits != null)
                {
                    foreach (ITraitEntryInfo current2 in customizeData.CurrentTraits)
                    {
                        baby.TraitManager.AddElement((TraitNames)current2.TraitGuid);
                    }

                    if (customizeData.CurrentTraits.Count != 2)
                    {
                        baby.TraitManager.AddRandomTrait(2 - customizeData.CurrentTraits.Count);
                    }

                    foreach (Trait current3 in list3)
                    {
                        baby.TraitManager.AddHiddenElement((TraitNames)current3.TraitGuid);
                    }
                }

                foreach (Trait current4 in baby.TraitManager.List)
                {
                    if (current4.IsVisible)
                    {
                        list2.Add((TraitNames)current4.TraitGuid);
                    }
                }

                if (interactive)
                {
                    bool   isFemale   = baby.IsFemale;
                    string titleText  = Localization.LocalizeString(baby.IsFemale, "Gameplay/CAS/Genetics:MakeBabyTitle", new object[0]);
                    string promptText = null;

                    switch (traitOutcome)
                    {
                    case Genetics.TraitOutcome.Horrible:
                    {
                        string entryKey = "Gameplay/CAS/Genetics:MakeBabyDescTwoTraitsHorrible";
                        promptText = Localization.LocalizeString(baby.IsFemale, entryKey, new object[]
                            {
                                robotMom == null ? mom : robotMom,
                                baby.TraitManager.GetElement((ulong)list2[0]).TraitName(baby.IsFemale),
                                baby.TraitManager.GetElement((ulong)list2[1]).TraitName(baby.IsFemale)
                            });
                        break;
                    }

                    case Genetics.TraitOutcome.Bad:
                    {
                        string entryKey = "Gameplay/CAS/Genetics:MakeBabyDescTwoTraitsBad";
                        promptText = Localization.LocalizeString(baby.IsFemale, entryKey, new object[]
                            {
                                robotMom == null ? mom : robotMom,
                                baby.TraitManager.GetElement((ulong)list2[0]).TraitName(baby.IsFemale),
                                baby.TraitManager.GetElement((ulong)list2[1]).TraitName(baby.IsFemale)
                            });
                        break;
                    }

                    case Genetics.TraitOutcome.Average:
                    {
                        string entryKey = "Gameplay/CAS/Genetics:MakeBabyDescTwoTraits";
                        promptText = Localization.LocalizeString(baby.IsFemale, entryKey, new object[]
                            {
                                robotMom == null ? mom : robotMom,
                                baby.TraitManager.GetElement((ulong)list2[0]).TraitName(baby.IsFemale),
                                baby.TraitManager.GetElement((ulong)list2[1]).TraitName(baby.IsFemale)
                            });
                        break;
                    }

                    case Genetics.TraitOutcome.Good:
                    {
                        string entryKey = "Gameplay/CAS/Genetics:MakeBabyDescOneTraits";
                        promptText = Localization.LocalizeString(baby.IsFemale, entryKey, new object[]
                            {
                                robotMom == null ? mom : robotMom,
                                baby.TraitManager.GetElement((ulong)list2[0]).TraitName(baby.IsFemale)
                            });
                        break;
                    }

                    case Genetics.TraitOutcome.Excellent:
                    {
                        string entryKey = "Gameplay/CAS/Genetics:MakeBabyDesc";
                        promptText = Localization.LocalizeString(baby.IsFemale, entryKey, new object[]
                            {
                                robotMom == null ? mom : robotMom,
                            });
                        break;
                    }
                    }

                    while (string.IsNullOrEmpty(baby.FirstName))
                    {
                        baby.FirstName = StringInputDialog.Show(titleText, promptText, "", CASBasics.GetMaxNameLength(), StringInputDialog.Validation.SimNameText);
                    }
                }
            }
            else
            {
                Genetics.AssignTraits(baby, dad, mom, interactive, averageMood, pregoRandom);
            }

            if (setName)
            {
                baby.LastName = array[0].LastName;

                if (!interactive)
                {
                    baby.FirstName = SimUtils.GetRandomGivenName(baby.IsMale, homeWorld);
                }
            }

            baby.CelebrityManager.SetBabyLevel(Genetics.AssignBabyCelebrityLevel(dad, mom));

            if (updateGenealogy)
            {
                if (robotDad != null && robotMom == null)
                {
                    if (robotDad.Genealogy != null)
                    {
                        robotDad.Genealogy.AddChild(baby.Genealogy);
                    }

                    if (mom != null && mom.Genealogy != null)
                    {
                        mom.Genealogy.AddChild(baby.Genealogy);
                    }
                }
                else if (robotMom != null && robotDad == null)
                {
                    if (robotMom.Genealogy != null)
                    {
                        robotMom.Genealogy.AddChild(baby.Genealogy);
                    }

                    if (dad != null && dad.Genealogy != null)
                    {
                        dad.Genealogy.AddChild(baby.Genealogy);
                    }
                }
                else
                {
                    if (robotDad.Genealogy != null)
                    {
                        robotDad.Genealogy.AddChild(baby.Genealogy);
                    }

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

            OccultTypes occultTypes = OccultTypes.None;

            if (flag2)
            {
                if (mom != null)
                {
                    CASSupernaturalData supernaturalData = mom.SupernaturalData;

                    if (supernaturalData != null)
                    {
                        occultTypes = supernaturalData.OccultType;
                    }
                }
            }
            else if (dad != null)
            {
                CASSupernaturalData supernaturalData2 = dad.SupernaturalData;

                if (supernaturalData2 != null)
                {
                    occultTypes = supernaturalData2.OccultType;
                }
            }

            if (plantSimBaby)
            {
                occultTypes = OccultTypes.PlantSim;
            }

            if (!OccultManager.DoesOccultTransferToOffspring(occultTypes))
            {
                occultTypes = OccultTypes.None;
            }

            if (RandomUtil.CoinFlip())
            {
                if (occultTypes == OccultTypes.Fairy)
                {
                    baby.AddSupernaturalData(OccultTypes.Fairy);
                    CASFairyData fairyData = baby.SupernaturalData as CASFairyData;

                    if (fairyData != null)
                    {
                        Vector3   wingColor;
                        WingTypes wingType;
                        Genetics.InheritWings(baby, mom, dad, pregoRandom, out wingColor, out wingType);
                        fairyData.WingType  = wingType;
                        fairyData.WingColor = wingColor;
                    }
                }

                if (occultTypes != OccultTypes.None)
                {
                    baby.OccultManager.AddOccultType(occultTypes, false, false, false);
                }
            }

            return(baby);
        }
コード例 #27
0
        public static SimDescription MakeAlien(CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName homeworld, float alienDNAPercentage, bool assignRandomTraits)
        {
            ResourceKey skinTone = AlienSkinTones[RandomUtil.GetInt(0, AlienSkinTones.Length - 1)];
            float       skinToneIndex;

            if (skinTone == AlienSkinTones[0])
            {
                skinToneIndex = 1f;
            }
            else if (skinTone == AlienSkinTones[1] || skinTone == AlienSkinTones[3] || skinTone == AlienSkinTones[4])
            {
                skinToneIndex = 0.25f + (0.5f * RandomUtil.GetFloat(1f));
            }
            else if (skinTone == AlienSkinTones[2])
            {
                skinToneIndex = 0.5f + (0.5f * RandomUtil.GetFloat(1f));
            }
            else
            {
                skinToneIndex = 0.25f + (0.75f * RandomUtil.GetFloat(1f));
            }

            SimBuilder sb = new SimBuilder();

            sb.Age            = age;
            sb.Gender         = gender;
            sb.Species        = CASAgeGenderFlags.Human;
            sb.SkinTone       = skinTone;
            sb.SkinToneIndex  = skinToneIndex;
            sb.TextureSize    = 1024u;
            sb.UseCompression = true;
            bool flag = (gender == CASAgeGenderFlags.Female);

            float num = flag ? Genetics.kAlienHeadWide[0] : Genetics.kAlienHeadWide[1];

            if (num != 0f)
            {
                ResourceKey key = new ResourceKey(ResourceUtils.HashString64("HeadWide"), 56144010u, 0u);
                sb.SetFacialBlend(key, num);
            }

            num = flag ? Genetics.kAlienJawChinSquare[0] : Genetics.kAlienJawChinSquare[1];

            if (num != 0f)
            {
                ResourceKey key2 = new ResourceKey(ResourceUtils.HashString64("JawChinSquare"), 56144010u, 0u);
                sb.SetFacialBlend(key2, num);
            }

            num = flag ? Genetics.kAlienNoseScaleDown[0] : Genetics.kAlienNoseScaleDown[1];

            if (num != 0f)
            {
                ResourceKey key3 = new ResourceKey(ResourceUtils.HashString64("NoseScaleDown"), 56144010u, 0u);
                sb.SetFacialBlend(key3, num);
            }

            num = flag ? Genetics.kAlienNoseDown[0] : Genetics.kAlienNoseDown[1];

            if (num != 0f)
            {
                ResourceKey key4 = new ResourceKey(ResourceUtils.HashString64("NoseDown"), 56144010u, 0u);
                sb.SetFacialBlend(key4, num);
            }

            num = flag ? Genetics.kAlienNoseThin[0] : Genetics.kAlienNoseThin[1];

            if (num != 0f)
            {
                ResourceKey key5 = new ResourceKey(ResourceUtils.HashString64("NoseThin"), 56144010u, 0u);
                sb.SetFacialBlend(key5, num);
            }

            num = flag ? Genetics.kAlienNoseBridgeRotate[0] : Genetics.kAlienNoseBridgeRotate[1];

            if (num != 0f)
            {
                ResourceKey key6 = new ResourceKey(ResourceUtils.HashString64("NoseBridgeRotate"), 56144010u, 0u);
                sb.SetFacialBlend(key6, num);
            }

            num = flag ? Genetics.kAlienNoseBridgeOut[0] : Genetics.kAlienNoseBridgeOut[1];

            if (num != 0f)
            {
                ResourceKey key7 = new ResourceKey(ResourceUtils.HashString64("NoseBridgeOut"), 56144010u, 0u);
                sb.SetFacialBlend(key7, num);
            }

            num = flag ? Genetics.kAlienNoseBridgeScaleUp[0] : Genetics.kAlienNoseBridgeScaleUp[1];

            if (num != 0f)
            {
                ResourceKey key8 = new ResourceKey(ResourceUtils.HashString64("NoseBridgeScaleUp"), 56144010u, 0u);
                sb.SetFacialBlend(key8, num);
            }

            num = flag ? Genetics.kAlienNoseNostrilsUp[0] : Genetics.kAlienNoseNostrilsUp[1];

            if (num != 0f)
            {
                ResourceKey key9 = new ResourceKey(ResourceUtils.HashString64("NoseNostrilsUp"), 56144010u, 0u);
                sb.SetFacialBlend(key9, num);
            }

            num = flag ? Genetics.kAlienNoseNostrilScale[0] : Genetics.kAlienNoseNostrilScale[1];

            if (num != 0f)
            {
                ResourceKey key10 = new ResourceKey(ResourceUtils.HashString64("NoseNostrilScale"), 56144010u, 0u);
                sb.SetFacialBlend(key10, num);
            }

            num = flag ? Genetics.kAlienNoseTipScaleDown[0] : Genetics.kAlienNoseTipScaleDown[1];

            if (num != 0f)
            {
                ResourceKey key11 = new ResourceKey(ResourceUtils.HashString64("NoseTipScaleDown"), 56144010u, 0u);
                sb.SetFacialBlend(key11, num);
            }

            num = flag ? Genetics.kAlienEyesBrowCurve[0] : Genetics.kAlienEyesBrowCurve[1];

            if (num != 0f)
            {
                ResourceKey key12 = new ResourceKey(ResourceUtils.HashString64("EyesBrowCurve"), 56144010u, 0u);
                sb.SetFacialBlend(key12, num);
            }

            num = flag ? Genetics.kAlienEyesBrowRotate[0] : Genetics.kAlienEyesBrowRotate[1];

            if (num != 0f)
            {
                ResourceKey key13 = new ResourceKey(ResourceUtils.HashString64("EyesBrowRotate"), 56144010u, 0u);
                sb.SetFacialBlend(key13, num);
            }

            num = flag ? Genetics.kAlienMouthLipUpperDefinition[0] : Genetics.kAlienMouthLipUpperDefinition[1];

            if (num != 0f)
            {
                ResourceKey key14 = new ResourceKey(ResourceUtils.HashString64("MouthLipUpperDefinition"), 56144010u, 0u);
                sb.SetFacialBlend(key14, num);
            }

            num = flag ? Genetics.kAlienMouthCurveDown[0] : Genetics.kAlienMouthCurveDown[1];

            if (num != 0f)
            {
                ResourceKey key15 = new ResourceKey(ResourceUtils.HashString64("MouthCurveDown"), 56144010u, 0u);
                sb.SetFacialBlend(key15, num);
            }

            num = flag ? Genetics.kAlienMouthIn[0] : Genetics.kAlienMouthIn[1];

            if (num != 0f)
            {
                ResourceKey key16 = new ResourceKey(ResourceUtils.HashString64("MouthIn"), 56144010u, 0u);
                sb.SetFacialBlend(key16, num);
            }

            num = flag ? Genetics.kAlienTranslateMouthDown[0] : Genetics.kAlienTranslateMouthDown[1];

            if (num != 0f)
            {
                ResourceKey key17 = new ResourceKey(ResourceUtils.HashString64("TranslateMouthDown"), 56144010u, 0u);
                sb.SetFacialBlend(key17, num);
            }

            num = flag ? Genetics.kAlienMouthThin[0] : Genetics.kAlienMouthThin[1];

            if (num != 0f)
            {
                ResourceKey key18 = new ResourceKey(ResourceUtils.HashString64("MouthThin"), 56144010u, 0u);
                sb.SetFacialBlend(key18, num);
            }

            num = flag ? Genetics.kAlienEyeAlienCorrector[0] : Genetics.kAlienEyeAlienCorrector[1];

            if (num != 0f)
            {
                ResourceKey key19 = new ResourceKey(ResourceUtils.HashString64("EyeAlienCorrector"), 56144010u, 0u);
                sb.SetFacialBlend(key19, num);
            }

            num = flag ? Genetics.kAlienEyeAlien[0] : Genetics.kAlienEyeAlien[1];

            if (num != 0f)
            {
                ResourceKey key20 = new ResourceKey(ResourceUtils.HashString64("EyeAlien"), 56144010u, 0u);
                sb.SetFacialBlend(key20, num);
            }

            num = flag ? Genetics.kAlienJawChinDown[0] : Genetics.kAlienJawChinDown[1];

            if (num != 0f)
            {
                ResourceKey key21 = new ResourceKey(ResourceUtils.HashString64("JawChinDown"), 56144010u, 0u);
                sb.SetFacialBlend(key21, num);
            }

            num = flag ? Genetics.kAlienJawChinScaleDown[0] : Genetics.kAlienJawChinScaleDown[1];

            if (num != 0f)
            {
                ResourceKey key22 = new ResourceKey(ResourceUtils.HashString64("JawChinScaleDown"), 56144010u, 0u);
                sb.SetFacialBlend(key22, num);
            }

            num = flag ? Genetics.kAlienJawThin[0] : Genetics.kAlienJawThin[1];

            if (num != 0f)
            {
                ResourceKey key23 = new ResourceKey(ResourceUtils.HashString64("JawThin"), 56144010u, 0u);
                sb.SetFacialBlend(key23, num);
            }

            num = flag ? Genetics.kAlienJawCheeksIn[0] : Genetics.kAlienJawCheeksIn[1];

            if (num != 0f)
            {
                ResourceKey key24 = new ResourceKey(ResourceUtils.HashString64("JawCheeksIn"), 56144010u, 0u);
                sb.SetFacialBlend(key24, num);
            }

            num = flag ? Genetics.kAlienJawCheekSharpness[0] : Genetics.kAlienJawCheekSharpness[1];

            if (num != 0f)
            {
                ResourceKey key25 = new ResourceKey(ResourceUtils.HashString64("JawCheekSharpness"), 56144010u, 0u);
                sb.SetFacialBlend(key25, num);
            }

            num = flag ? Genetics.kAlienEarsRotateY[0] : Genetics.kAlienEarsRotateY[1];

            if (num != 0f)
            {
                ResourceKey key26 = new ResourceKey(ResourceUtils.HashString64("EarsRotateY"), 56144010u, 0u);
                sb.SetFacialBlend(key26, num);
            }

            num = flag ? Genetics.kAlienEarPoint[0] : Genetics.kAlienEarPoint[1];

            if (num != 0f)
            {
                ResourceKey key27 = new ResourceKey(ResourceUtils.HashString64("EarPoint"), 56144010u, 0u);
                sb.SetFacialBlend(key27, num);
            }

            num = flag ? Genetics.kAlienHeadProfileOut[0] : Genetics.kAlienHeadProfileOut[1];

            if (num != 0f)
            {
                ResourceKey key28 = new ResourceKey(ResourceUtils.HashString64("HeadProfileOut"), 56144010u, 0u);
                sb.SetFacialBlend(key28, num);
            }

            num = flag ? Genetics.kAlienEyesLashesThin[0] : Genetics.kAlienEyesLashesThin[1];

            if (num != 0f)
            {
                ResourceKey key29 = new ResourceKey(ResourceUtils.HashString64("EyesLashesThin"), 56144010u, 0u);
                sb.SetFacialBlend(key29, num);
            }

            num = flag ? Genetics.kAlienJawCheeksBoneDown[0] : Genetics.kAlienJawCheeksBoneDown[1];

            if (num != 0f)
            {
                ResourceKey key30 = new ResourceKey(ResourceUtils.HashString64("JawCheeksBoneDown"), 56144010u, 0u);
                sb.SetFacialBlend(key30, num);
            }

            num = flag ? Genetics.kAlienJawChinRound[0] : Genetics.kAlienJawChinRound[1];

            if (num != 0f)
            {
                ResourceKey key31 = new ResourceKey(ResourceUtils.HashString64("JawChinRound"), 56144010u, 0u);
                sb.SetFacialBlend(key31, num);
            }

            num = flag ? Genetics.kAlienNoseTipDepthIn[0] : Genetics.kAlienNoseTipDepthIn[1];

            if (num != 0f)
            {
                ResourceKey key32 = new ResourceKey(ResourceUtils.HashString64("NoseTipDepthIn"), 56144010u, 0u);
                sb.SetFacialBlend(key32, num);
            }

            SimDescription alienDescription = Genetics.MakeSim(sb, age, gender, skinTone, skinToneIndex, AlienHairColors, homeworld, 4294967295u, true);

            if (alienDescription != null)
            {
                alienDescription.FirstName = SimUtils.GetRandomAlienGivenName(alienDescription.IsMale);
                alienDescription.LastName  = SimUtils.GetRandomAlienFamilyName();
                alienDescription.SetAlienDNAPercentage(alienDNAPercentage);
                alienDescription.VoicePitchModifier = RandomUtil.GetFloat(1.2f, 1.6f);
                alienDescription.VoiceVariation     = (VoiceVariationType)RandomUtil.GetInt(2);

                if (assignRandomTraits)
                {
                    Genetics.AssignRandomTraits(alienDescription);
                }

                if (alienDescription.TeenOrAbove)
                {
                    string s = "a";

                    if (age != CASAgeGenderFlags.Teen)
                    {
                        if (age == CASAgeGenderFlags.Elder)
                        {
                            s = "e";
                        }
                    }
                    else
                    {
                        s = "t";
                    }

                    string      s2     = alienDescription.IsFemale ? "f" : "m";
                    string      name   = s + s2 + "_alienOutfit";
                    ResourceKey key33  = ResourceKey.CreateOutfitKeyFromProductVersion(name, ProductVersion.EP8);
                    SimOutfit   outfit = OutfitUtils.CreateOutfitForSim(alienDescription, key33, OutfitCategories.Everyday, OutfitCategories.Everyday, false);

                    if (outfit != null)
                    {
                        alienDescription.AddOutfit(outfit, OutfitCategories.Everyday, true);
                    }

                    outfit = OutfitUtils.CreateOutfitForSim(alienDescription, key33, OutfitCategories.Formalwear, OutfitCategories.Formalwear, false);

                    if (outfit != null)
                    {
                        alienDescription.AddOutfit(outfit, OutfitCategories.Formalwear, true);
                    }

                    outfit = OutfitUtils.CreateOutfitForSim(alienDescription, key33, OutfitCategories.Outerwear, OutfitCategories.Outerwear, false);

                    if (outfit != null)
                    {
                        alienDescription.AddOutfit(outfit, OutfitCategories.Outerwear, true);
                    }
                }
            }

            return(alienDescription);
        }