Beispiel #1
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);
        }
        private static void OnProcessRandomizeCategory()
        {
            CASCompositorController ths = CASCompositorController.sController;

            if (ths == null)
            {
                return;
            }

            List <string> materials = new List <string>();

            for (int i = 0; i < ths.mMaterialComboBox.ValueList.Count; i++)
            {
                materials.Add(ths.mMaterialComboBox.EntryTags[i] as string);
            }

            if (materials.Count > 0)
            {
                ths.SetFilter(RandomUtil.GetRandomObjectFromList(materials));

                ths.mMaterialsWindowGrid.Clear();
                ths.PopulateMaterialsBinGrid();

                while (!ths.Enabled)
                {
                    SpeedTrap.Sleep();
                }
            }

            OnProcessRandomizeMaterial();
        }
Beispiel #3
0
        public void SpeedTrapInstantiates()
        {
            var speedTrap = new SpeedTrap();

            Assert.NotNull(speedTrap);
            Assert.Empty(speedTrap.Traps);
        }
Beispiel #4
0
        public override bool Run()
        {
            try
            {
                mCurrentStateMachine = StateMachineClient.Acquire(Target, "Mirror", AnimationPriority.kAPDefault);
                mCurrentStateMachine.SetActor("x", Target);
                mCurrentStateMachine.EnterState("x", "StepInFrontOfMirror");
                AnimateSim("ChangeAppearance");

                new Sims.Dresser().Perform(new GameHitParameters <GameObject>(Target, Target, GameObjectHit.NoHit));

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

                AnimateSim("NodAsApproval");
                AnimateSim("LeaveMirror");

                /*
                 * (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).NotifySimChanged(Target.ObjectId);
                 */
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(false);
        }
Beispiel #5
0
        protected override void OnPerform()
        {
            while (sChecks.Count > 0)
            {
                Check check = sChecks[0];
                sChecks.RemoveAt(0);

                SpeedTrap.Sleep();

                try
                {
                    while (AgingManager.Singleton == null)
                    {
                        SpeedTrap.Sleep(0);
                    }

                    if (check.mSim.AgingState != null)
                    {
                        check.mSim.AgingState.MergeTravelInformation(check.mMiniSim);
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(check.mSim, e);
                }
            }
        }
Beispiel #6
0
        protected static Household GetImportSelection(Lot lot)
        {
            BinModel.Singleton.PopulateExportBin();

            ExportBinContents contents = new ImportSelection(BinModel.Singleton.ExportBinContents).SelectSingle() as ExportBinContents;

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

            List <Household> houses = new List <Household>();

            Household household = null;

            ProgressDialog.Show(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/Global:Processing", new object[0x0]), false);

            Dictionary <string, List <News.NewsTuning.ArticleTuning> > namedArticles = News.sNewsTuning.mNamedArticles;

            try
            {
                // Doing so stops Marriage notices of imported sims from appearing in the newspaper
                News.sNewsTuning.mNamedArticles = new Dictionary <string, List <News.NewsTuning.ArticleTuning> >();

                HouseholdContentsProxy houseContents = HouseholdContentsProxy.Import(contents.PackageName);

                household = houseContents.Household;
                if (household == null)
                {
                    return(null);
                }

                List <ulong> indexMap = ExportBinContentsEx.CreateIndexMap(household);

                lot.MoveIn(household);

                CreateActors(lot);

                BinCommonEx.CreateInventories(household, houseContents.Contents, indexMap);

                BinCommon.UpdateImportedUrnstones(household, lot);

                household.FixupGenealogy();
            }
            finally
            {
                News.sNewsTuning.mNamedArticles = namedArticles;

                try
                {
                    ProgressDialog.Close();
                }
                catch
                { }
            }

            SpeedTrap.Sleep();

            return(household);
        }
Beispiel #7
0
        public override bool Run()
        {
            try
            {
                foreach (GameObject obj in Target.GetObjects <GameObject>())
                {
                    obj.RemoveFromWorld();
                    obj.SetHiddenFlags(HiddenFlags.Everything);
                    obj.SetOpacity(0f, 0f);
                }

                SpeedTrap.Sleep();

                foreach (GameObject obj in Target.GetObjects <GameObject>())
                {
                    obj.AddToWorld();
                    obj.SetHiddenFlags(HiddenFlags.Nothing);
                    obj.SetOpacity(1f, 0f);
                }
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
            }
            return(true);
        }
Beispiel #8
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);
                 * }
                 */
            }
        }
