Esempio n. 1
0
        protected override bool Allow(GameHitParameters <Sim> parameters)
        {
            if (!parameters.mTarget.SimDescription.IsUsingMaternityOutfits)
            {
                return(false);
            }

            bool found = false;

            foreach (OutfitCategories category in LoadOutfit.sCategories)
            {
                if (CASParts.GetOutfit(parameters.mTarget.SimDescription, new CASParts.Key(Dresser.GetStoreOutfitKey(category, parameters.mTarget.SimDescription.IsUsingMaternityOutfits)), true) != null)
                {
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                return(false);
            }

            return(base.Allow(parameters));
        }
Esempio n. 2
0
        protected override void Perform(SimDescription sim, CASParts.Key outfitKey, CASParts.Key displayKey)
        {
            SimOutfit source = CASParts.GetOutfit(sim, outfitKey, false);

            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(Dresser.GetStoreOutfitKey(outfitKey.mCategory, sim.IsUsingMaternityOutfits)), source, true))
            { }
        }
Esempio n. 3
0
        protected override void Perform(SimDescription sim, CASParts.Key outfitKey, CASParts.Key displayKey)
        {
            SimOutfit geneOutfit = CASParts.GetOutfit(sim, CASParts.sPrimary, false);

            SimOutfit source = CASParts.GetOutfit(sim, outfitKey, true);

            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(displayKey.mCategory, sim), geneOutfit))
            {
                new SavedOutfit(source).Apply(builder, false, null, CASParts.GeneticBodyTypes);
            }
        }
Esempio n. 4
0
 public Item(CASParts.Key key, SimDescriptionCore sim)
     : this(key)
 {
     if (sim != null)
     {
         SimOutfit outfit = CASParts.GetOutfit(sim, key, false);
         if (outfit != null)
         {
             mThumbnail = new ThumbnailKey(outfit, 0x0, ThumbnailSize.Medium, ThumbnailCamera.Body);
         }
     }
 }
Esempio n. 5
0
        protected override bool Allow(GameHitParameters <Sim> parameters)
        {
            if (parameters.mTarget.SimDescription.IsUsingMaternityOutfits)
            {
                return(false);
            }

            if (CASParts.GetOutfit(parameters.mTarget.SimDescription, new CASParts.Key(Dresser.GetStoreOutfitKey(OutfitCategories.Career, parameters.mTarget.SimDescription.IsUsingMaternityOutfits)), true) == null)
            {
                return(false);
            }

            return(base.Allow(parameters));
        }
Esempio n. 6
0
        protected override bool Allow(SimDescription sim, ref CASParts.Key outfitKey, ref bool alternate, ref CASParts.Key displayKey)
        {
            displayKey = new CASParts.Key(sCategories[outfitKey.GetIndex()], 0);

            outfitKey = new CASParts.Key(Dresser.GetStoreOutfitKey(sCategories[outfitKey.GetIndex()], sim.IsUsingMaternityOutfits));
            alternate = true;

            if (CASParts.GetOutfit(sim, outfitKey, true) == null)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 7
0
            public Item(CASParts.Key outfitKey, bool alternate, SimDescription sim, CASParts.Key displayKey)
                : base(outfitKey, displayKey.GetLocalizedName(sim, false), 0)
            {
                mDisplayKey = displayKey;

                if (mValue.mCategory == OutfitCategories.None)
                {
                    SetThumbnail("shop_all_r2", ProductVersion.BaseGame);
                }
                else
                {
                    SimOutfit outfit = CASParts.GetOutfit(sim, mValue, alternate);
                    if (outfit != null)
                    {
                        mThumbnail = new ThumbnailKey(outfit, 0x0, ThumbnailSize.Medium, ThumbnailCamera.Body);
                    }
                }
            }
Esempio n. 8
0
        protected override OptionResult Run(GameHitParameters <Sim> parameters)
        {
            if (!AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":Prompt", parameters.mTarget.IsFemale, new object[] { parameters.mTarget })))
            {
                return(OptionResult.Failure);
            }

            SimDescription sim = parameters.mTarget.SimDescription;

            SimOutfit geneOutfit = CASParts.GetOutfit(sim, CASParts.sPrimary, false);

            foreach (OutfitCategories category in LoadOutfit.sCategories)
            {
                CASParts.Key outfitKey = new CASParts.Key(Dresser.GetStoreOutfitKey(category, sim.IsUsingMaternityOutfits));

                SimOutfit source = CASParts.GetOutfit(sim, outfitKey, true);
                if (source == null)
                {
                    continue;
                }

                int index = 0;
                if (category == OutfitCategories.Career)
                {
                    index = 1;
                }

                using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(category, index), geneOutfit))
                {
                    new SavedOutfit(source).Apply(builder, false, null, CASParts.GeneticBodyTypes);
                }

                if (category == OutfitCategories.Career)
                {
                    sim.CareerOutfitIndex = index;
                }
            }

            return(OptionResult.SuccessRetain);
        }
