Пример #1
0
        public override void RequestAddCASPart(CASPart part, bool randomizeDesign)
        {
            if (MasterController.Settings.mAllowMultipleAccessories)
            {
                CASClothingCategory clothingCategory = CASClothingCategory.gSingleton;
                if (clothingCategory != null)
                {
                    if (clothingCategory.IsAccessoryType(part.BodyType))
                    {
                        CASLogic.GetSingleton().mRequestModelDirty = true;
                        CASLogic.CASOperationStack.Instance.Push(new AddCASPartOperationEx(part, randomizeDesign));
                        return;
                    }
                }
            }

            if (MasterController.Settings.mAllowMultipleMakeup)
            {
                CASMakeup makeup = CASMakeup.gSingleton;
                if (makeup != null)
                {
                    if (CASParts.IsMakeup(part.BodyType))
                    {
                        CASLogic.GetSingleton().mRequestModelDirty = true;
                        CASLogic.CASOperationStack.Instance.Push(new AddCASPartOperationEx(part, randomizeDesign));
                        return;
                    }
                }
            }

            base.RequestAddCASPart(part, randomizeDesign);
        }
Пример #2
0
        public override void Initialize()
        {
            CASLogic singleton = CASLogic.GetSingleton();

            if (((singleton.Age & mPart.Age) != CASAgeGenderFlags.None) && ((singleton.Gender & mPart.Gender) != CASAgeGenderFlags.None))
            {
                // Custom
                ReplacePart(singleton, mPart, mPreset);

                if (mRandomizeDesign)
                {
                    singleton.RandomizeDesign(mPart);
                }
                if (mBlend != null)
                {
                    if (mBlend is CompoundBlend)
                    {
                        base.AddStep(new CASLogic.TriggerCompoundBlendUpdateStep());
                    }

                    singleton.SetBlendAmount(mBlend, mBlendAmount, false);
                }
            }
            else
            {
                CASLogic.CASOperationStack.Instance.RequestUndo();
                CASLogic.CASOperationStack.Instance.RequestClearRedo();
            }
        }
Пример #3
0
        public BreedPickerDialog(CASAgeGenderFlags speciesFlag)
        {
            if (CASLogic.sBreedOutfitDict == null)
            {
                CASLogic.LoadPetBreedsXML();
            }
            mBreeds   = CASLogic.GetBreedOutfitList(speciesFlag);
            breedInfo = new List <ObjectListPickerInfo>();

            string emptyBreed = "";

            if (speciesFlag == CASAgeGenderFlags.Dog || speciesFlag == CASAgeGenderFlags.LittleDog)
            {
                emptyBreed = StringTable.GetLocalizedString("Ui/Caption/HUD/PetAdoptionInfoTooltip:DogNoBreed");
            }
            else
            {
                emptyBreed = StringTable.GetLocalizedString("Ui/Caption/HUD/PetAdoptionInfoTooltip:CatHorseNoBreed");
            }
            breedInfo.Add(new ObjectListPickerInfo(emptyBreed, new BreedOutfit("", "")));

            foreach (BreedOutfit b in mBreeds)
            {
                // Breed names ending in "Delta" display as, "Create a [Species]".
                // I think they are used in CAP.
                if (!b.BreedOutfitName.EndsWith("Delta"))
                {
                    ObjectListPickerInfo o = new ObjectListPickerInfo(StringTable.
                                                                      GetLocalizedString(b.BreedLocKey), b);
                    breedInfo.Add(o);
                }
            }
        }