Beispiel #9
0
        public void TrapRunWorksWithAction()
        {
            var speedTrap = new SpeedTrap();
            var trap      = speedTrap.GetTrap("test-trap");

            trap.Run(() => _testOutputHelper.WriteLine("Hello World!"));
            Assert.NotNull(trap.LastRun);
            Assert.NotEqual(TimeSpan.Zero, trap.LastRun?.Duration);
        }
Beispiel #10
0
        public void SpeedTrapReturnsAccurateTapNameByAction()
        {
            var speedTrap = new SpeedTrap();
            var trap      = speedTrap.GetTrap(SpeedTrapReturnsAccurateTapNameByAction);

            Assert.NotEmpty(speedTrap.Traps);
            Assert.Equal(nameof(SpeedTrapReturnsAccurateTapNameByAction), trap.Name);
            Assert.NotNull(trap.Action);
        }
Beispiel #11
0
        public void SpeedTrapReturnsAccurateTapNameByNameWithAction()
        {
            const string trapName  = "trap1";
            var          speedTrap = new SpeedTrap();
            var          trap      = speedTrap.GetTrap(trapName, SpeedTrapReturnsAccurateTapNameByNameWithAction);

            Assert.NotEmpty(speedTrap.Traps);
            Assert.Equal(trapName, trap.Name);
            Assert.NotNull(trap.Action);
        }
Beispiel #12
0
        public void TrapRunsWithBlockingFunc()
        {
            var speedTrap = new SpeedTrap();
            var trap      = speedTrap.GetTrap("test-trap");
            var number    = trap.Run(() => 12345);

            Assert.NotNull(trap.LastRun);
            Assert.NotEqual(TimeSpan.Zero, trap.LastRun?.Duration);
            Assert.Equal(12345, number);
        }
Beispiel #13
0
        public async Task TrapRunsWithAsyncFunc()
        {
            var speedTrap = new SpeedTrap();
            var trap      = speedTrap.GetTrap("test-trap");
            var number    = await trap.Run(() => Task.FromResult(12345));

            Assert.NotNull(trap.LastRun);
            Assert.NotEqual(TimeSpan.Zero, trap.LastRun?.Duration);
            Assert.Equal(12345, number);
        }
Beispiel #14
0
 public void Clear()
 {
     Cars.Clear();
     Comments.Clear();
     SpeedSector1.Clear();
     SpeedSector2.Clear();
     SpeedSector3.Clear();
     SpeedTrap.Clear();
     DriversNames.Clear();
 }
Beispiel #15
0
        public void TrapIsNotReplacedPerGetTrapCall()
        {
            var speedTrap = new SpeedTrap();
            var trap      = speedTrap.GetTrap(TrapIsNotReplacedPerGetTrapCall);
            var run       = trap.StartRun();

            run.Stop();
            Assert.NotEmpty(trap.Runs);
            trap = speedTrap.GetTrap(TrapIsNotReplacedPerGetTrapCall);
            Assert.NotEmpty(trap.Runs);
        }
Beispiel #16
0
        public void SpeedTrapRetainsTrapRecords()
        {
            var speedTrap = new SpeedTrap();

            Assert.NotNull(speedTrap);
            Assert.Empty(speedTrap.Traps);
            var trap = speedTrap.GetTrap(SpeedTrapRetainsTrapRecords);

            Assert.NotEmpty(speedTrap.Traps);
            Assert.Equal(trap.Name, speedTrap.Traps.First().Name);
            Assert.Equal(trap.Action, speedTrap.Traps.First().Action);
        }