Esempio n. 9
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            List <ChangeOutfit.Item> allOptions = new List <ChangeOutfit.Item>();

            SavedOutfit.Cache cache = new SavedOutfit.Cache(me);
            foreach (SavedOutfit.Cache.Key outfit in cache.Outfits)
            {
                switch (outfit.Category)
                {
                case OutfitCategories.Everyday:
                case OutfitCategories.Formalwear:
                case OutfitCategories.Sleepwear:
                case OutfitCategories.Swimwear:
                case OutfitCategories.Athletic:
                case OutfitCategories.Career:
                case OutfitCategories.Outerwear:
                case OutfitCategories.MartialArts:
                    allOptions.Add(new ChangeOutfit.Item(outfit.mKey, me));
                    break;
                }
            }

            CommonSelection <ChangeOutfit.Item> .Results sourceList = new CommonSelection <ChangeOutfit.Item>(Name, allOptions).SelectMultiple();
            if ((sourceList == null) || (sourceList.Count == 0))
            {
                return(false);
            }

            List <CategoryItem> allCategories = new List <CategoryItem>();

            foreach (OutfitCategories category in Enum.GetValues(typeof(OutfitCategories)))
            {
                switch (category)
                {
                case OutfitCategories.Everyday:
                case OutfitCategories.Formalwear:
                case OutfitCategories.Sleepwear:
                case OutfitCategories.Swimwear:
                case OutfitCategories.Athletic:
                case OutfitCategories.Career:
                case OutfitCategories.Outerwear:
                case OutfitCategories.MartialArts:
                    allCategories.Add(new CategoryItem(category));
                    break;
                }
            }

            CommonSelection <CategoryItem> .Results destination = new CommonSelection <CategoryItem>(Name, allCategories).SelectMultiple();
            if ((destination == null) || (destination.Count == 0))
            {
                return(false);
            }

            foreach (ChangeOutfit.Item source in sourceList)
            {
                SimOutfit sourceOutfit = CASParts.GetOutfit(me, source.Value, false);

                foreach (CategoryItem item in destination)
                {
                    using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(me, new CASParts.Key(item.Value, -1), sourceOutfit))
                    { }

                    SpeedTrap.Sleep();
                }
            }

            if (me.CreatedSim != null)
            {
                me.CreatedSim.RefreshCurrentOutfit(false);
            }

            return(true);
        }
Esempio n. 10
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            List <CASParts.PartPreset> parts = new List <CASParts.PartPreset>();

            foreach (SimDescription parent in Relationships.GetParents(Sim))
            {
                SimOutfit outfit = CASParts.GetOutfit(parent, new CASParts.Key(OutfitCategories.Everyday, 0), false);

                foreach (CASPart part in outfit.Parts)
                {
                    if (CASParts.GeneticBodyTypes.Contains(part.BodyType))
                    {
                        CASAgeGenderFlags ages = part.Age;

                        if ((ages & Sim.Age) == CASAgeGenderFlags.None)
                        {
                            continue;
                        }

                        IncStat("Found: " + part.BodyType);

                        bool found = false;
                        foreach (CASAgeGenderFlags priorAge in sAges)
                        {
                            if (priorAge >= Sim.Age)
                            {
                                break;
                            }

                            if ((ages & priorAge) == priorAge)
                            {
                                found = true;
                                break;
                            }
                        }

                        // This part would have been inherited in an earlier age-up
                        if (found)
                        {
                            continue;
                        }

                        parts.Add(new CASParts.PartPreset(part, outfit));
                    }
                }
            }

            AddStat("Choices", parts.Count);

            bool adjusted = false;

            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(Sim, new CASParts.Key(OutfitCategories.Everyday, 0)))
            {
                foreach (CASParts.PartPreset part in parts)
                {
                    if (RandomUtil.RandomChance(GetValue <Option, int>()))
                    {
                        builder.ApplyPartPreset(part);
                        adjusted = true;

                        IncStat("Inherited: " + part.mPart.BodyType);
                    }
                }
            }

            if (adjusted)
            {
                SavedOutfit.Cache cache = new SavedOutfit.Cache(Sim);
                cache.PropagateGenetics(Sim, new CASParts.Key(OutfitCategories.Everyday, 0));
            }

            return(false);
        }
