Exemplo n.º 1
0
 public override bool Run()
 {
     IntroTutorial.StartGameplayTutorial(Actor);
     Actor.Motives.MaxEverything();
     //SpeedTrap.Sleep(0u);
     IntroTutorial.ForceExitTutorial();
     return(true);
 }
Exemplo n.º 2
0
 public override bool Run()
 {
     IntroTutorial.StartGameplayTutorial(Actor);
     if (Actor.Motives != null)
     {
         Actor.Motives.MaxEverything();
     }
     IntroTutorial.ForceExitTutorial();
     return(true);
 }
Exemplo n.º 3
0
        public static bool EnrollInAcademicCareer(Sim actor, IEnumerable <SimDescription> choices, out List <SimDescription> others, out int tuitionCost)
        {
            others      = null;
            tuitionCost = 0;
            if (!IntroTutorial.IsRunning || IntroTutorial.AreYouExitingTutorial())
            {
                if ((actor.DegreeManager != null) && actor.DegreeManager.ShouldDisplaySUATMessage(actor.SimDescription))
                {
                    SimpleMessageDialog.Show(Localization.LocalizeString("Gameplay/Objects/Electronics/Phone:HaveYouTakenSUAT", new object[0]), Localization.LocalizeString("Gameplay/Objects/Electronics/Phone:SUATBenefits", new object[0]), ModalDialog.PauseMode.PauseSimulator);
                }

                if (!UIUtils.IsOkayToStartModalDialog())
                {
                    return(false);
                }

                int termLen   = 0;
                int totalCost = 0;
                List <IEnrollmentData> list = EnrollmentDialogEx.Show(actor.SimDescription, choices, false, out termLen, out totalCost);
                if ((list != null) && (list.Count > 0))
                {
                    TravelUtil.PlayerMadeTravelRequest = true;
                    foreach (IEnrollmentData data in list)
                    {
                        SimDescription enrollingSimDesc = data.EnrollingSimDesc as SimDescription;
                        if (((enrollingSimDesc != null) && (enrollingSimDesc.CareerManager != null)) && (enrollingSimDesc.CareerManager.DegreeManager != null))
                        {
                            if (others == null)
                            {
                                others = new List <SimDescription>();
                            }
                            others.Add(enrollingSimDesc);
                            enrollingSimDesc.CareerManager.DegreeManager.SetEnrollmentData(data);
                            EventTracker.SendEvent(new AcademicEvent(EventTypeId.kEnrolledInUniversity, enrollingSimDesc.CreatedSim, (AcademicDegreeNames)data.AcademicDegreeName));
                        }
                    }
                    tuitionCost = -totalCost;

                    AcademicCareer.GlobalTermLength = (AcademicCareer.TermLength)termLen;
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 4
0
        public override Phone.Call.ConversationBehavior OnCallConnected()
        {
            try
            {
                if ((!IntroTutorial.IsRunning || IntroTutorial.AreYouExitingTutorial()) && Helpers.TravelUtilEx.ShowTravelToVacationWorldDialog(Actor, out mResult))
                {
                    return(Phone.Call.ConversationBehavior.TalkBriefly);
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(Phone.Call.ConversationBehavior.JustHangUp);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public override bool Run()
        {
            try
            {
                if (IntroTutorial.IsRunning && !IntroTutorial.AreYouExitingTutorial())
                {
                    return(false);
                }
                if (GameStates.IsCurrentlySwitchingSubStates)
                {
                    return(false);
                }
                Sim target = Target;
                if (target == null)
                {
                    throw new Exception("EditSimInCAS: Cannot edit a non-sim!");
                }

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

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

                ResortExpenseDialog.SwitchToCAS();

                try
                {
                    new Sims.Stylist(Sims.CASBase.EditType.Uniform).Perform(new GameHitParameters <GameObject>(target, target, GameObjectHit.NoHit));

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

                    if (!CASChangeReporter.Instance.CasCancelled)
                    {
                        ResortWorker service = target.Service as ResortWorker;
                        if (service != null)
                        {
                            service.SetIsUsingCustomUniform(target.SimDescription.SimDescriptionId);
                        }
                        else
                        {
                            ResortMaintenance maintenance = target.Service as ResortMaintenance;
                            if (maintenance != null)
                            {
                                ServiceSituation situationOfType = target.GetSituationOfType <ServiceSituation>();
                                if (situationOfType != null)
                                {
                                    maintenance.SetWorkerOutfit(target.SimDescription, situationOfType.Lot.LotId, target.SimDescription.GetOutfit(OutfitCategories.Career, 0));
                                }
                            }
                        }
                    }
                    CASChangeReporter.Instance.ClearChanges();
                }
                finally
                {
                    ResortExpenseDialog.SwitchFromCAS();
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(false);
        }
Exemplo n.º 8
0
        public static bool Show(IMovingModel model)
        {
            if (IntroTutorial.IsRunning && !IntroTutorial.AreYouExitingTutorial())
            {
                return(false);
            }

            if (ScreenGrabController.InProgress || VideoGrabHelper.InUse)
            {
                return(false);
            }

            UserToolUtils.OnClose();
            Sims3.Gameplay.UI.Responder.Instance.HudModel.CloseSecondaryInventory();
            PopupMenu.CloseOptions();
            Tutorialette.TriggerLesson(Lessons.Moving, null);
            List <IMapTagPickerInfo> mapTagPickerInfos = null;
            string titleText   = Localization.LocalizeString("Ui/Caption/MovingDialog:ChooseLocation", new object[0]);
            string confirmText = Localization.LocalizeString("Ui/Caption/MovingDialog:ChooseConfirm", new object[0]);

            MoveDialogBase.Result running = MoveDialogBase.Result.Running;
            ulong         maxValue        = ulong.MaxValue;
            HouseboatSize houseboatSize   = HouseboatSize.None;

            if (!MoveDialog.Show(model))
            {
                return(false);
            }

            SceneMgrWindow sceneWindow = UIManager.GetSceneWindow();

            if (sceneWindow != null)
            {
                sceneWindow.StopForwardingAllEvents();
            }

            do
            {
                switch (running)
                {
                case MoveDialogBase.Result.LotSelect:
                case MoveDialogBase.Result.HouseSelect:
                case MoveDialogBase.Result.LotAndHouseSelect:
                case MoveDialogBase.Result.PortSelect:
                    running = MoveDialog.RunWithPickedLot(maxValue, houseboatSize);
                    break;

                default:
                    running = MoveDialog.Run();
                    break;
                }

                switch (running)
                {
                case MoveDialogBase.Result.LotSelect:
                case MoveDialogBase.Result.HouseSelect:
                case MoveDialogBase.Result.LotAndHouseSelect:
                case MoveDialogBase.Result.PortSelect:
                    if (mapTagPickerInfos == null)
                    {
                        mapTagPickerInfos = new List <IMapTagPickerInfo>();
                    }
                    else
                    {
                        mapTagPickerInfos.Clear();
                    }

                    bool isSource = model.SourceIsSelectedHousehold();
                    int  householdBuyingPowerFunds = model.GetHouseholdBuyingPowerFunds(isSource);
                    bool flag3 = true;
                    if (running == MoveDialogBase.Result.PortSelect)
                    {
                        flag3 = ChangeHouseboatDialog.Show(false, ref houseboatSize, true);
                    }

                    if (flag3)
                    {
                        foreach (Lot lot in LotManager.AllLots)
                        {
                            if ((!lot.IsWorldLot && lot.IsResidentialLot) && (lot.IsApartmentLot || (lot.Household == null)))
                            {
                                if (running == MoveDialogBase.Result.PortSelect)
                                {
                                    if ((lot.CommercialLotSubType == CommercialLotSubType.kEP10_Port) && lot.IsUnoccupiedPortLot())
                                    {
                                        HouseboatInfo info = HouseboatUtils.GetInfo(houseboatSize);
                                        MovingToPortMapTagPickerLotInfo item = new MovingToPortMapTagPickerLotInfo(lot, MapTagType.PortLot, info.Price);
                                        mapTagPickerInfos.Add(item);
                                    }
                                }
                                else if (((!lot.IsWorldLot && lot.IsResidentialLot) && (lot.ResidentialLotSubType != ResidentialLotSubType.kEP10_PrivateLot)) && ((lot.IsApartmentLot || (lot.Household == null)) && !UnchartedIslandMarker.DoesLotHaveUnchartedIslandMarker(lot)))
                                {
                                    if (lot.IsApartmentLot)
                                    {
                                        if ((running == MoveDialogBase.Result.HouseSelect) && ((lot.Household == null) || !model.HouseholdIsSource(lot.Household.HouseholdId)))
                                        {
                                            MapTagPickerLotInfo item = new MapTagPickerLotInfo(lot, MapTagType.Apartment);
                                            mapTagPickerInfos.Add(item);
                                        }
                                    }
                                    else if (World.LotIsEmpty(lot.LotId) && lot.IsLotEmptyFromObjects())
                                    {
                                        if (running != MoveDialogBase.Result.HouseSelect)
                                        {
                                            MapTagPickerLotInfo info;

                                            // Custom
                                            if (Mover.GetLotCost(lot) <= householdBuyingPowerFunds)
                                            {
                                                info = new MapTagPickerLotInfo(lot, MapTagType.AvailableEmptyLot);
                                            }
                                            else
                                            {
                                                info = new MapTagPickerLotInfo(lot, MapTagType.UnavailableEmptyLot);
                                            }

                                            mapTagPickerInfos.Add(info);
                                        }
                                    }
                                    else if (running != MoveDialogBase.Result.LotSelect)
                                    {
                                        MapTagPickerLotInfo info2;

                                        // Custom
                                        if (Mover.GetLotCost(lot) <= householdBuyingPowerFunds)
                                        {
                                            info2 = new MapTagPickerLotInfo(lot, MapTagType.AvailableEmptyHouse);
                                        }
                                        else
                                        {
                                            info2 = new MapTagPickerLotInfo(lot, MapTagType.UnavailableEmptyHouse);
                                        }
                                        mapTagPickerInfos.Add(info2);
                                    }
                                }
                            }
                        }
                    }
                    IMapTagPickerInfo info3 = null;

                    if (flag3)
                    {
                        bool flag4;
                        info3 = MapTagPickerDialog.Show(mapTagPickerInfos, titleText, confirmText, null, false, 0f, false, out flag4);
                    }
                    if (info3 != null)
                    {
                        maxValue = info3.LotId;
                    }
                    break;
                }
            }while ((running != MoveDialogBase.Result.Accepted) && (running != MoveDialogBase.Result.Cancelled));

            if (sceneWindow != null)
            {
                sceneWindow.StartForwardingEventsToGame();
            }

            MoveDialog.Shutdown();
            return(running == MoveDialogBase.Result.Accepted);
        }
Exemplo n.º 9
0
        public override bool Run()
        {
            try
            {
                if (Actor.IsHuman)
                {
                    InteractionInstance entry = Singleton.CreateInstance(Target, Target, GetPriority(), false, true);
                    return(Target.InteractionQueue.Add(entry));
                }
                if (!IntroTutorial.IsRunning || IntroTutorial.AreYouExitingTutorial())
                {
                    if (Responder.Instance.OptionsModel.SaveGameInProgress)
                    {
                        return(false);
                    }
                    mTookSemaphore = GameStates.WaitForInteractionStateChangeSemaphore(Actor, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                    if (!mTookSemaphore)
                    {
                        return(false);
                    }
                    if (Actor.IsSelectable)
                    {
                        while ((Sims3.Gameplay.Gameflow.CurrentGameSpeed == Sims3.Gameplay.Gameflow.GameSpeed.Pause) || MoveDialog.InProgress())
                        {
                            SpeedTrap.Sleep();
                        }

                        BeginCommodityUpdates();
                        SimDescription simDescription = Actor.SimDescription;
                        if (simDescription == null)
                        {
                            throw new Exception("CustomizeCollarAndCoats: 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);

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

            return(false);
        }
Exemplo n.º 10
0
        public static bool Perform(SimDescription me, SimDescription.DeathType deathType)
        {
            if (me == null)
            {
                return(false);
            }

            Sim createdSim = me.CreatedSim;

            if (createdSim == PlumbBob.SelectedActor)
            {
                IntroTutorial.ForceExitTutorial();
                LotManager.SelectNextSim();
            }

            if (createdSim != null)
            {
                createdSim = Households.Reset.ResetSim(createdSim, false);

                if ((createdSim != null) && (createdSim.BuffManager != null))
                {
                    createdSim.BuffManager.RemoveAllElements();
                }
            }

            Urnstone urnstone = Urnstones.CreateGrave(me, deathType, true, true);

            if (urnstone == null)
            {
                SimpleMessageDialog.Show(Common.Localize("ForceKill:MenuName"), Common.Localize("ForceKill:Error"));
                return(false);
            }

            if (createdSim != null)
            {
                if ((createdSim.Autonomy != null) &&
                    (createdSim.Autonomy.SituationComponent != null))
                {
                    List <Situation> situations = new List <Situation>(createdSim.Autonomy.SituationComponent.Situations);
                    foreach (Situation situation in situations)
                    {
                        situation.Exit();
                    }
                }

                if (createdSim.LotCurrent != null)
                {
                    Lot lotCurrent = createdSim.LotCurrent;
                    lotCurrent.LastDiedSim = me;
                    lotCurrent.NumDeathsOnLot++;
                }

                if (createdSim.InteractionQueue != null)
                {
                    createdSim.InteractionQueue.CancelAllInteractions();
                }

                urnstone.GhostCleanup(createdSim, true);

                createdSim.Destroy();
            }

            return(true);
        }
Exemplo n.º 11
0
        public override bool Run()
        {
            try
            {
                if (!IntroTutorial.IsRunning || IntroTutorial.AreYouExitingTutorial())
                {
                    if (!Target.RouteAndOpenDrawer(this, Actor))
                    {
                        return(false);
                    }
                    if (Responder.Instance.OptionsModel.SaveGameInProgress)
                    {
                        BeginCommodityUpdates();
                        bool succeeded = Target.CloseDrawerAndExit(this, Actor);
                        EndCommodityUpdates(succeeded);
                        return(succeeded);
                    }

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

                    if (Actor.IsSelectable)
                    {
                        while ((Sims3.Gameplay.Gameflow.CurrentGameSpeed == Sims3.Gameplay.Gameflow.GameSpeed.Pause) || MoveDialog.InProgress())
                        {
                            SpeedTrap.Sleep();
                        }

                        BeginCommodityUpdates();

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

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

                        bool flag2 = Target.CloseDrawerAndExit(this, Actor);
                        Actor.InteractionQueue.CancelAllInteractionsByType(Dresser.ChangeClothes.Singleton);

                        EndCommodityUpdates(flag2);

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

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

            return(false);
        }
Exemplo n.º 12
0
        public bool CleansingKill(SimDescription sim, SimDescription.DeathType deathType, bool cleanse)
        {
            AddTry("CleansingKill");

            if (!GameStates.IsLiveState)
            {
                IncStat("CleansingKill Mode Save");
                return(false);
            }

            string name = sim.FullName;

            if (cleanse)
            {
                Annihilation.CleanseGenealogy(sim);

                SetCleansed(sim);
            }

            bool bSuccess = false;

            Sim createdSim = sim.CreatedSim;

            if (createdSim != null)
            {
                try
                {
                    if (createdSim.InteractionQueue != null)
                    {
                        createdSim.InteractionQueue.CancelAllInteractions();

                        SpeedTrap.Sleep();
                    }

                    if ((deathType != SimDescription.DeathType.None) || (cleanse))
                    {
                        if (createdSim.Kill(deathType))
                        {
                            bSuccess = true;
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.DebugException(createdSim, e);
                }
            }

            if (!bSuccess)
            {
                if (createdSim == PlumbBob.SelectedActor)
                {
                    IntroTutorial.ForceExitTutorial();
                }

                if (Sims == null)
                {
                    AddSuccess("CleansingKill: Destruct Fail");
                    return(false);
                }

                if (!Annihilation.Perform(sim, cleanse))
                {
                    Main.RemoveSim(sim.SimDescriptionId);
                }
                else
                {
                    if (!cleanse)
                    {
                        sim.Dispose(true, false, true);
                    }

                    // Special case to stop HangWithCoworker bounces
                    Careers.RemoveSim(sim.SimDescriptionId);
                }

                bSuccess = true;
            }

            if (bSuccess)
            {
                AddSuccess("CleansingKill: Success");

                IncStat("Killed: " + name, Common.DebugLevel.High);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 13
0
            // Methods
            public override bool Run()
            {
                if (!IntroTutorial.IsRunning || IntroTutorial.AreYouExitingTutorial())
                {
                    if (!RouteAndAnimate(this, base.Actor))
                    {
                        return(false);
                    }

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

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

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

                        logic_ClosingDown(this.Actor);

                        return(flag2);
                    }
                }

                return(false);
            }
Exemplo n.º 14
0
 public void introTutorialTest()
 {
     Assert.AreEqual(1, IntroTutorial.introTutorial(4, new int[] { 1, 4, 5, 7, 9, 12 }));
 }
Exemplo n.º 15
0
        public override bool Run()
        {
            try
            {
                if (IntroTutorial.IsRunning && !IntroTutorial.AreYouExitingTutorial())
                {
                    return(false);
                }

                if (GameStates.IsCurrentlySwitchingSubStates)
                {
                    return(false);
                }

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

                ResortStaffedObjectComponent resortStaffedObjectComponent = Target.ResortStaffedObjectComponent;
                if (Target.ResortStaffedObjectComponent == null)
                {
                    return(false);
                }

                ResortWorker   service        = resortStaffedObjectComponent.GetService();
                SimDescription assignedWorker = service.GetAssignedWorker(Target);
                if (assignedWorker == null)
                {
                    Sim worker = service.GetWorker(Target);
                    if (worker != null)
                    {
                        assignedWorker = worker.SimDescription;
                    }
                }

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

                mTookSemaphore = GameStates.WaitForInteractionStateChangeSemaphore();
                if (!mTookSemaphore)
                {
                    return(false);
                }

                ResortExpenseDialog.SwitchToCAS();

                try
                {
                    new Sims.Stylist(Sims.CASBase.EditType.Uniform).Perform(new GameHitParameters <SimDescriptionObject>(Sim.ActiveActor, new SimDescriptionObject(assignedWorker), GameObjectHit.NoHit));

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

                    if (!CASChangeReporter.Instance.CasCancelled)
                    {
                        service = assignedWorker.Service as ResortWorker;
                        if (service != null)
                        {
                            service.SetIsUsingCustomUniform(assignedWorker.SimDescriptionId);
                        }
                        else
                        {
                            ResortMaintenance maintenance = assignedWorker.Service as ResortMaintenance;
                            if (maintenance != null)
                            {
                                maintenance.SetWorkerOutfit(assignedWorker, Target.LotCurrent.LotId, assignedWorker.GetOutfit(OutfitCategories.Career, 0));
                            }
                        }
                    }
                    CASChangeReporter.Instance.ClearChanges();
                }
                finally
                {
                    ResortExpenseDialog.SwitchFromCAS();
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(false);
        }
        public override bool Run()
        {
            try
            {
                if (!IntroTutorial.IsRunning || IntroTutorial.AreYouExitingTutorial())
                {
                    bool flag = true;
                    if (!Target.RouteToPedestal(Actor, true))
                    {
                        return(false);
                    }

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

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

                    if (Actor.IsSelectable)
                    {
                        while ((Sims3.Gameplay.Gameflow.CurrentGameSpeed == Sims3.Gameplay.Gameflow.GameSpeed.Pause) || MoveDialog.InProgress())
                        {
                            SpeedTrap.Sleep(0x0);
                        }

                        StandardEntry();
                        BeginCommodityUpdates();
                        EnterStateMachine("ShoppingPedestal", "Enter", "x");
                        SetParameter("x:Age", Actor.SimDescription.Age);
                        AnimateSim("Change Item");

                        SimDescription simDesc = Actor.SimDescription;
                        if (Actor.FamilyFunds >= ClothingPedestal.kCostToPlanPurchaseOutfit)
                        {
                            simDesc = Actor.SimDescription;
                            if (simDesc == null)
                            {
                                throw new Exception("ChangeOutfit:  sim doesn't have a description!");
                            }

                            if (GameUtils.IsInstalled(ProductVersion.EP2))
                            {
                                new Sims.Stylist(Sims.CASBase.EditType.None, Target.DisplayCategory).Perform(new GameHitParameters <GameObject>(Actor, Actor, GameObjectHit.NoHit));
                            }
                            else
                            {
                                new Sims.Dresser(Sims.CASBase.EditType.None, Target.DisplayCategory).Perform(new GameHitParameters <GameObject>(Actor, Actor, GameObjectHit.NoHit));
                            }

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

                            if (!CASChangeReporter.Instance.CasCancelled && !Actor.IsOnHomeLot(Target))
                            {
                                simDesc.Household.ModifyFamilyFunds(-ClothingPedestal.kCostToPlanPurchaseOutfit);
                            }
                        }

                        AnimateSim("Exit");
                        EndCommodityUpdates(true);
                        StandardExit();
                        if (Actor.CurrentOutfitIndex > simDesc.GetOutfitCount(Actor.CurrentOutfitCategory))
                        {
                            Actor.UpdateOutfitInfo();
                        }
                        Actor.RecreateOccupationOutfits();
                        (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).NotifySimChanged(Actor.ObjectId);
                        EventTracker.SendEvent(EventTypeId.kBoughtOutfitFromPedestal, Actor, Target);
                        return(flag);
                    }
                }
                return(false);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(false);
        }