Beispiel #17
0
        public static bool StartPlasticSurgeryCAS(Sim sim, Hospital.SurgeryTypes type)
        {
            CASChangeReporter.Instance.ClearChanges();

            SimDescription simDescription = sim.SimDescription;

            if (simDescription == null)
            {
                throw new Exception("EditSimInCAS:  sim doesn't have a description!");
            }

            switch (sim.CurrentOutfitCategory)
            {
            case OutfitCategories.Everyday:
            case OutfitCategories.Formalwear:
            case OutfitCategories.Sleepwear:
            case OutfitCategories.Swimwear:
            case OutfitCategories.Athletic:
                break;

            default:
                SimpleMessageDialog.Show(Cheats.LocalizeString("EditSimInCAS", new object[0x0]), Cheats.LocalizeString("CommonOutfitCategoryRequired", new object[0x0]), ModalDialog.PauseMode.PauseSimulator);
                return(false);
            }

            switch (type)
            {
            case Hospital.SurgeryTypes.PlasticSurgeryFaceCheap:
            case Hospital.SurgeryTypes.PlasticSurgeryFaceExpensive:
                new Sims.Advanced.SurgeryFace().Perform(new GameHitParameters <GameObject>(sim, sim, GameObjectHit.NoHit));
                break;

            case Hospital.SurgeryTypes.PlasticSurgeryBodyCheap:
            case Hospital.SurgeryTypes.PlasticSurgeryBodyExpensive:
                new Sims.Advanced.SurgeryBody().Perform(new GameHitParameters <GameObject>(sim, sim, GameObjectHit.NoHit));
                break;

            default:
                throw new Exception("PlasticSurgery: Option not defined!");
            }

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

            bool flag = !CASChangeReporter.Instance.CasCancelled;

            CASChangeReporter.Instance.ClearChanges();
            return(flag);
        }
Beispiel #18
0
        public static SimDescription CreateProgenitor(ulong id, out bool unpacked)
        {
            unpacked = false;

            if (id == 0)
            {
                return(null);
            }

            if (FutureDescendantServiceEx.UnpackedSims.ContainsKey(id))
            {
                return(FutureDescendantServiceEx.UnpackedSims[id]);
            }

            SimDescription sim = SimDescription.Find(id);

            if (sim == null)
            {
                MiniSimDescription msd = MiniSimDescription.Find(id);
                if (msd == null)
                {
                    return(null);
                }

                // Custom
                sim = MiniSims.UnpackSimAndUpdateRel(msd);
                if (sim == null)
                {
                    return(null);
                }

                Household.CreateTouristHousehold();
                Household.TouristHousehold.AddTemporary(sim);
                msd.Instantiated = true;

                if (sim.AgingState != null)
                {
                    sim.AgingState.MergeTravelInformation(msd);
                }

                FutureDescendantServiceEx.UnpackedSims.Add(id, sim);

                SpeedTrap.Sleep();
                unpacked = true;
            }

            sim.Fixup();

            return(sim);
        }
Beispiel #19
0
        public static void OnAcceptSim(WindowBase sender, UIButtonClickEventArgs eventArgs)
        {
            try
            {
                CASPuck ths = CASPuck.Instance;

                if (!ths.UiBusy)
                {
                    ths.UiBusy = true;
                    CASExitLoadScreen.DisableQuit = true;

                    // Custom
                    if (CASLogic.Instance.OutfitCategory == OutfitCategories.Career)
                    {
                        CASLogic.Instance.OutfitCategory = OutfitCategories.Everyday;

                        SpeedTrap.Sleep();
                    }

                    if (Responder.Instance.CASModel.CASMode == CASMode.CreateABot)
                    {
                        Function f = delegate
                        {
                            CASController.Singleton.SetCurrentState(CASState.BotSummary);
                            if (ths.ShowCABRequiredItemsDialogTask())
                            {
                                // Custom
                                AcceptSimCallback(ths);
                            }
                            else
                            {
                                ths.UiBusy = false;
                            }
                        };

                        Simulator.AddObject(new OneShotFunctionTask(f));
                    }
                    else
                    {
                        // Custom
                        AcceptSimCallback(ths);
                    }
                }
                eventArgs.Handled = true;
            }
            catch (Exception exception)
            {
                Common.Exception("OnAcceptHousehold", exception);
            }
        }