Esempio n. 11
0
        protected override void OnPerform()
        {
            try
            {
                ProgressDialog.Show(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/Global:Processing", new object[0x0]), false);

                SimOutfit sourceOutfit = CASParts.GetOutfit(mSim.SimDescription, mSourceKey, false);

                List <CASParts.PartPreset> presets = new List <CASParts.PartPreset>();

                foreach (CASPart part in sourceOutfit.Parts)
                {
                    if (!mTypes.Contains(part.BodyType))
                    {
                        continue;
                    }

                    presets.Add(CASParts.OutfitBuilder.GetPartPreset(part, sourceOutfit));
                }

                SavedOutfit.Cache cache = new SavedOutfit.Cache(mSim.SimDescription);

                foreach (SavedOutfit.Cache.Key outfit in cache.Outfits)
                {
                    if (outfit.Category == OutfitCategories.Special)
                    {
                        continue;
                    }

                    if ((mIgnore != null) && (mIgnore.Contains(outfit.Category)))
                    {
                        continue;
                    }

                    if (outfit.mKey == mSourceKey)
                    {
                        continue;
                    }

                    using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(mSim.SimDescription, outfit.mKey))
                    {
                        builder.Builder.RemoveParts(mTypes.ToArray());

                        foreach (CASParts.PartPreset preset in presets)
                        {
                            builder.ApplyPartPreset(preset);
                        }
                    }
                }

                SimOutfit currentOutfit = mSim.CurrentOutfit;
                if (currentOutfit != null)
                {
                    ThumbnailManager.GenerateHouseholdSimThumbnail(currentOutfit.Key, currentOutfit.Key.InstanceId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, mSim.SimDescription.AgeGenderSpecies);
                }
            }
            finally
            {
                ProgressDialog.Close();
            }
        }
Esempio n. 12
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            SimDescription newSim = null;

            using (SimFromBin <ManagerSim> bin = new SimFromBin <ManagerSim>(this, Sims))
            {
                CASAgeGenderFlags gender = Sim.Gender;

                switch (GetValue <GenderOption, BabyGenderScenario.FirstBornGender>())
                {
                case BabyGenderScenario.FirstBornGender.Male:
                    gender = CASAgeGenderFlags.Male;
                    break;

                case BabyGenderScenario.FirstBornGender.Female:
                    gender = CASAgeGenderFlags.Female;
                    break;
                }

                newSim = bin.CreateNewSim(Sim.Age, gender, CASAgeGenderFlags.Human);
                if (newSim == null)
                {
                    IncStat("Creation Fail");
                    return(false);
                }
            }

            bool genderChanged = (Sim.Gender != newSim.Gender);

            bool result = FacialBlends.CopyGenetics(newSim, Sim, false, false);

            Sim.VoiceVariation     = newSim.VoiceVariation;
            Sim.VoicePitchModifier = newSim.VoicePitchModifier;

            Sim.FirstName = newSim.FirstName;

            if (genderChanged)
            {
                Sim.Gender = newSim.Gender;

                SavedOutfit.Cache cache = new SavedOutfit.Cache(newSim);

                Dictionary <OutfitCategories, bool> replaced = new Dictionary <OutfitCategories, bool>();

                Sim.RemoveOutfits(OutfitCategories.Career, true);

                SimOutfit geneOutfit = CASParts.GetOutfit(Sim, CASParts.sPrimary, false);

                foreach (SavedOutfit.Cache.Key outfit in cache.Outfits)
                {
                    using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(Sim, outfit.mKey, geneOutfit))
                    {
                        builder.Builder.Gender = Sim.Gender;

                        outfit.Apply(builder, false, null, null);

                        if (!replaced.ContainsKey(outfit.Category))
                        {
                            replaced.Add(outfit.Category, true);

                            CASParts.RemoveOutfits(Sim, outfit.Category, false);
                        }
                    }
                }

                if (Sim.CreatedSim != null)
                {
                    Sim.CreatedSim.UpdateOutfitInfo();

                    Sim.CreatedSim.RefreshCurrentOutfit(true);

                    SwitchOutfits.SwitchNoSpin(Sim.CreatedSim, new CASParts.Key(OutfitCategories.Everyday, 0));
                }
            }
            else
            {
                new SavedOutfit.Cache(Sim).PropagateGenetics(Sim, CASParts.sPrimary);
            }

            if (newSim.OccultManager.CurrentOccultTypes != OccultTypes.None)
            {
                if (Instantiation.PerformOffLot(Sim, Household.ActiveHousehold.LotHome, null) != null)
                {
                    List <OccultTypes> occults = OccultTypeHelper.CreateList(newSim, true);

                    foreach (OccultTypes occult in occults)
                    {
                        switch (occult)
                        {
                        case OccultTypes.Frankenstein:
                            Sim.TraitManager.AddElement(TraitNames.Brave);
                            Sim.TraitManager.AddElement(TraitNames.Hydrophobic);
                            break;
                        }
                    }

                    Sims.ApplyOccultChance(this, Sim, occults, 100, int.MaxValue);
                }

                if (Sim.GetOutfitCount(OutfitCategories.Everyday) > 1)
                {
                    Sim.RemoveOutfit(OutfitCategories.Everyday, 1, true);
                }

                SimOutfit currentOutfit = Sim.GetOutfit(OutfitCategories.Everyday, 0);
                if (currentOutfit != null)
                {
                    try
                    {
                        ThumbnailManager.GenerateHouseholdSimThumbnail(currentOutfit.Key, currentOutfit.Key.InstanceId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, Sim.AgeGenderSpecies);
                    }
                    catch (Exception e)
                    {
                        Common.Exception(Sim, e);
                    }
                }
            }

            Deaths.CleansingKill(newSim, true);

            if (!result)
            {
                return(false);
            }

            if (Common.kDebugging)
            {
                Common.DebugNotify(GetTitlePrefix(PrefixType.Pure) + ": " + Sim.FullName, Sim.CreatedSim);
            }

            SpeedTrap.Sleep();

            return(true);
        }
