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();
        }
Example #2
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);
        }
Example #3
0
        public override void Startup()
        {
            // From StateMachine:Startup
            mBaseCallFlag |= BaseCallFlag.kStartup;

            // From InWorldSubState
            while (sDelayNextStateStartupCount > 0x0)
            {
                SpeedTrap.Sleep(0x0);
            }
            EventTracker.SendEvent(new InWorldSubStateEvent(this, true));

            // From EditTownState
            if (SeasonsManager.Enabled)
            {
                SeasonsManager.OnEnterEditTown();
            }

            AudioManager.MusicMode = MusicMode.EditTown;
            UserToolUtils.UserToolGeneric(0xc8, new ResourceKey(0x0L, 0x0, 0x0));
            BorderTreatmentsController.Hide();
            GameUtils.Pause();
            base.PlaceLotWizardCheck();
            EditTownController.Load();
            Tutorialette.TriggerLesson(Lessons.EditTown, null);
            Tutorialette.TriggerLesson(Lessons.PlacingNewVenues, null);
            //Household.DestroyHouseholdsWithoutGuardians();
            CASExitLoadScreen.Close();
            InWorldSubState.EdgeScrollCheck();
            InWorldSubState.OpportunityDialogCheck();
        }
Example #4
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);
                }
            }
        }
Example #5
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);
        }
Example #6
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);
        }
Example #7
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);
        }
Example #8
0
        protected override bool OnPerform()
        {
            if ((IceCreamTruckManager.Singleton == null) || (LotManager.sLots == null))
            {
                return(true);
            }

            Simulator.DestroyObject(IceCreamTruckManager.Singleton.mIceCreamTruckManager);
            IceCreamTruckManager.Singleton.mIceCreamTruckManager = ObjectGuid.InvalidObjectGuid;

            bool enable = true;

            if (Common.IsAwayFromHomeworld())
            {
                if (!Traffic.Settings.mEnableIceCreamTruckVacation)
                {
                    enable = false;
                }
            }

            if (Traffic.Settings.mMaxIceCreamTrucks == 0)
            {
                enable = false;
            }

            if (enable)
            {
                IceCreamTruckManagerEx.Update(IceCreamTruckManager.Singleton);

                SpeedTrap.Sleep(0x12c);
            }

            return(true);
        }
Example #9
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);
                 * }
                 */
            }
        }
Example #10
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);
        }
Example #11
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);
            }
        }
Example #12
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);
        }
Example #13
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);
        }
Example #14
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));
     }
 }
Example #15
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);
            }
        }
Example #16
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));
                }
            }
        }
Example #17
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();
            }
        }
Example #18
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);
        }
Example #19
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);
        }
Example #20
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);
            }
        }
Example #21
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);
        }
Example #22
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);
            }
        }