Beispiel #20
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            int count = 0;

            foreach (GameObject obj in Lot.GetObjects <GameObject>())
            {
                try
                {
                    if (obj.HasBeenDestroyed)
                    {
                        continue;
                    }

                    int value = obj.Value;

                    obj.AppreciateDepreciateDailyUpdate();

                    AddScoring("", obj.Value - value);

                    count++;

                    if (count > 250)
                    {
                        SpeedTrap.Sleep();
                        count = 0;
                    }
                }
                catch (Exception e)
                {
                    Common.DebugException(obj, e);
                }
            }

            Household house = Lot.Household;

            if (house != null)
            {
                foreach (Sim sim in HouseholdsEx.AllSims(house))
                {
                    if (!Inventories.VerifyInventory(sim.SimDescription))
                    {
                        continue;
                    }

                    sim.Inventory.AppreciateDepreciateInventoryItems();
                }
            }
            return(true);
        }
Beispiel #21
0
 protected override bool PerformResults(CastIceBlastTerrainEx ths, string epicJazzName, IMagicalDefinition definition, MagicControl control, bool spellCastingSucceeded, bool spellCastingEpiclyFailed)
 {
     if (spellCastingSucceeded)
     {
         ths.AnimateSim("SuccessIdle");
         SpeedTrap.Sleep((uint)SimClock.ConvertToTicks(2f, TimeUnit.Minutes));
         ths.AnimateSim("Success");
         ths.OnSpellSuccess();
         return(true);
     }
     else
     {
         return(base.PerformResults(ths, epicJazzName, definition, control, false, spellCastingEpiclyFailed));
     }
 }
Beispiel #22
0
        public static void OnCloseClick(WindowBase sender, UIButtonClickEventArgs eventArgs)
        {
            try
            {
                CASPuck ths = CASPuck.gSingleton;
                if (ths == null)
                {
                    return;
                }

                //Common.DebugNotify(delegate { return "UiBusy: " + ths.mUiBusy + Common.NewLine + "LeaveCAS: " + ths.mLeaveCAS; });

                //if (!ths.UiBusy && !ths.mLeaveCAS)
                {
                    ths.UiBusy = true;
                    Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(delegate
                    {
                        string entryKey = (Responder.Instance.CASModel.CASMode == CASMode.Full) ? "Ui/Caption/CAS/ExitDialog:Prompt" : "Ui/Caption/CAS/ExitDialog:AlternatePrompt";
                        if (TwoButtonDialog.Show(Common.LocalizeEAString(entryKey), Common.LocalizeEAString("Ui/Caption/Global:Yes"), Common.LocalizeEAString("Ui/Caption/Global:No")))
                        {
                            CASController singleton = CASController.Singleton;
                            singleton.AllowCameraMovement(false);

                            ICASModel cASModel = Responder.Instance.CASModel;
                            while (cASModel.IsProcessing())
                            {
                                SpeedTrap.Sleep();
                            }

                            Sims.CASBase.sWasCanceled = true;

                            sender.Enabled = false;
                            cASModel.RequestClearChangeReport();
                            singleton.SetCurrentState(CASState.None);
                        }
                        else
                        {
                            ths.UiBusy = false;
                        }
                    }));
                    eventArgs.Handled = true;
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnCloseClick", e);
            }
        }
Beispiel #23
0
        public void TrapOperatesAsExpected()
        {
            var speedTrap = new SpeedTrap();
            var trap      = speedTrap.GetTrap(TrapOperatesAsExpected);
            var run       = trap.StartRun();

            Assert.True(run.IsRunning);

            run.Stop();

            Assert.False(run.IsRunning);
            Assert.NotEmpty(trap.Runs);
            Assert.NotNull(trap.LastRun);
            Assert.Equal(trap.LastRun, trap.Runs.Last());
            Assert.Equal(run.Duration, trap.Runs.First().Duration);
            Assert.Equal(run.StartedOn, trap.Runs.First().StartedOn);
        }