Esempio n. 13
0
        protected override bool Run(SimDescription a, SimDescription b)
        {
            SavedOutfit.Cache cache = new SavedOutfit.Cache(a);

            if (!ApplyAll)
            {
                mAdd = false;

                List <ChangeOutfit.Item> allOptions = new List <ChangeOutfit.Item>();
                allOptions.Add(new ChangeOutfit.Item(new CASParts.Key(OutfitCategories.None, 0)));

                foreach (SavedOutfit.Cache.Key outfit in cache.Outfits)
                {
                    switch (outfit.Category)
                    {
                    case OutfitCategories.Everyday:
                    case OutfitCategories.Formalwear:
                    case OutfitCategories.Sleepwear:
                    case OutfitCategories.Swimwear:
                    case OutfitCategories.Athletic:
                    case OutfitCategories.Career:
                    case OutfitCategories.Outerwear:
                    case OutfitCategories.MartialArts:
                        allOptions.Add(new ChangeOutfit.Item(outfit.mKey, a));
                        break;
                    }
                }

                CommonSelection <ChangeOutfit.Item> .Results choices = new CommonSelection <ChangeOutfit.Item>(Name, allOptions).SelectMultiple();
                if ((choices == null) || (choices.Count == 0))
                {
                    return(false);
                }

                mTransfers.Clear();
                foreach (ChangeOutfit.Item choice in choices)
                {
                    if (choice.Category == OutfitCategories.None)
                    {
                        mTransfers.Clear();
                        break;
                    }

                    Dictionary <int, bool> indices;
                    if (!mTransfers.TryGetValue(choice.Category, out indices))
                    {
                        indices = new Dictionary <int, bool>();
                        mTransfers.Add(choice.Category, indices);
                    }

                    indices.Add(choice.Index, true);
                }

                if (TwoButtonDialog.Show(
                        Common.Localize(GetTitlePrefix() + ":Prompt", a.IsFemale, b.IsFemale, new object[] { a, b }),
                        Common.Localize(GetTitlePrefix() + ":Add"),
                        Common.Localize(GetTitlePrefix() + ":Replace")
                        ))
                {
                    mAdd = true;
                }
            }

            SimOutfit geneOutfit = CASParts.GetOutfit(b, CASParts.sPrimary, false);

            foreach (SavedOutfit.Cache.Key outfit in cache.Outfits)
            {
                bool transfer = false;
                if (mTransfers.Count == 0)
                {
                    transfer = true;
                }
                else
                {
                    Dictionary <int, bool> indices;
                    if (mTransfers.TryGetValue(outfit.Category, out indices))
                    {
                        if (indices.ContainsKey(outfit.Index))
                        {
                            transfer = true;
                        }
                    }
                }

                if (!transfer)
                {
                    continue;
                }

                int newIndex = -1;
                if (!mAdd)
                {
                    newIndex = outfit.Index;
                }

                using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(b, new CASParts.Key(outfit.Category, newIndex), geneOutfit))
                {
                    outfit.Apply(builder, false, sTypes, null);
                }
            }

            SpeedTrap.Sleep();

            if (b.CreatedSim != null)
            {
                b.CreatedSim.RefreshCurrentOutfit(false);
            }

            return(true);
        }