Example #23
0
        public override bool Run()
        {
            try
            {
                if (Target.Route(this))
                {
                    StandardEntry();
                    Mirror.EnterStateMachine(this);
                    AnimateSim("ChangeAppearance");
                    StartStages();

                    if (Responder.Instance.OptionsModel.SaveGameInProgress)
                    {
                        StandardExit();
                        return(false);
                    }

                    mTookSemaphore = GameStates.WaitForInteractionStateChangeSemaphore(Actor, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                    if (!mTookSemaphore)
                    {
                        StandardExit();
                        return(false);
                    }
                    if (!Actor.IsSelectable)
                    {
                        StandardExit();
                        return(false);
                    }

                    if (!IntroTutorial.IsRunning || IntroTutorial.AreYouExitingTutorial())
                    {
                        while ((Sims3.Gameplay.Gameflow.CurrentGameSpeed == Sims3.Gameplay.Gameflow.GameSpeed.Pause) || MoveDialog.InProgress())
                        {
                            SpeedTrap.Sleep();
                        }

                        int careerOutfitIndex = Actor.SimDescription.CareerOutfitIndex;
                        if (Actor.CurrentOutfitCategory == OutfitCategories.Career)
                        {
                            ArrayList outfits = Actor.SimDescription.GetOutfits(Actor.CurrentOutfitCategory);
                            for (int i = 0; i < outfits.Count; i++)
                            {
                                if (Actor.CurrentOutfit.Key == (outfits[i] as SimOutfit).Key)
                                {
                                    Actor.SimDescription.CareerOutfitIndex = i;
                                    break;
                                }
                            }
                        }

                        new Sims.Mirror().Perform(new GameHitParameters <GameObject>(Actor, Actor, GameObjectHit.NoHit));

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

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

                        if (Actor.CurrentOutfitCategory == OutfitCategories.Career)
                        {
                            Actor.SimDescription.CareerOutfitIndex = careerOutfitIndex;
                        }

                        StandardExit();

                        /*
                         * Actor.RecreateOccupationOutfits();
                         * (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).NotifySimChanged(Actor.ObjectId);
                         */
                        return(true);
                    }

                    StandardExit();
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(false);
        }
Example #24
0
        public override bool Run()
        {
            try
            {
                if (Responder.Instance.TutorialModel.IsTutorialRunning())
                {
                    if (!Target.CancelTutorial())
                    {
                        return(false);
                    }
                    Responder.Instance.TutorialModel.ForceExitTutorial();
                }

                List <Sim> lazyList = new List <Sim>();
                if (!PreTimeTravel1(this, this, lazyList))
                {
                    return(false);
                }

                foreach (Sim sim4 in lazyList)
                {
                    if (!sim4.SimDescription.Baby)
                    {
                        TimePortal.GatherAround entry = TimePortal.GatherAround.Singleton.CreateInstance(Target, sim4, GetPriority(), Autonomous, CancellableByPlayer) as TimePortal.GatherAround;
                        entry.mMasterInteraction = this;
                        sim4.InteractionQueue.AddNext(entry);
                    }
                }

                int num;
                if (!Actor.RouteToSlotListAndCheckInUse(Target, TimePortal.kRoutingSlots, out num))
                {
                    CancelFollowers(lazyList);
                    return(false);
                }

                if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    CancelFollowers(lazyList);
                    return(false);
                }

                if (!PreTimeTravel2(this, lazyList))
                {
                    return(false);
                }

                EnterStateMachine("timeportal", "Enter", "x", "portal");
                AddPersistentScriptEventHandler(0xc9, CameraShakeEvent);
                AnimateSim("Call Over");

                Skill futureSkill = Actor.SkillManager.AddElement(SkillNames.Future);
                if (futureSkill.SkillLevel >= 0x3)
                {
                    AnimateSim("Jump In");
                }
                else
                {
                    AnimateSim("Apprehensive");
                }

                bool succeeded = true;
                if (!GameUtils.IsFutureWorld())
                {
                    // Custom
                    succeeded = TimePortalEx.TravelToFuture(Target, Actor, new List <Sim>(mFollowerGroup), new List <ulong>(mFollowerGroupIDs));
                }

                if (succeeded)
                {
                    foreach (Sim sim7 in lazyList)
                    {
                        futureSkill = sim7.SkillManager.GetElement(SkillNames.Future);
                        if (futureSkill != null)
                        {
                            futureSkill.AddPoints(kFollowerFutureSkillPointGain, true, false);
                        }
                    }
                }
                else
                {
                    CancelFollowers(lazyList);
                    SpeedTrap.Sleep(0x3c);
                    AnimateSim("Spit Out");
                    Target.SwitchActiveState();
                }

                AnimateSim("Exit");
                EndCommodityUpdates(succeeded);
                StandardExit();
                if (GameUtils.IsFutureWorld())
                {
                    Target.StopActiveFX();

                    // Custom
                    GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld();

                    SendEventForActorAndFollowers(Actor, lazyList, EventTypeId.kTravelToPresent);
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            finally
            {
                TravelUtil.PlayerMadeTravelRequest = false;
                //Sims3.Gameplay.Gameflow.Singleton.EnableSave(this);
            }

            return(false);
        }
Example #25
0
        public override bool Run()
        {
            try
            {
                if (!TimePortal.sTimeTravelerHasBeenSummoned && Actor.CreateRoute().PlanToSlot(Target, Slot.RoutingSlot_0).Succeeded())
                {
                    if (!TimeTravelerSituation.Create(Actor.LotHome, Actor.ObjectId, Target.ObjectId))
                    {
                        return(false);
                    }
                    CauseEffectService.OpportunityPortal = Target;
                    mTimeTravlerArrivalHandled           = false;
                }
                if ((Target.InUse && !Target.IsActorUsingMe(Actor)) || !Actor.RouteToSlot(Target, Slot.RoutingSlot_0, false))
                {
                    return(false);
                }
                if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    return(false);
                }

                Definition interactionDefinition = InteractionDefinition as Definition;
                if (Target.Active)
                {
                    interactionDefinition.curState = TimePortal.PortalState.Active;
                }
                else
                {
                    interactionDefinition.curState = TimePortal.PortalState.Inactive;
                }

                Actor.SkillManager.AddElement(SkillNames.Future);
                StandardEntry(!Target.IsActorUsingMe(Actor));
                BeginCommodityUpdates();
                Target.mTimeToStepBack = false;
                EnterStateMachine("timeportal", "Enter", "x");
                SetActor("portal", Target);
                mCurrentStateMachine.AddOneShotScriptEventHandler(0x65, SwitchActiveState);
                mCurrentStateMachine.AddOneShotScriptEventHandler(0x66, PositionTimeTraveler);
                AnimateSim("Mess With");
                if (!TimePortal.sTimeTravelerHasBeenSummoned)
                {
                    Common.DebugNotify("A");

                    mCurrentStateMachine.RequestState(false, "x", "FirstTimeReact");
                    emergencyStopWatch = StopWatch.Create(StopWatch.TickStyles.Seconds);
                    int num = 0x2d;

                    mTimeTraveler = CauseEffectService.GetInstance().GetTimeTraveler();
                    while ((mTimeTraveler == null) && (emergencyStopWatch.GetElapsedTime() < num))
                    {
                        SpeedTrap.Sleep(0x1);

                        // Custom
                        SimDescription simDesc = SimDescription.Find(CauseEffectService.sPersistableData.TimeTravelerSimID);
                        if (simDesc == null)
                        {
                            CauseEffectService.sPersistableData.TimeTravelerSimID = 0;
                            CauseEffectService.GetInstance().RequestTimeTravelerSimDesc(Household.NpcHousehold);
                        }
                        else
                        {
                            mTimeTraveler = Instantiation.PerformOffLot(simDesc, Target.LotCurrent, null);
                        }
                    }

                    Common.DebugNotify("B");

                    if (mTimeTraveler != null)
                    {
                        InteractionQueue interactionQueue = mTimeTraveler.InteractionQueue;
                        mLinkedInteraction            = TimePortal.BeSummoned.Singleton.CreateInstance(Actor, mTimeTraveler, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false) as TimePortal.BeSummoned;
                        mLinkedInteraction.SyncTarget = Actor;
                        interactionQueue.AddNext(mLinkedInteraction);
                        Actor.SynchronizationRole   = Sim.SyncRole.Initiator;
                        Actor.SynchronizationTarget = mTimeTraveler;
                        Actor.SynchronizationLevel  = Sim.SyncLevel.Routed;
                        if (Actor.WaitForSynchronizationLevelWithSim(mTimeTraveler, Sim.SyncLevel.Started, 40f))
                        {
                            Common.DebugNotify("C");

                            SetActorAndEnter("y", mTimeTraveler, "TTEnter");
                            AnimateJoinSims("TimeTravelerExit");
                            Actor.SynchronizationLevel = Sim.SyncLevel.Completed;

                            TimeTravelerSituation situation = ServiceSituation.FindServiceSituationInvolving(mTimeTraveler) as TimeTravelerSituation;
                            if (situation != null)
                            {
                                situation.OnAppearComplete(mTimeTraveler, 0f);

                                while (!Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                                {
                                    Actor.LoopIdle();
                                    SpeedTrap.Sleep(0xa);
                                }
                            }
                            else
                            {
                                Target.ActorsUsingMe.Clear();

                                TimePortal.sTimeTravelerHasBeenSummoned = true;
                            }
                        }
                        else
                        {
                            AnimateSim("Exit");
                        }

                        Common.DebugNotify("D");

                        mTimeTravlerArrivalHandled = true;
                    }
                    else
                    {
                        AnimateSim("Exit");
                    }
                }
                else
                {
                    if (!GameUtils.IsFutureWorld())
                    {
                        MiniSimDescription simDesc = MiniSimDescription.Find(CauseEffectService.sPersistableData.TimeTravelerSimID);
                        if (simDesc == null)
                        {
                            CauseEffectService.sPersistableData.TimeTravelerSimID = 0;
                            CauseEffectService.GetInstance().RequestTimeTravelerSimDesc(Household.NpcHousehold);
                        }
                    }

                    AnimateSim("Exit");
                    Vector3 v = Target.Position + ((Vector3)(2f * Target.ForwardVector));
                    Actor.RouteToPoint(v);
                    Actor.RouteTurnToFace(Target.Position);
                }

                EndCommodityUpdates(true);
                StandardExit();
                if (Target.Active)
                {
                    EventTracker.SendEvent(EventTypeId.kInspectedTimePortal, Actor);
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            finally
            {
                TravelUtil.PlayerMadeTravelRequest = false;
                //Sims3.Gameplay.Gameflow.Singleton.EnableSave(this);
            }

            return(false);
        }
Example #26
0
        public override bool Run()
        {
            try
            {
                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                bool flag2 = false;
                if (mIsMaster)
                {
                    flag2 = Target.RouteToBotStation(Actor, null);
                }
                else
                {
                    flag2 = Target.RouteToBotStation(Actor, WooHooer);
                }

                if (!flag2)
                {
                    Actor.AddExitReason(ExitReason.Finished);
                    return(false);
                }
                if (mIsMaster && Target.ActorsUsingMe.Contains(WooHooee))
                {
                    return(false);
                }

                StandardEntry();
                EnterStateMachine("BotStationWoohoo", "Enter", "x", "station");
                RegisterForHidingEvents();
                if (mIsMaster && !Actor.HasExitReason())
                {
                    if (WooHooee.InteractionQueue == null)
                    {
                        StandardExit();
                        return(false);
                    }

                    BotMakingStation.WooHoo entry = definition.ProxyClone(WooHooer).CreateInstance(Target, WooHooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as BotMakingStation.WooHoo;
                    entry.LinkedInteractionInstance = this;
                    entry.WooHooer = WooHooer;
                    entry.WooHooee = WooHooee;
                    WooHooee.InteractionQueue.AddNext(entry);
                }

                AnimateSim("WooHooWait");
                if (StartSync(mIsMaster))
                {
                    BeginCommodityUpdates();

                    try
                    {
                        if (mIsMaster)
                        {
                            Audio.StartObjectSound(Target.ObjectId, "sarcoph_woohoo", false);
                        }

                        CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitBotMaker, WooHooer, WooHooee);

                        isWooHooing = true;
                        AnimateSim("WooHoo");
                        isWooHooing = false;
                    }
                    finally
                    {
                        EndCommodityUpdates(true);
                    }

                    if (mIsMaster)
                    {
                        CommonWoohoo.RunPostWoohoo(Actor, WooHooee, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                        do
                        {
                            SpeedTrap.Sleep(0xa);
                        }while (Target.UseCount > 0x1);
                    }
                }
                else if (mIsMaster)
                {
                    if (LinkedInteractionInstance != null)
                    {
                        LinkedInteractionInstance.InstanceActor.AddExitReason(ExitReason.CanceledByScript);
                    }

                    do
                    {
                        SpeedTrap.Sleep(0xa);
                    }while (Target.UseCount > 0x1);
                }

                PrepSimForExit(true);
                AnimateSim("Exit");
                StandardExit();
                if (mIsMaster)
                {
                    if (CommonPregnancy.IsSuccess(WooHooer, WooHooee, Autonomous, definition.GetStyle(this)))
                    {
                        CommonPregnancy.Impregnate(WooHooer, WooHooee, Autonomous, definition.GetStyle(this));
                    }
                }
                else
                {
                    Actor.RouteAway(1f, 3f, false, GetPriority(), Autonomous, false, true, RouteDistancePreference.PreferNearestToRouteOrigin);
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #27
0
        public override bool Run()
        {
            try
            {
                SitData        data2;
                Slot           slot2;
                object         obj2;
                SittingPosture posture2;
                ISittable      sittable = SittingHelpers.CastToSittable(Target);
                if (sittable == null)
                {
                    Actor.AddExitReason(ExitReason.FailedToStart);
                    return(false);
                }

                Slot containmentSlotClosestToHit = GetContainmentSlotClosestToHit();
                if (Actor.Posture.Container == Target)
                {
                    SittingPosture posture = Actor.Posture as SittingPosture;
                    if (posture != null)
                    {
                        SitData target = posture.Part.Target;
                        if (containmentSlotClosestToHit == target.ContainmentSlot)
                        {
                            return(true);
                        }
                        if (!Stand.Singleton.CreateInstance(Target, Actor, GetPriority(), Autonomous, CancellableByPlayer).RunInteraction())
                        {
                            return(false);
                        }
                    }
                }

                SimQueue simLine = Target.SimLine;
                if ((simLine != null) && !simLine.WaitForTurn(this, SimQueue.WaitBehavior.DontPlayRouteFail | SimQueue.WaitBehavior.NeverWait, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), 0f))
                {
                    Sim firstSim = simLine.FirstSim;
                    if ((firstSim != null) && (firstSim.InteractionQueue.TransitionInteraction is Stand))
                    {
                        Actor.RemoveExitReason(ExitReason.ObjectInUse);
                        simLine.WaitForTurn(this, SimQueue.WaitBehavior.DontPlayRouteFail | SimQueue.WaitBehavior.OnlyWaitAtHeadOfLine, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), kTimeToWait);
                    }
                }

                if (!sittable.RouteToForSitting(Actor, containmentSlotClosestToHit, true, out data2, out slot2, out obj2))
                {
                    return(false);
                }

                sittable = SittingHelpers.CastToSittable(data2.Container);
                if (!SittingHelpers.ReserveSittable(this, Actor, sittable, data2))
                {
                    return(false);
                }

                StateMachineClient smc = sittable.StateMachineAcquireAndInit(Actor);
                if (smc == null)
                {
                    Actor.AddExitReason(ExitReason.NullValueFound);
                    SittingHelpers.UnreserveSittable(this, sittable, data2);
                    return(false);
                }

                ISittingPostureCreator parent = data2.Container.Parent as ISittingPostureCreator;
                if (parent != null)
                {
                    posture2 = parent.CreatePosture(data2.Container, Actor, smc, data2);
                }
                else
                {
                    posture2 = new SittingPosture(data2.Container, Actor, smc, data2);
                }

                if (smc.HasActorDefinition("surface"))
                {
                    smc.SetActor("surface", data2.Container);
                }

                BeginCommodityUpdates();
                Actor.LookAtManager.DisableLookAts();
                bool flag = (Actor.CarryStateMachine != null) && (Actor.GetObjectInRightHand() is IUseCarrySitTransitions);
                if (flag)
                {
                    Actor.CarryStateMachine.RequestState(false, "x", "CarrySitting");
                }

                Definition definition = InteractionDefinition as Definition;
                if (!SaunaClassicEx.StateMachineEnterAndSit(sittable as SaunaClassic, definition.mForWoohoo, smc, posture2, slot2, obj2))
                {
                    if (flag)
                    {
                        Actor.CarryStateMachine.RequestState(false, "x", "Carry");
                    }
                    Actor.LookAtManager.EnableLookAts();
                    Actor.AddExitReason(ExitReason.NullValueFound);
                    SittingHelpers.UnreserveSittable(this, sittable, data2);
                    EndCommodityUpdates(false);
                    return(false);
                }

                Actor.LookAtManager.EnableLookAts();
                Actor.Posture = posture2;
                if (sittable.ComfyScore > 0x0)
                {
                    Actor.BuffManager.AddElement(BuffNames.Comfy, sittable.ComfyScore, Origin.FromComfyObject);
                }

                EndCommodityUpdates(true);
                StandardExit(false, false);
                if (Actor.HasExitReason(ExitReason.UserCanceled))
                {
                    Actor.AddExitReason(ExitReason.CancelledByPosture);
                }

                if (mIsMaster)
                {
                    SaunaSit linked = LinkedInteractionInstance as SaunaSit;
                    if (linked != null)
                    {
                        Sim linkedActor = linked.Actor;

                        while (!Cancelled)
                        {
                            if (!linkedActor.InteractionQueue.HasInteraction(linked))
                            {
                                break;
                            }

                            if (linked.mCompleted)
                            {
                                break;
                            }

                            SpeedTrap.Sleep(10);
                        }
                    }
                }

                return(!Actor.HasExitReason());
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #28
0
        public override bool Run()
        {
            try
            {
                if (Responder.Instance.TutorialModel.IsTutorialRunning())
                {
                    if (!Target.CancelTutorial())
                    {
                        return(false);
                    }
                    Responder.Instance.TutorialModel.ForceExitTutorial();
                }

                if (Target.IsBroken)
                {
                    return(false);
                }

                if (!PreTimeTravel1(this))
                {
                    return(false);
                }

                int num;
                if (!Actor.RouteToSlotListAndCheckInUse(Target, TimePortal.kRoutingSlots, out num))
                {
                    return(false);
                }

                if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    return(false);
                }

                if (!PreTimeTravel2(this))
                {
                    return(false);
                }

                EnterStateMachine("timeportal", "Enter", "x", "portal");
                AddPersistentScriptEventHandler(0xc9, CameraShakeEvent);

                Skill futureSkill = Actor.SkillManager.AddElement(SkillNames.Future);
                if (futureSkill.SkillLevel >= 0x3)
                {
                    AnimateSim("Jump In");
                }
                else
                {
                    AnimateSim("Apprehensive");
                }

                bool succeeded = true;
                if (!GameUtils.IsFutureWorld())
                {
                    // Custom
                    succeeded = TimePortalEx.TravelToFuture(Target, Actor, new List <Sim>(), new List <ulong>());
                    if (!succeeded)
                    {
                        SpeedTrap.Sleep(0x3c);
                        AnimateSim("Spit Out");
                        Target.SwitchActiveState();
                    }
                }

                if (!PostTimeTravel1(this, succeeded))
                {
                    return(false);
                }

                AnimateSim("Exit");

                EndCommodityUpdates(succeeded);
                StandardExit();
                if (GameUtils.IsFutureWorld())
                {
                    EventTracker.SendEvent(EventTypeId.kTravelToPresent, Actor);
                    Target.StopActiveFX();

                    // Custom
                    GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld();
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            finally
            {
                TravelUtil.PlayerMadeTravelRequest = false;
                //Sims3.Gameplay.Gameflow.Singleton.EnableSave(this);
            }

            return(false);
        }
Example #29
0
        public override bool Run()
        {
            try
            {
                if (!IntroTutorial.IsRunning || IntroTutorial.AreYouExitingTutorial())
                {
                    SocialJig = GlobalFunctions.CreateObjectOutOfWorld("horseMountDismountJig", ProductVersion.EP5) as SocialJig;
                    SocialJig.RegisterParticipants(Actor, Target);
                    bool succeeded = false;
                    if (!BeginSocialInteraction(new SocialInteractionB.Definition(null, Saddle.LocalizeString(Target.IsFemale, "HaveOutfitEdited", new object[0x0]), false), true, false))
                    {
                        return(succeeded);
                    }
                    StandardEntry();
                    if (Responder.Instance.OptionsModel.SaveGameInProgress)
                    {
                        BeginCommodityUpdates();
                        EndCommodityUpdates(true);
                        StandardExit();
                        return(true);
                    }
                    mTookSemaphore = GameStates.WaitForInteractionStateChangeSemaphore(Target, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                    if (!mTookSemaphore)
                    {
                        StandardExit();
                        return(false);
                    }
                    if (Target.IsSelectable)
                    {
                        while ((Sims3.Gameplay.Gameflow.CurrentGameSpeed == Sims3.Gameplay.Gameflow.GameSpeed.Pause) || MoveDialog.InProgress())
                        {
                            SpeedTrap.Sleep();
                        }

                        BeginCommodityUpdates();
                        SimDescription simDescription = Target.SimDescription;
                        if (simDescription == null)
                        {
                            throw new Exception("ChangeOutfit:  sim doesn't have a description!");
                        }
                        CASChangeReporter.Instance.ClearChanges();

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

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

                        EndCommodityUpdates(true);

                        /*
                         * if (Target.CurrentOutfitIndex > simDescription.GetOutfitCount(Target.CurrentOutfitCategory))
                         * {
                         *  Target.UpdateOutfitInfo();
                         * }
                         *
                         * (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).NotifySimChanged(Target.ObjectId);
                         */

                        StandardExit();
                        return(true);
                    }
                    StandardExit();
                }
                return(false);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(false);
        }
Example #30
0
        public override bool Run()
        {
            try
            {
                RobotForms form;
                if (!Actor.SimDescription.IsEP11Bot)
                {
                    return(false);
                }
                if (!Actor.RouteToSlotAndCheckInUse(Target, BotMakingStation.kBotPodRoutingSlot))
                {
                    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);
                }
                mCurrentStateMachine.RequestState(true, "x", "OpenDoor");
                CancellableByPlayer = false;
                AnimateSim("StayOpen");
                if (!Target.RouteInsidePod(Actor))
                {
                    AnimateSim("ExitBotOnly");
                    EndCommodityUpdates(true);
                    StandardExit();
                    return(false);
                }
                if (Actor.HasExitReason(ExitReason.CancelExternal))
                {
                    AnimateSim("ExitBotOnly");
                    StandardExit();
                    return(false);
                }

                AnimateSim("CustomizeSelf");
                CASChangeReporter.Instance.ClearChanges();
                SimDescription simDescription = Actor.SimDescription;
                try
                {
                    new Sims.Advanced.EditInCAS(false).Perform(new GameHitParameters <GameObject>(Actor, Actor, GameObjectHit.NoHit));

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

                    CASChangeReporter.Instance.SendChangedEvents(Actor);
                    CASChangeReporter.Instance.ClearChanges();
                    if (!CASChangeReporter.Instance.CasCancelled)
                    {
                        Actor.ModifyFunds(-BotMakingStation.kCostToCustomizeServoBot);
                    }

                    (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).NotifySimChanged(Actor.ObjectId);
                    AnimateSim("ExitBotOnly");
                }
                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);
        }