Ejemplo n.º 1
0
        protected override void OnPerform()
        {
            try
            {
                if ((mCurrentOnly) && (mSim.CreatedSim != null))
                {
                    using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(mSim, new CASParts.Key(mSim.CreatedSim)))
                    {
                        builder.Builder.RemoveParts(mTypes);
                    }
                }
                else
                {
                    ProgressDialog.Show(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/Global:Processing", new object[0x0]), false);

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

                    foreach (SavedOutfit.Cache.Key outfit in cache.Outfits)
                    {
                        using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(mSim, outfit.mKey))
                        {
                            builder.Builder.RemoveParts(mTypes);
                        }
                    }
                }

                if (mSim.CreatedSim != null)
                {
                    SimOutfit currentOutfit = mSim.CreatedSim.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.AgeGenderSpecies);
                    }
                }

                if (mPostPerform != null)
                {
                    mPostPerform();
                }
            }
            finally
            {
                ProgressDialog.Close();
            }
        }
Ejemplo n.º 2
0
            public CrossWorldData(SimDescription sim)
            {
                mName = sim.FullName;

                mOutfitCache = new SavedOutfit.Cache(sim);

                SimOutfit outfit = sim.GetOutfit(OutfitCategories.Everyday, 0);

                if (outfit != null)
                {
                    mSkinToneKey   = outfit.SkinToneKey;
                    mSkinToneIndex = outfit.SkinToneIndex;
                }
                else
                {
                    mSkinToneKey   = sim.SkinToneKey;
                    mSkinToneIndex = sim.SkinToneIndex;
                }

                mMalePreference   = sim.mGenderPreferenceMale;
                mFemalePreference = sim.mGenderPreferenceFemale;

                if (sim.CreatedSim != null)
                {
                    if (sim.CreatedSim.mPreviousOutfitKey != null)
                    {
                        try
                        {
                            mPreviousOutfitCategory = sim.GetOutfitCategoryFromResKey(sim.CreatedSim.mPreviousOutfitKey, out mPreviousOutfitIndex);
                        }
                        catch
                        { }
                    }

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

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

                foreach (Trait trait in sim.TraitManager.List)
                {
                    if (trait.IsReward)
                    {
                        continue;
                    }

                    mTraits.Add(trait.Guid);
                }

                SocialNetworkingSkill networkSkill = sim.SkillManager.GetSkill <SocialNetworkingSkill>(SkillNames.SocialNetworking);

                if (networkSkill != null)
                {
                    // This value is set to mNumberOfBlogFollowers for some reason
                    mNumberOfFollowers = networkSkill.mNumberOfFollowers;

                    // Not transitioned at all
                    mBlogsCreated = networkSkill.mBlogsCreated;
                }

                RockBand bandSkill = sim.SkillManager.GetSkill <RockBand>(SkillNames.RockBand);

                if (bandSkill != null)
                {
                    mBandInfo = bandSkill.mBandInfo;
                }

                Collecting collecting = sim.SkillManager.GetSkill <Collecting>(SkillNames.Collecting);

                if (collecting != null)
                {
                    // Error in CollectingPropertyStreamWriter:Export() requires that mGlowBugData by transfered manually
                    //   Exported as two Int64, but Imported as a Int64 and Int32
                    mGlowBugData = collecting.mGlowBugData;

                    mMushroomsCollected = collecting.mMushroomsCollected;
                }

                NectarSkill nectar = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);

                if (nectar != null)
                {
                    mNectarHashesMade = nectar.mHashesMade;
                }

                Photography photography = sim.SkillManager.GetSkill <Photography>(SkillNames.Photography);

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

                RidingSkill riding = sim.SkillManager.GetSkill <RidingSkill>(SkillNames.Riding);

                if (riding != null)
                {
                    // Error in the Import (Copy/Paste fail by the looks of it), where the CrossCountry Wins are imported instead
                    mCrossCountryCompetitionsWon = new List <uint>(riding.mCrossCountryCompetitionsWon);
                    mJumpCompetitionsWon         = new List <uint>(riding.mJumpCompetitionsWon);
                }

                // EA hosed the color, glass and drink picks
                Bartending mixology = sim.SkillManager.GetSkill <Bartending>(SkillNames.Bartending);

                if (mixology != null)
                {
                    mCustomDrinks = mixology.mUniqueDrinks;
                }

                if ((sim.OccultManager != null) && (sim.OccultManager.mOccultList != null))
                {
                    mOccult = new List <OccultBaseClass>(sim.OccultManager.mOccultList);
                }
            }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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();
            }
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
        }