Beispiel #24
0
        public static void DisplayCAS(Sim simInCAS, ref bool tookSemaphore)
        {
            if (!Responder.Instance.OptionsModel.SaveGameInProgress)
            {
                bool flag = GameStates.WaitForInteractionStateChangeSemaphore(simInCAS, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                tookSemaphore = flag;
                if (tookSemaphore)
                {
                    while ((Sims3.Gameplay.Gameflow.CurrentGameSpeed == Sims3.Gameplay.Gameflow.GameSpeed.Pause) || MoveDialog.InProgress())
                    {
                        SpeedTrap.Sleep();
                    }

                    new Sims.Basic.Tattoo().Perform(new GameHitParameters <GameObject>(simInCAS, simInCAS, GameObjectHit.NoHit));
                }
            }
        }
Beispiel #25
0
        protected static void Update(MiniSimDescription miniSim)
        {
            if (miniSim == null)
            {
                return;
            }

            while ((AgingManager.Singleton == null) || (AlarmManager.Global == null))
            {
                SpeedTrap.Sleep();
            }

            if (MiniSims.UpdateThumbnailKey(miniSim) == MiniSims.Results.Success)
            {
                //Common.DebugNotify("Updated: " + miniSim.FullName);

                SpeedTrap.Sleep();
            }
        }
Beispiel #26
0
        public override bool Run()
        {
            ForceKillSimNiec.Definition definition = base.InteractionDefinition as ForceKillSimNiec.Definition;
            List <Sim> list = new List <Sim>();

            foreach (Sim sim in NFinalizeDeath.SC_GetObjects <Sim>())
            {
                if (sim.SimDescription.ToddlerOrAbove && !sim.IsInActiveHousehold && sim.LotCurrent != Household.ActiveHousehold.LotHome)
                {
                    //
                    SpeedTrap.Sleep(10);
                    sim.BuffManager.AddElement(BuffNames.Mourning, Origin.FromWitnessingDeath);
                    BuffMourning.BuffInstanceMourning buffInstanceMourning = sim.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning;
                    if (buffInstanceMourning != null)
                    {
                        buffInstanceMourning.MissedSim = Target.SimDescription;
                    }
                    //
                    SpeedTrap.Sleep(10);
                    sim.BuffManager.AddElement(BuffNames.HeartBroken, Urnstone.CalculateMourningMoodStrength(sim, sim.SimDescription), Origin.FromWitnessingDeath);
                    BuffHeartBroken.BuffInstanceHeartBroken buffInstanceHeartBroken = sim.BuffManager.GetElement(BuffNames.HeartBroken) as BuffHeartBroken.BuffInstanceHeartBroken;
                    if (buffInstanceHeartBroken != null)
                    {
                        buffInstanceHeartBroken.MissedSim = Target.SimDescription;
                    }
                    //
                    SpeedTrap.Sleep(10);
                    sim.BuffManager.AddElement(BuffNames.Negligent, Origin.FromNeglectingChildren);
                    BuffNegligent.BuffInstanceNegligent buffInstanceNegligent = sim.BuffManager.GetElement(BuffNames.Negligent) as BuffNegligent.BuffInstanceNegligent;
                    if (buffInstanceNegligent != null)
                    {
                        buffInstanceNegligent.MissedSims.Add(Target.SimDescription);
                    }
                }
            }
            SpeedTrap.Sleep(10);
            if (Target.IsNPC)
            {
                SafeNRaas.NRUrnstones_CreateGrave(Target.SimDescription, definition.death, true, true);
            }

            return(true);
        }
Beispiel #27
0
        private bool FinishAdoption(Sim pet)
        {
            if (pet != null)
            {
                pet.InteractionQueue.CancelAllInteractions();
                pet.SetObjectToReset();

                SpeedTrap.Sleep();

                pet.UpdateBlockTime();
                Actor.ShowTNSAndPlayStingIfSelectable("sting_pet_adopt", TNSNames.AdoptLitterTNS, Target, pet, null, null, pet.IsFemale, false, new object[] { pet });

                if (pet == Sim.ActiveActor)
                {
                    LotManager.SelectNextSim();
                }

                if (pet.Household != null)
                {
                    pet.Household.Remove(pet.SimDescription);
                }
                Actor.Household.Add(pet.SimDescription);

                Relationships.CheckAddHumanParentFlagOnAdoption(Actor.SimDescription, pet.SimDescription);

                if (Actor.Partner != null)
                {
                    Relationships.CheckAddHumanParentFlagOnAdoption(Actor.Partner, pet.SimDescription);
                }

                InteractionInstance entry = new SocialInteractionA.Definition("Talk To Pet", new string[0x0], null, false).CreateInstance(pet, Actor, GetPriority(), false, false);

                List <Sim> list = new List <Sim>();
                list.Add(pet);
                GoHome home = GoHome.Singleton.CreateInstance(Actor.LotHome, Actor, GetPriority(), false, false) as GoHome;
                home.SimFollowers = list;

                Actor.InteractionQueue.AddNext(home);
                return(Actor.InteractionQueue.AddNext(entry));
            }
            return(false);
        }
Beispiel #28
0
        public static void OnCreateSimClick(WindowBase sender, UIButtonClickEventArgs eventArgs)
        {
            try
            {
                CASPuck ths = CASPuck.gSingleton;

                Sims3.UI.Function f = null;
                if (ths.mAttemptingToAdd)
                {
                    if (f == null)
                    {
                        f = delegate
                        {
                            while (ths.mAttemptingToAdd)
                            {
                                SpeedTrap.Sleep();
                            }

                            // Custom
                            CallCreateSimCallback((CASPuck.ControlIDs)sender.ID);
                        };
                    }
                    Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(f));
                }
                else
                {
                    // Custom
                    CallCreateSimCallback((CASPuck.ControlIDs)sender.ID);
                }

                ths.HideEditPopupMenu();
                ths.HideAddPopupMenu();
                eventArgs.Handled = true;
            }
            catch (Exception e)
            {
                Common.Exception("OnCreateSimClick", e);
            }
        }