Пример #4
0
        public static bool DisplayCAS(Sim simInCAS, Sim stylerSim, ref bool tookSemaphore, bool forceFailureOutfit)
        {
            if (!Responder.Instance.OptionsModel.SaveGameInProgress)
            {
                tookSemaphore = GameStates.WaitForInteractionStateChangeSemaphore(simInCAS, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                if (!tookSemaphore)
                {
                    return(false);
                }
                Sim sim = stylerSim ?? simInCAS;
                if (sim.Household == Household.ActiveHousehold)
                {
                    while ((Sims3.Gameplay.Gameflow.CurrentGameSpeed == Sims3.Gameplay.Gameflow.GameSpeed.Pause) || MoveDialog.InProgress())
                    {
                        SpeedTrap.Sleep();
                    }

                    StyledNotification notification = null;
                    if (stylerSim != null)
                    {
                        Stylist occupation = stylerSim.Occupation as Stylist;
                        if (occupation != null)
                        {
                            Stylist.Makeover currentJob = occupation.CurrentJob as Stylist.Makeover;
                            if ((currentJob != null) && (currentJob.MakeoverTarget == simInCAS))
                            {
                                string titleText = currentJob.JobTitle + ":" + Common.NewLine + Common.NewLine;
                                foreach (TaskInfo info in occupation.GetTaskNames().Values)
                                {
                                    titleText = titleText + "- " + info.TaskDescription + Common.NewLine;
                                }
                                StyledNotification.Format format = new StyledNotification.Format(titleText, StyledNotification.NotificationStyle.kGameMessagePositive);
                                notification = StyledNotification.Show(format);
                            }
                        }
                    }

                    new Sims.Stylist().Perform(new GameHitParameters <GameObject>(simInCAS, simInCAS, GameObjectHit.NoHit));

                    if (forceFailureOutfit)
                    {
                        CASLogic.GetSingleton().SetOverrideExitOutfit(OutfitCategories.Makeover, 0x0);
                    }

                    while (GameStates.NextInWorldStateId != InWorldState.SubState.LiveMode)
                    {
                        SpeedTrap.Sleep();
                    }

                    if (notification != null)
                    {
                        notification.CloseNow();
                    }

                    Styling.UpdateJobTrackerIfNecessary(simInCAS, stylerSim, forceFailureOutfit);
                    return(true);
                }
            }
            return(false);
        }
Пример #5
0
        public static void RequestRandomPart(bool hat)
        {
            List <CASParts.Wrapper> fullList = GetVisibleCASParts(CASLogic.GetSingleton(), BodyTypes.Hair);

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

            foreach (CASParts.Wrapper part in fullList)
            {
                if (hat != CASHair.PartIsHat(part.mPart))
                {
                    continue;
                }

                list.Add(part);
            }

            int count = list.Count;

            if (count > 0)
            {
                CASParts.Wrapper part = list[(int)(count * RandomGen.NextDouble())];

                Sims3.UI.Responder.Instance.CASModel.RequestAddCASPart(part.mPart, false);
            }
        }
Пример #6
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);
        }
Пример #7
0
        public override void Apply()
        {
            try
            {
                CASLogic logic = CASLogic.sSingleton;
                if ((logic.mSimDescEditExisting != null) && (logic.CASMode == CASMode.Mermaid))
                {
                    if (!(logic.mSimDescEditExisting.SupernaturalData is CASMermaidData))
                    {
                        logic.mSimDescEditExisting.mSupernaturalData = new CASMermaidData();
                    }
                }

                base.Apply();

                if (logic.CASMode == CASMode.Mermaid)
                {
                    CASBase.RecacheOutfits();
                }
                else
                {
                    CASBase.ApplyAllChanges();
                }
            }
            catch (Exception e)
            {
                Common.Exception("Apply", e);
            }
        }
Пример #8
0
            protected override bool OnPerform()
            {
                CASLogic logic = CASLogic.GetSingleton();

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

                CASClothingCategory category = CASClothingCategory.gSingleton;

                if (category == null)
                {
                    return(true);
                }

                if (category.mClothingTypesGrid == null)
                {
                    return(true);
                }

                if ((category.mClothingTypesGrid.Count > 0) || (!sPopulating))
                {
                    OnPopulate();
                }
                else
                {
                    category.mClothingTypesGrid.ItemRowsChanged -= OnPopulate;
                    category.mClothingTypesGrid.ItemRowsChanged += OnPopulate;
                }
                return(false);
            }