Beispiel #29
0
        public override bool Run() // Run
        {
            if (Actor.IsInActiveHousehold)
            {
                Actor.Autonomy.SituationComponent.Situations.Add(NiecHelperSituation.Create(Actor.LotCurrent, Actor));
            }
            SpeedTrap.Sleep(0);
            NiecHelperSituation situationOfType = Actor.GetSituationOfType <NiecHelperSituation>();

            if (situationOfType != null)
            {
                StyledNotification.Show(new StyledNotification.Format("Check Ok", StyledNotification.NotificationStyle.kGameMessagePositive));
                if (Target != Actor)
                {
                    Actor.InteractionQueue.Add(NiecHelperSituation.NiecAppear.Singleton.CreateInstance(Target, Actor, new InteractionPriority((InteractionPriorityLevel)999, 999f), isAutonomous: false, cancellableByPlayer: false));
                }
            }
            else
            {
                StyledNotification.Show(new StyledNotification.Format("Check Failed", StyledNotification.NotificationStyle.kGameMessagePositive));
            }

            return(true);
        }
Beispiel #30
0
        public static bool ControlLoop(LoopingAnimationBase interaction)
        {
            try
            {
                float start = SimClock.ElapsedTime(TimeUnit.Seconds);
                while (((interaction.Paused) || (interaction.Timing > (SimClock.ElapsedTime(TimeUnit.Seconds) - start))) && (!interaction.TargetSim.HasExitReason()))
                {
                    SpeedTrap.Sleep();
                }

                interaction.Iterations--;

                return(interaction.Iterations > 0);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(interaction.TargetSim, interaction.TargetSim, e);
                return(false);
            }
        }