Пример #9
0
        public static bool IsWorn(CASPart part)
        {
            foreach (CASPart worn in CASLogic.GetSingleton().mBuilder.GetWornParts(new BodyTypes[] { part.BodyType }))
            {
                if (worn.Key == part.Key)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #10
0
 public override void Initialize()
 {
     try
     {
         mSimIndex = CASLogic.GetSingleton().PreviewSimIndex;
         AddStep(new UpdateCurrentSimStepEx(mbAllCategories));
         AddStep(new UpdateSingleThumbnailStepEx(mSimIndex));
     }
     catch (Exception e)
     {
         Common.Exception("Initialize", e);
     }
 }
Пример #11
0
        private static void HideUnusedIcons(CASHair ths)
        {
            List <Button> list = new List <Button>();
            int           num  = 0x0;
            int           num2 = 0x0;

            foreach (CASParts.Wrapper part in GetVisibleCASParts(CASLogic.GetSingleton(), BodyTypes.Hair))
            {
                if (CASHair.PartIsHat(part.mPart))
                {
                    num2++;
                }
                else
                {
                    num++;
                }
            }

            Button childByID = ths.GetChildByID(0x5dbb905, true) as Button;

            if (num > 0x0)
            {
                childByID.Visible = true;
                list.Add(childByID);
            }
            else
            {
                childByID.Visible = false;
            }

            childByID = ths.GetChildByID(0x5dbb906, true) as Button;
            if (num2 > 0x0)
            {
                childByID.Visible = true;
                list.Add(childByID);
            }
            else
            {
                childByID.Visible = false;
            }

            float count = list.Count;
            float num4  = (210f - ((count * 0.5f) * 42f)) - (((count - 1f) * 0.5f) * -2f);
            float num5  = num4;

            foreach (Button button2 in list)
            {
                button2.Position = new Vector2(num5, button2.Position.y);
                num5            += 40f;
            }
        }
Пример #12
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (base.PrivateUpdate(frame))
            {
                List <ISimDescription> sims = new List <ISimDescription>();

                Household house = null;

                foreach (SimDescription sim in Movers)
                {
                    house = sim.Household;

                    sims.Add(sim);
                }

                if (house != null)
                {
                    Vector2 fundsRange = GetValue <CashRangeOption, Vector2>();

                    int funds = (int)RandomUtil.GetFloat(fundsRange.x, fundsRange.y);
                    if (funds == 0)
                    {
                        if (house.FamilyFunds <= 0)
                        {
                            house.ModifyFamilyFunds(CASLogic.GetHouseholdStartingFunds(sims));
                        }
                    }
                    else
                    {
                        house.SetFamilyFunds(funds, false);
                    }

                    Options.StampImmigrantHousehold(house);
                }

                if (OnAfterMoveIn != null)
                {
                    OnAfterMoveIn(this, frame);
                }

                ManagerSim.ForceRecount();
                return(true);
            }

            foreach (SimDescription sim in Movers)
            {
                sim.Dispose();
            }

            return(false);
        }
Пример #13
0
        private static void ReplacePart(CASLogic ths, CASPart newPart, string preset)
        {
            List <CASPart> wornParts = ths.mBuilder.GetWornParts(new BodyTypes[] { newPart.BodyType });

            foreach (CASPart worn in wornParts)
            {
                if (newPart.Key == worn.Key)
                {
                    CASLogic.CASOperationStack.Instance.Active.AddStep(new CASLogic.ApplyPresetStringToPartStep(newPart, preset));
                    return;
                }
            }

            ths.RequestAddPart(newPart, preset);
        }
Пример #14
0
        private static void LoadParts(CASHair ths)
        {
            if (ths == null)
            {
                return;
            }

            ths.mPartsList.Clear();
            foreach (CASParts.Wrapper part in GetVisibleCASParts(CASLogic.GetSingleton(), BodyTypes.Hair))
            {
                if (ths.PartMatchesHairType(part.mPart))
                {
                    ths.mPartsList.Add(part.mPart);
                }
            }
        }
Пример #15
0
        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);
        }
Пример #16
0
        public override void Apply()
        {
            try
            {
                CASLogic logic = CASLogic.GetSingleton();

                Sims.CASBase.RemoveOutfits(logic.mCurrentSimData);

                if (mFirstTime)
                {
                    mFirstTime  = false;
                    mOldSimDesc = CASLogic.GetSingleton().CurrentSimDescription as SimDescription;
                }

                if (mNewSimDescKey != ResourceKey.kInvalidResourceKey)
                {
                    logic.LoadSim(mNewSimDescKey);
                }
                else if (mNewSimDesc != null)
                {
                    bool useTempSimDesc = logic.mUseTempSimDesc;

                    try
                    {
                        logic.mUseTempSimDesc = false;

                        logic.SetSimDescription(mNewSimDesc);
                    }
                    finally
                    {
                        logic.mUseTempSimDesc = useTempSimDesc;
                    }
                }

                Sims.CASBase.RemoveOutfits(logic.mCurrentSimData);
            }
            catch (Exception e)
            {
                Common.Exception("Apply", e);
            }
        }
Пример #17
0
            protected void OnPopulate()
            {
                if (sPopulating)
                {
                    return;
                }

                try
                {
                    sPopulating = true;

                    CASLogic logic = CASLogic.GetSingleton();
                    if (logic == null)
                    {
                        return;
                    }

                    CASClothingCategory category = CASClothingCategory.gSingleton;
                    if (category == null)
                    {
                        return;
                    }

                    if (category.mClothingTypesGrid == null)
                    {
                        return;
                    }

                    category.mClothingTypesGrid.ItemRowsChanged -= OnPopulate;

                    // Must be rerun now to load the parts without interference from CASModelProxy
                    category.LoadParts();

                    PopulateGrid();
                }
                finally
                {
                    sPopulating = false;
                }
            }
Пример #18
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;
        }
Пример #19
0
        /*
         * DebugString: "_NFixUp(): if (ListCollon.NullSimSimDescription == this)"
         * DebugString: "NMScript Exception Log
         * System.Exception: no message
         *
         #0: 0x0001f throw      in Sims3.Gameplay.CAS.Sims3.Gameplay.CAS.SimDescription:Fixup () ()
         #1: 0x00050 callvirt   in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.RecoverMissingSims:PrivatePerformAction (bool) (9193E9C0 [0] )
         #2: 0x00011 callvirt   in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.AlarmOption:PerformAction (bool) (9193E9C0 [0] )
         #3: 0x00002 call       in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.AlarmOption:PerformAlarm () ()
         #4: 0x0001b callvirt   in NRaas.NRaas.Overwatch:OnTimer () ()
         #5: 0x00000            in Sims3.Gameplay.Sims3.Gameplay.Function:Invoke () ()
         #6: 0x00003 callvirt   in NRaas.Common+FunctionTask:Simulate () ()
         */
        public void _NFixUp()
        {
            if (runI)
            {
                return;
            }

            if (ListCollon.NullSimSimDescription == this)
            {
                if (niec_native_func.cache_done_niecmod_native_debug_text_to_debugger)
                {
                    niec_native_func.OutputDebugString("_NFixUp(): if (ListCollon.NullSimSimDescription == this)");
                    try
                    {
                        throw new Exception("no message");
                    }
                    catch (Exception ex)
                    {
                        NiecException.SendTextExceptionToDebugger(ex);
                    }
                }

                mIsValidDescription = false;
                NFinalizeDeath.SimDesc_NullToEmpty(this);
                mIsValidDescription = true;

                if (UnsafeFixNUllSimDESC)
                {
                    var p = NFinalizeDeath.GetSafeSelectActor();
                    if (p != null && p.SimDescription != null)
                    {
                        mOutfits = p.SimDescription.Outfits;
                    }
                    if (!waitrunningtask01)
                    {
                        waitrunningtask01 = true;
                        NiecTask.Perform(() =>
                        {
                            for (int i = 0; i < 800; i++)
                            {
                                Simulator.Sleep(0);
                            }
                            waitrunningtask01 = false;
                            NFinalizeDeath.SimDescCleanse(this, true, false);
                        });
                    }
                }
                else if (!waitrunningtask01)
                {
                    waitrunningtask01 = true;
                    NiecTask.Perform(() =>
                    {
                        for (int i = 0; i < 50; i++)
                        {
                            Simulator.Sleep(0);
                        }
                        waitrunningtask01 = false;
                        NFinalizeDeath.SimDescCleanse(this, true, true);
                    });
                }
                return;
            }

            mIsValidDescription = true;

            if (base.TraitManager != null)
            {
                base.TraitManager.SetSimDescription(this);
                base.TraitManager.Fixup();
            }

            if (CreatedSim != null && CreatedSim.Inventory != null)
            {
                foreach (TraitChip item in CreatedSim.Inventory.FindAll <TraitChip>(false))
                {
                    item.OnLoadFixup();
                    if (item.Owner == null)
                    {
                        item.SetOwner(this);
                    }
                }
            }

            MiniSimDescription miniSimDescription = MiniSimDescription.Find(SimDescriptionId);

            if ((GameStates.IsTravelling || GameStates.IsEditingOtherTown) && miniSimDescription != null)
            {
                base.CASGenealogy = miniSimDescription.Genealogy;
            }

            if (GameObjectRelationships != null)
            {
                int i = 0;
                while (i < GameObjectRelationships.Count)
                {
                    if (!Sims3.SimIFace.Objects.IsValid(GameObjectRelationships[i].GameObjectDescription.GameObject.ObjectId))
                    {
                        GameObjectRelationships.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }
            }

            if (mGenealogy == null)
            {
                mGenealogy = new Genealogy(this);
            }

            if (SkillManager == null)
            {
                SkillManager = new SkillManager(this);
            }
            else
            {
                SkillManager.OnLoadFixup();
            }

            if (CareerManager == null)
            {
                CareerManager = new CareerManager(this);
            }
            else
            {
                CareerManager.OnLoadFixup();
            }

            if (VisaManager == null)
            {
                VisaManager = new VisaManager(this);
            }
            else
            {
                VisaManager.OnLoadFixup();
            }

            if (CelebrityManager == null)
            {
                CelebrityManager = new CelebrityManager(SimDescriptionId);
            }
            else if (CelebrityManager.Owner == null)
            {
                CelebrityManager.ResetOwnerSimDescription(SimDescriptionId);
            }

            if (LifeEventManager == null || !LifeEventManager.IsValid)
            {
                LifeEventManager = new LifeEventManager(this);
            }

            LifeEventManager.ClearInvalidActiveNodes();

            if (OccultManager == null)
            {
                OccultManager = new OccultManager(this);
            }
            else
            {
                OccultManager.OnLoadFixup();
            }

            if (IsPet)
            {
                if (PetManager == null)
                {
                    PetManager = CreatePetManager();
                }
            }
            else if (PetManager != null)
            {
                PetManager.Dispose();
                PetManager = null;
            }

            if (IsEP11Bot)
            {
                if (TraitChipManager == null)
                {
                    TraitChipManager = new TraitChipManager(this);
                }
                else if (TraitChipManager.Owner == null)
                {
                    TraitChipManager.ResetOwnerSimDescription(SimDescriptionId);
                }
                TraitChipManager.OnLoadFixup();
            }
            else if (TraitChipManager != null)
            {
                TraitChipManager.Dispose();
                TraitChipManager = null;
            }

            AssignSchool();

            if (mSimDescriptionId == 0)
            {
                MakeUniqueId();
            }

            if (ReadBookDataList == null)
            {
                ReadBookDataList = new Dictionary <string, ReadBookData>();
            }

            PushAgingEnabledToAgingManager();

            if (mInitialShape.Owner == null || mCurrentShape.Owner == null || mInitialShape.Owner != this || mCurrentShape.Owner != this)
            {
                mInitialShape.Owner = (mCurrentShape.Owner = this);
            }

            if (OpportunityHistory == null)
            {
                OpportunityHistory = new OpportunityHistory();
            }

            if (Sims3.Gameplay.Gameflow.sGameLoadedFromWorldFile && !Household.IsTravelImport && !GameStates.IsIdTravelling(SimDescriptionId))
            {
                mDisplayedShape.Owner    = mCurrentShape.Owner;
                mDisplayedShape.Fit      = mCurrentShape.Fit;
                mDisplayedShape.Weight   = mCurrentShape.Weight;
                mDisplayedShape.Pregnant = mCurrentShape.Pregnant;
                ResetLifetimeHappinessStatistics();
                mHomeWorld = GameUtils.GetCurrentWorld();
            }

            if (mHomeWorld == WorldName.Undefined)
            {
                mHomeWorld = GameUtils.GetCurrentWorld();
            }

            if (RelicStats == null)
            {
                RelicStats = new RelicStatTracking(this);
            }

            RelicStats.SetSimDescription(this);

            if (TombStats == null)
            {
                TombStats = new TombStatTracking(this);
            }

            TombStats.SetSimDescription(this);

            if (Singing == null)
            {
                Singing = new SingingInfo(this);
            }

            Singing.SetSimDesctiption(this);

            if (AssignedRole != null)
            {
                AssignedRole.OnLoadFixUp();
            }

            Lot lot = LotManager.GetLot(mVirtualLotId);

            if (lot != null)
            {
                lot.VirtualMoveIn(this);
            }

            if (Species == CASAgeGenderFlags.None)
            {
                Species = CASAgeGenderFlags.Human;
            }

            if (!CASLogic.GetSingleton().IsMusicTypeInstalled(FavoriteMusic))
            {
                RandomizeFavoriteMusic();
            }

            if (GetCurrentOutfits() != null)
            {
                OutfitCategories[] array = new OutfitCategories[5]
                {
                    OutfitCategories.None,
                    OutfitCategories.All,
                    OutfitCategories.CategoryMask,
                    OutfitCategories.PrimaryCategories,
                    OutfitCategories.PrimaryHorseCategories
                };

                foreach (var outfitCategories in array)
                {
                    if (GetOutfitCount(outfitCategories) > 0)
                    {
                        RemoveOutfits(outfitCategories, false);
                        if (base.mMaternityOutfits != null)
                        {
                            base.mMaternityOutfits.Remove(outfitCategories);
                        }
                        if (base.mOutfits != null)
                        {
                            base.mOutfits.Remove(outfitCategories);
                        }
                    }
                }
            }

            if (!GameUtils.IsInstalled(ProductVersion.EP4))
            {
                Sim.PlayPretend.RemoveAllChildCostumeOutfits(this);

                if (CreatedSim != null && CreatedSim.CurrentOutfitCategory == OutfitCategories.ChildImagination)
                {
                    CreatedSim.SwitchToOutfitWithoutSpin(OutfitCategories.Everyday);
                }

                RemoveOutfits(OutfitCategories.ChildImagination, true);

                base.Outfits.Remove(OutfitCategories.ChildImagination);

                if (SpoiledGiftHistory != null)
                {
                    SpoiledGiftHistory.Clear();
                    SpoiledGiftHistory = null;
                }
            }

            if (CreatedSim != null && (OccultManager == null || !OccultManager.HasOccultType(OccultTypes.Vampire | OccultTypes.Genie | OccultTypes.Werewolf | OccultTypes.Ghost)) && mSkinToneKey.InstanceId == 15475186560318337848uL)
            {
                World.ObjectSetVisualOverride(CreatedSim.ObjectId, eVisualOverrideTypes.Genie, null);
            }
        }
Пример #20
0
            // Methods
            public override bool Run()
            {
                if (!IntroTutorial.IsRunning || IntroTutorial.AreYouExitingTutorial())
                {
                    if (!RouteAndAnimate(this, base.Actor))
                    {
                        return(false);
                    }

                    if (Sims3.Gameplay.UI.Responder.Instance.OptionsModel.SaveGameInProgress)
                    {
                        base.BeginCommodityUpdates();
                        base.EndCommodityUpdates(true);
                        return(true);
                    }
                    this.mTookSemaphore = GameStates.WaitForInteractionStateChangeSemaphore(base.Actor, ~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                    if (!this.mTookSemaphore)
                    {
                        base.StandardExit();
                        return(false);
                    }
                    //  if (base.Actor.IsSelectable)
                    {
                        while ((Sims3.Gameplay.Gameflow.CurrentGameSpeed == Sims3.Gameplay.Gameflow.GameSpeed.Pause) || MoveDialog.InProgress())
                        {
                            Simulator.Sleep(0);
                        }
                        base.BeginCommodityUpdates();
                        SimDescription simDescription = base.Actor.SimDescription;
                        if (simDescription == null)
                        {
                            throw new Exception("ChangeOutfit:  sim doesn't have a description!");
                        }
                        CASChangeReporter.Instance.ClearChanges();
                        GameStates.TransitionToCASDresserMode();
                        CASLogic singleton = CASLogic.GetSingleton();
                        bool     flag2     = false;

                        try
                        {
                            singleton.LoadSim(simDescription, base.Actor.CurrentOutfitCategory, 0);
                            while (GameStates.NextInWorldStateId != InWorldState.SubState.LiveMode)
                            {
                                Simulator.Sleep(0);
                            }
                            CASChangeReporter.Instance.SendChangedEvents(base.Actor);
                            CASChangeReporter.Instance.ClearChanges();
                            EventTracker.SendEvent(EventTypeId.kPlannedOutfit, base.Actor, base.Target);
                            flag2 = true;
                            base.Actor.InteractionQueue.CancelAllInteractionsByType(Dresser.ChangeClothes.Singleton);
                        }
                        finally
                        {
                        }
                        base.EndCommodityUpdates(flag2);
                        if (base.Actor.CurrentOutfitIndex > simDescription.GetOutfitCount(base.Actor.CurrentOutfitCategory))
                        {
                            base.Actor.UpdateOutfitInfo();
                        }
                        base.Actor.RecreateOccupationOutfits();
                        (Sims3.Gameplay.UI.Responder.Instance.HudModel as HudModel).NotifySimChanged(base.Actor.ObjectId);

                        //Animate View object, and handle the purchases
                        this.AcquireStateMachine("viewobjectinteraction");
                        this.SetActor("x", Actor);
                        this.EnterSim("Enter");
                        this.AnimateSim("1");

                        logic_ClosingDown(this.Actor);

                        return(flag2);
                    }
                }

                return(false);
            }
Пример #21
0
 protected static List <CASParts.Wrapper> GetVisibleCASParts(CASLogic ths, BodyTypes bodyType)
 {
     return(GetVisibleCASParts(ths, bodyType, ths.GetForgivingCategoryMask(ths.mCurrentOutfitCategory)));
 }
Пример #22
0
        public override bool Run()
        {
            try
            {
                RobotForms form;
                if (SelectedObjects == null)
                {
                    return(false);
                }

                List <Sim> selectedObjectsAsSims = GetSelectedObjectsAsSims();
                if (selectedObjectsAsSims.Count == 0x0)
                {
                    return(false);
                }

                Sim actor = selectedObjectsAsSims[0x0];
                if (actor == null)
                {
                    return(false);
                }

                LinkedInteractionInstance = new BotMakingStation.CustomizeServobotB.Definition(Actor).CreateInstance(Target, actor, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), Autonomous, CancellableByPlayer);
                if (!actor.InteractionQueue.AddNext(LinkedInteractionInstance))
                {
                    return(false);
                }

                Actor.SynchronizationRole   = Sim.SyncRole.Initiator;
                Actor.SynchronizationLevel  = Sim.SyncLevel.Started;
                Actor.SynchronizationTarget = actor;
                if (!(Actor.SkillManager.GetElement(SkillNames.BotBuilding) is BotBuildingSkill))
                {
                    Actor.SkillManager.AddElement(SkillNames.BotBuilding);
                    BotBuildingSkill element = Actor.SkillManager.GetElement(SkillNames.BotBuilding) as BotBuildingSkill;
                }

                if (!Actor.RouteToSlotAndCheckInUse(Target, BotMakingStation.kOperatorRoutingSlot))
                {
                    return(false);
                }

                Actor.LoopIdle();
                Actor.SynchronizationLevel = Sim.SyncLevel.Routed;
                if (!Actor.WaitForSynchronizationLevelWithSimAndIgnoreSocialTest(actor, Sim.SyncLevel.Routed, 100f))
                {
                    FinishLinkedInteraction(true);
                    return(false);
                }

                StandardEntry();
                BeginCommodityUpdates();
                EnterStateMachine("BotMakingStation", "Enter", "x");
                SetActor("BotMakingStation", Target);
                CASRobotData supernaturalData = actor.SimDescription.SupernaturalData as CASRobotData;
                if (supernaturalData != null)
                {
                    form = supernaturalData.Form;
                    SetParameter("IsHoverBot", supernaturalData.Form == RobotForms.Hovering);
                }
                else
                {
                    form = RobotForms.Humanoid;
                    SetParameter("IsHoverBot", false);
                }

                Target.SetGeometryState("on");
                mCurrentStateMachine.RequestState(true, "x", "OpenDoor");
                Actor.SynchronizationLevel = Sim.SyncLevel.Committed;
                AnimateSim("StayOpen");
                if (!Actor.WaitForSynchronizationLevelWithSim(actor, Sim.SyncLevel.Committed, 100f))
                {
                    SetActor("y", actor);
                    mCurrentStateMachine.RequestState(true, "x", "ExitWithBot");
                    FinishLinkedInteraction(true);
                    EndCommodityUpdates(true);
                    StandardExit();
                    return(false);
                }

                SetActor("y", actor);
                mCurrentStateMachine.RequestState(true, "x", "CustomizeServobot");
                CASLogic singleton = CASLogic.GetSingleton();
                try
                {
                    new Sims.Advanced.EditInCAS(false).Perform(new GameHitParameters <GameObject>(actor, actor, GameObjectHit.NoHit));

                    while (GameStates.NextInWorldStateId != InWorldState.SubState.LiveMode)
                    {
                        SpeedTrap.Sleep();
                    }
                    if (!CASChangeReporter.Instance.CasCancelled && CASChangeReporter.Instance.GetPropertyChanged(CASChangeReporter.ChangeFlags.Any))
                    {
                        Actor.ModifyFunds(-BotMakingStation.kCostToCustomizeServoBot);
                    }
                    mCurrentStateMachine.RequestState(true, "x", "ExitWithBot");
                    Target.SetGeometryState("off");
                    Actor.SynchronizationLevel = Sim.SyncLevel.Completed;
                    FinishLinkedInteraction(true);
                }
                finally
                {
                    supernaturalData = actor.SimDescription.SupernaturalData as CASRobotData;
                    if (supernaturalData.Form != form)
                    {
                        if (supernaturalData.Form == RobotForms.Hovering)
                        {
                            actor.TraitManager.RemoveElement(TraitNames.BipedBot);
                            actor.TraitManager.AddHiddenElement(TraitNames.HoverBot);
                        }
                        else
                        {
                            actor.TraitManager.RemoveElement(TraitNames.HoverBot);
                            actor.TraitManager.AddHiddenElement(TraitNames.BipedBot);
                        }
                    }
                }
                EndCommodityUpdates(true);
                StandardExit();
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(false);
        }
Пример #23
0
        public static void PopulateHornColors()
        {
            try
            {
                CAPUnicorn ths = CAPUnicorn.gSingleton;
                if (ths == null)
                {
                    return;
                }

                CASPartPreset preset;
                ths.mHornColorsGrid.Clear();
                List <CASPart> wornHornParts = new List <CASPart>();

                CASPart wornPart = ths.GetWornHornPart();

                CASLogic singleton = CASLogic.GetSingleton();

                foreach (CASPart part in singleton.mCasParts)
                {
                    if ((part.BodyType == BodyTypes.PetHorn) &&
                        (part.Species == CASAgeGenderFlags.Horse) &&
                        ((part.Age & singleton.Age) != CASAgeGenderFlags.None))
                    {
                        wornHornParts.Add(part);
                    }
                }

                CompositorUtil.GetPatternsFromCASPart(wornPart);
                ObjectDesigner.SetCASPart(wornPart.Key);
                ResourceKey layoutKey    = ResourceKey.CreateUILayoutKey("EyeColorPresetGridItem", 0x0);
                string      designPreset = null;

                // Custom
                try
                {
                    designPreset = Responder.Instance.CASModel.GetDesignPreset(wornPart);
                }
                catch
                { }

                foreach (CASPart wornHornPart in wornHornParts)
                {
                    uint num = CASUtils.PartDataNumPresets(wornHornPart.Key);

                    int i = 0;

                    for (uint j = 0x0; j < num; j++)
                    {
                        preset = new CASPartPreset(wornHornPart, CASUtils.PartDataGetPresetId(wornHornPart.Key, j), CASUtils.PartDataGetPreset(wornHornPart.Key, j));

                        ths.AddHornPresetGridItem(ths.mHornColorsGrid, layoutKey, preset, wornHornPart, (uint)(j + 0x1));
                        if (CAPUnicorn.HornPresetCompare(designPreset, preset.mPresetString))
                        {
                            ths.mCurrentHornColorPreset      = preset;
                            ths.mHornColorsGrid.SelectedItem = i;
                            if (UIUtils.GetCustomContentType(wornHornPart.Key, preset.mPresetId) == ResourceKeyContentCategory.kInstalled)
                            {
                                ths.mHornColorDeleteButton.Enabled = false;
                            }
                            else
                            {
                                ths.mHornColorDeleteButton.Enabled = true;
                            }
                        }

                        i++;
                    }
                }

                if (ths.mHornColorsGrid.SelectedItem == -1)
                {
                    ths.mHornColorDeleteButton.Enabled = false;
                }

                bool flag = ths.mHornColorsGrid.Count > (ths.mHornColorsGrid.VisibleRows * ths.mHornColorsGrid.VisibleColumns);
                Rect area = ths.mHornColorPanel.Area;
                area.Height = flag ? ths.mHornColorPanelHeightWithScrollbars : (ths.mHornColorPanelHeightWithScrollbars - 21f);
                ths.mHornColorPanel.Area = area;
            }
            catch (Exception e)
            {
                Common.Exception("PopulateHornColors", e);
            }
        }
Пример #24
0
 protected static List<CASParts.Wrapper> GetVisibleCASParts(CASLogic ths, BodyTypes bodyType)
 {
     return GetVisibleCASParts(ths, bodyType, ths.GetForgivingCategoryMask(ths.mCurrentOutfitCategory));
 }