Esempio n. 1
0
        public static bool CanSimTriggerTravelToHomeWorld(Sim actor, ref GreyedOutTooltipCallback callback)
        {
            if ((actor == null) || (!GameUtils.IsOnVacation()))
            {
                callback = Common.DebugTooltip("Not Vacation World Type");
                return(false);
            }

            if ((actor.BuffManager != null) && actor.BuffManager.HasTransformBuff())
            {
                callback = new GreyedOutTooltipCallback(new TravelUtil.GreyedOutTooltipHelper(actor, "NoTravelWhileTransformed", true).TextTextAndAway);
                return(false);
            }

            if (GameStates.TravelHousehold != Household.ActiveHousehold)
            {
                callback = delegate
                {
                    return(Common.Localize("TravelHome:NotActive"));
                };
                return(false);
            }

            string failReason = null;

            if (!InWorldSubState.IsEditTownValid(actor.LotHome, ref failReason))
            {
                callback = new GreyedOutTooltipCallback(new TravelUtil.GreyedOutTooltipHelper(actor, "EditTownInvalid", false).TextTextAndAway);
                return(false);
            }

            return(true);
        }
Esempio n. 2
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();
        }
 public static void TriggerLesson(Lessons lesson, Sim sim)
 {
     if (!IntroTutorial.IsRunning && !Sims3.SimIFace.Environment.HasEditInGameModeSwitch && Tutorialette.AreTutorialTipsEnabled())
     {
         InWorldSubState inWorldSubState = GameStates.GetInWorldSubState();
         if (inWorldSubState != null)
         {
             string stateName = inWorldSubState.StateName;
             if (stateName != "Play Flow" && Tutorialette.IsValidLesson(lesson, sim))
             {
                 TutorialetteNotification.Show(Tutorialette.sLessonTnsKeys[lesson].LessonTnsKey, (int)lesson);
             }
         }
     }
 }
Esempio n. 4
0
        public override Phone.Call.ConversationBehavior OnCallConnected()
        {
            try
            {
                if (UIUtils.IsOkayToStartModalDialog())
                {
                    string failReason = null;
                    if (((Actor.Household == Household.ActiveHousehold) && !MovingSituation.MovingInProgress) && InWorldSubState.IsEditTownValid(Actor.LotHome, ref failReason))
                    {
                        Definition interactionDefinition = InteractionDefinition as Definition;
                        if (interactionDefinition.LocalMove)
                        {
                            if (!Household.ActiveHousehold.LotHome.IsApartmentLot && (Household.ActiveHousehold.GetNumberOfRoommates() > 0))
                            {
                                if (!TwoButtonDialog.Show(Localization.LocalizeString("Ui/Caption/Roommates:MovingDismissConfirmation", new object[0]), LocalizationHelper.Yes, LocalizationHelper.No))
                                {
                                    return(Phone.Call.ConversationBehavior.JustHangUp);
                                }

                                Household.RoommateManager.StopAcceptingRoommates(true);
                            }

                            MovingDialogEx.Show(new GameplayMovingModelEx(Actor));
                        }
                        else
                        {
                            MovingWorldsModel model = new MovingWorldsModel(Actor);
                            MovingWorldDialog.Show(model);
                            if ((model.WorldName != null) && MovingWorldUtil.VerifyWorldMove())
                            {
                                Common.FunctionTask.Perform(model.TriggerSaveAndTravel);
                            }
                        }
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            return(Phone.Call.ConversationBehavior.JustHangUp);
        }
Esempio n. 5
0
        public override bool Run()
        {
            try
            {
                if (!Target.StartComputing(this, SurfaceHeight.Table, true))
                {
                    return(false);
                }

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

                Target.StartVideo(Computer.VideoType.Browse);
                AnimateSim("GenericTyping");

                string failReason = null;
                if (((Actor.Household == Household.ActiveHousehold) && !MovingSituation.MovingInProgress) && InWorldSubState.IsEditTownValid(Actor.LotHome, ref failReason))
                {
                    Definition interactionDefinition = InteractionDefinition as Definition;
                    if (interactionDefinition.LocalMove)
                    {
                        if (!Household.ActiveHousehold.LotHome.IsApartmentLot && (Household.ActiveHousehold.GetNumberOfRoommates() > 0))
                        {
                            if (!TwoButtonDialog.Show(Localization.LocalizeString("Ui/Caption/Roommates:MovingDismissConfirmation", new object[0]), LocalizationHelper.Yes, LocalizationHelper.No))
                            {
                                Target.StopComputing(this, Computer.StopComputingAction.TurnOff, false);
                                return(true);
                            }

                            Household.RoommateManager.StopAcceptingRoommates(true);
                        }

                        MovingDialogEx.Show(new GameplayMovingModelEx(Actor));
                    }
                    else
                    {
                        MovingWorldsModel model = new MovingWorldsModel(Actor);
                        MovingWorldDialog.Show(model);
                        if ((model.WorldName != null) && MovingWorldUtil.VerifyWorldMove())
                        {
                            Common.FunctionTask.Perform(model.TriggerSaveAndTravel);
                        }
                    }
                }

                Target.StopComputing(this, Computer.StopComputingAction.TurnOff, false);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Esempio n. 6
0
        public static void PlaceLotWizardCheck(InWorldSubState ths)
        {
            try
            {
                if ((GameStates.IsNewGame) && (GameStates.HasTravelData) && (!WorldData.IsPreviousWorld()))
                {
                    WorldData.SetPreviousWorld();

                    WorldName currentWorld = GameUtils.GetCurrentWorld();

                    switch (currentWorld)
                    {
                        case WorldName.China:
                        case WorldName.Egypt:
                        case WorldName.France:
                            break;
                        default:
                            if ((GameStates.sSingleton != null) && (GameStates.sSingleton.mInWorldState != null) && (GameStates.sSingleton.mInWorldState.mSubStates[0xb] != null))
                            {
                                bool isChangingWorlds = GameStates.sIsChangingWorlds;

                                WorldType currentWorldType = GameUtils.GetCurrentWorldType();

                                try
                                {
                                    GameUtils.WorldNameToType.Remove(currentWorld);
                                    GameUtils.WorldNameToType.Add(currentWorld, WorldType.Base);

                                    GameStates.sIsChangingWorlds = false;

                                    BinModel.Singleton.PopulateExportBin();

                                    EditTownModel.ClearPlaceLotsWizardFlags();

                                    Dictionary<CommercialLotSubType, string> lotTypesToPrompt = EditTownModel.LotTypesToPrompt;

                                    if (lotTypesToPrompt.Count != 0x0)
                                    {
                                        if (BinModel.Singleton.IsClear())
                                        {
                                            BinModel.Singleton.PopulateExportBin();
                                        }

                                        string promptText = Common.LocalizeEAString("Ui/Caption/GameEntry/PlaceEPLotsWizard:EnterPrompt") + '\n';

                                        try
                                        {
                                            InWorldSubState.AutoVenuPlacementData.Parse();

                                            foreach (KeyValuePair<CommercialLotSubType, string> pair in lotTypesToPrompt)
                                            {
                                                promptText = promptText + '\n' + pair.Value;
                                                if (InWorldSubState.AutoVenuPlacementData.HasPlacementDataForWorldName(World.GetWorldFileName()))
                                                {
                                                    UIBinInfo lotToPlaceInfo = null;
                                                    UIBinInfo targetLotInfo = null;
                                                    LotRotationAngle kLotRotateAuto = LotRotationAngle.kLotRotateAuto;
                                                    List<IExportBinContents> exportBinContents = BinModel.Singleton.ExportBinContents;
                                                    if (ths.FindRequiredEPVenuePlacementInfo(pair.Key, exportBinContents, out lotToPlaceInfo, out targetLotInfo, out kLotRotateAuto))
                                                    {
                                                        EditTownModel.AddForcedLocationLotToPlace(pair.Key, lotToPlaceInfo, targetLotInfo, kLotRotateAuto);
                                                    }
                                                }
                                            }
                                        }
                                        finally
                                        {
                                            InWorldSubState.AutoVenuPlacementData.Shutdown();
                                        }

                                        if (TwoButtonDialog.Show(promptText, Common.LocalizeEAString("Ui/Caption/GameEntry/PlaceEPLotsWizard:Accept"), Common.LocalizeEAString("Ui/Caption/GameEntry/PlaceEPLotsWizard:Decline")))
                                        {
                                            GameStates.sSingleton.mInWorldState.mSubStates[0xb].PlaceRequiredEPVenues();
                                        }
                                    }
                                }
                                finally
                                {
                                    GameStates.sIsChangingWorlds = isChangingWorlds;

                                    GameUtils.WorldNameToType.Remove(currentWorld);
                                    GameUtils.WorldNameToType.Add(currentWorld, currentWorldType);
                                }
                            }
                            break;
                    }
                }
                else
                {
                    ths.PlaceLotWizardCheck();
                }
            }
            catch (Exception e)
            {
                Common.Exception("PlaceLotWizardCheck", e);
            }
        }
Esempio n. 7
0
        public static void OnMarried(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                string failReason = null;
                if ((actor.Household == target.Household) || (!MovingSituation.MovingInProgress && ((Household.ActiveHousehold == null) || InWorldSubState.IsEditTownValid(Household.ActiveHousehold.LotHome, ref failReason))))
                {
                    Sim         actorSim;
                    Sim         targetSim;
                    BuffManager actorBuffManager  = actor.BuffManager;
                    BuffManager targetBuffManager = target.BuffManager;

                    actorBuffManager.AddElement(BuffNames.JustMarried, Origin.FromSocialization);
                    targetBuffManager.AddElement(BuffNames.JustMarried, Origin.FromSocialization);

                    BuffJustMarried.BuffInstanceJustMarried element = actorBuffManager.GetElement(BuffNames.JustMarried) as BuffJustMarried.BuffInstanceJustMarried;
                    if (element != null)
                    {
                        element.CreateGiftAlarm(actorBuffManager);
                    }

                    actorBuffManager.RemoveElement(BuffNames.NewlyEngaged);
                    actorBuffManager.RemoveElement(BuffNames.ParentsBlessing);
                    targetBuffManager.RemoveElement(BuffNames.NewlyEngaged);
                    targetBuffManager.RemoveElement(BuffNames.ParentsBlessing);

                    ActiveTopic.AddToSim(actor, "Wedding");
                    ActiveTopic.AddToSim(target, "Wedding");
                    Relationship relationship = Relationship.Get(actor, target, true);
                    relationship.LTR.RemoveInteractionBit(LongTermRelationship.InteractionBits.Divorce);
                    relationship.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Marry);
                    if (actor.IsNPC && !target.IsNPC)
                    {
                        actorSim  = target;
                        targetSim = actor;
                    }
                    else if (!actor.IsNPC && target.IsNPC)
                    {
                        actorSim  = actor;
                        targetSim = target;
                    }
                    else
                    {
                        SimDescription proposerDesc = relationship.ProposerDesc;
                        actorSim = (proposerDesc == null) ? null : proposerDesc.CreatedSim;
                        if (actorSim == null)
                        {
                            if (RandomUtil.CoinFlip())
                            {
                                actorSim = actor;
                            }
                            else
                            {
                                actorSim = target;
                            }
                        }

                        targetSim = target;
                        if (actorSim == target)
                        {
                            targetSim = actor;
                        }
                    }

                    SocialCallback.GiveDaysOffIfRequired(actorSim, targetSim);
                    MidlifeCrisisManager.OnBecameMarried(actor.SimDescription, target.SimDescription);

                    relationship.SetMarriedInGame();

                    if (SeasonsManager.Enabled)
                    {
                        relationship.WeddingAnniversary      = new WeddingAnniversary(SeasonsManager.CurrentSeason, (int)SeasonsManager.DaysElapsed);
                        relationship.WeddingAnniversary.SimA = relationship.SimDescriptionA;
                        relationship.WeddingAnniversary.SimB = relationship.SimDescriptionB;
                        relationship.WeddingAnniversary.CreateAlarm();
                    }

                    if (sStoryProgressionHandleMarriageName.Valid)
                    {
                        sStoryProgressionHandleMarriageName.Invoke <bool>(new object[] { actorSim.SimDescription, targetSim.SimDescription });
                    }
                    else
                    {
                        targetSim.SimDescription.LastName = actorSim.SimDescription.LastName;
                        foreach (Genealogy genealogy in targetSim.Genealogy.Children)
                        {
                            SimDescription simDescription = genealogy.SimDescription;
                            if (((simDescription != null) && simDescription.TeenOrBelow) && (simDescription.CreatedSim != null))
                            {
                                simDescription.LastName = actorSim.SimDescription.LastName;
                            }
                        }
                    }

                    actor.Genealogy.Marry(target.Genealogy);
                    OnMoveInWith(actor, target, interaction, topic, i);
                    SocialCallback.EndServiceForActor(actor);
                    SocialCallback.EndServiceForActor(target);

                    actorBuffManager.RemoveElement(BuffNames.MissedWedding);
                    targetBuffManager.RemoveElement(BuffNames.MissedWedding);
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
Esempio n. 8
0
        public override void Startup()
        {
            Common.StringBuilder msg = new Common.StringBuilder("LiveModeStateEx:Startup" + Common.NewLine);
            Traveler.InsanityWriteLog(msg);

            try
            {
                UIManager.BlackBackground(false);

                msg += "A1";
                Traveler.InsanityWriteLog(msg);

                // StateMachineState:Startup()
                mBaseCallFlag |= BaseCallFlag.kStartup;

                // InWorldSubState:Startup()
                while (sDelayNextStateStartupCount > 0x0)
                {
                    SpeedTrap.Sleep();
                }

                msg += "A2";
                Traveler.InsanityWriteLog(msg);

                EventTracker.SendEvent(new InWorldSubStateEvent(this, true));

                //base.Startup();

                msg += "A3";
                Traveler.InsanityWriteLog(msg);

                ShowUI(true);

                if (CameraController.IsMapViewModeEnabled() && !TutorialModel.Singleton.IsTutorialRunning())
                {
                    CameraController.EnableCameraMapView(true);
                }

                msg += "B";
                Traveler.InsanityWriteLog(msg);

                CASExitLoadScreen.Close();

                bool traveling = false;
                if (GameStates.IsTravelling)
                {
                    if (GameStates.sTravelData == null)
                    {
                        GameStates.ClearTravelStatics();
                    }
                    else
                    {
                        traveling = true;
                        GameStatesEx.OnArrivalAtVacationWorld();
                    }
                }

                msg += "C";
                Traveler.InsanityWriteLog(msg);

                if (GameStates.sNextSimToSelect != null)
                {
                    DreamCatcher.SelectNoLotCheckImmediate(GameStates.sNextSimToSelect, true, true);
                    GameStates.sNextSimToSelect = null;
                }

                msg += "D";
                Traveler.InsanityWriteLog(msg);

                bool flag2 = false;
                if (LoadingScreenController.Instance != null)
                {
                    if ((GameStates.IsPerfTestRunning || (CommandLine.FindSwitch("campos") != null)) || (CommandLine.FindSwitch("camtarget") != null))
                    {
                        msg += "D1";
                        Traveler.InsanityWriteLog(msg);

                        GameUtils.EnableSceneDraw(true);
                        LoadingScreenController.Unload();
                    }
                    else if (traveling)
                    {
                        msg += "D2";
                        Traveler.InsanityWriteLog(msg);

                        uint customFlyThroughIndex = CameraController.GetCustomFlyThroughIndex();
                        if (GameStates.IsNewGame && (customFlyThroughIndex != 0x0))
                        {
                            msg += "D3";
                            Traveler.InsanityWriteLog(msg);

                            WaitForLotLoad(true, false);
                            ShowUI(false);
                            ShowMaptags(false);

                            msg += "D4";
                            Traveler.InsanityWriteLog(msg);

                            AudioManager.MusicMode = MusicMode.Flyby;
                            CameraController.OnCameraFlyThroughFinishedCallback += OnCameraFlyThroughFinishedEvent;
                            CameraController.StartFlyThrough(customFlyThroughIndex, false);
                            flag2 = true;

                            msg += "D5";
                            Traveler.InsanityWriteLog(msg);

                            GameUtils.EnableSceneDraw(true);
                            LoadingScreenController.Unload();
                            while (LoadingScreenController.Instance != null)
                            {
                                Sleep(0.0);
                            }
                        }
                        else
                        {
                            msg += "D6";
                            Traveler.InsanityWriteLog(msg);

                            WaitForLotLoad(true, true);
                            Camera.SetView(CameraView.SimView, true, true);
                        }
                    }
                    else
                    {
                        msg += "D7";
                        Traveler.InsanityWriteLog(msg);

                        Camera.RestorePersistedState();

                        msg += "D8";
                        Traveler.InsanityWriteLog(msg);

                        WaitForLotLoad(false, true);
                    }
                }
                else if (traveling)
                {
                    msg += "D9";
                    Traveler.InsanityWriteLog(msg);

                    WaitForLotLoad(!GameUtils.IsUniversityWorld(), true);
                    Camera.SetView(CameraView.SimView, true, true);
                }

                msg += "E";
                Traveler.InsanityWriteLog(msg);

                UserToolUtils.UserToolGeneric(0xc8, new ResourceKey(0x0L, 0x0, 0x0));
                if (!flag2)
                {
                    GameUtils.Unpause();
                }

                if (AudioManager.MusicMode != MusicMode.Flyby)
                {
                    AudioManager.MusicMode = MusicMode.None;
                }

                msg += "F";
                Traveler.InsanityWriteLog(msg);

                InWorldSubState.EdgeScrollCheck();
                InWorldSubState.OpportunityDialogCheck();

                try
                {
                    DreamsAndPromisesManager.ValidateLifetimeWishes();
                }
                catch (Exception e)
                {
                    Common.Exception(msg, e);
                }

                LifeEventManager.ValidatePendingLifeEvents();
                if (GameUtils.IsInstalled(ProductVersion.EP9))
                {
                    Tutorialette.TriggerLesson(Lessons.Degrees, Sim.ActiveActor);
                }

                if (GameUtils.GetCurrentWorldType() == WorldType.Base)
                {
                    Tutorialette.TriggerLesson(Lessons.Traveling, Sim.ActiveActor);
                }

                if (Sims3.Gameplay.ActiveCareer.ActiveCareer.ActiveCareerShowGeneralLesson)
                {
                    Tutorialette.TriggerLesson(Lessons.Professions, Sim.ActiveActor);
                }

                msg += "G";
                Traveler.InsanityWriteLog(msg);

                Tutorialette.TriggerLesson(Lessons.AgingStageLengths, Sim.ActiveActor);

                Sim selectedActor = PlumbBob.SelectedActor;
                if (selectedActor != null)
                {
                    // Custom
                    if (GameStates.sMovingWorldData != null)
                    {
                        WorldData.MergeFromCrossWorldData();
                    }

                    if (selectedActor.LotHome != null)
                    {
                        if (selectedActor.LotHome.HasVirtualResidentialSlots)
                        {
                            Tutorialette.TriggerLesson(Lessons.ApartmentLiving, selectedActor);
                        }
                    }
                    else
                    {
                        Lot lot = Helpers.TravelUtilEx.FindLot();
                        if (lot != null)
                        {
                            lot.MoveIn(selectedActor.Household);

                            foreach (SimDescription sim in Households.All(selectedActor.Household))
                            {
                                if (sim.CreatedSim == null)
                                {
                                    FixInvisibleTask.Perform(sim, false);
                                }
                                else
                                {
                                    bool replace = (sim.CreatedSim == selectedActor);

                                    ResetSimTask.Perform(sim.CreatedSim, false);

                                    if (replace)
                                    {
                                        selectedActor = sim.CreatedSim;
                                    }
                                }
                            }

                            msg += "MoveIn";
                        }
                    }

                    if (selectedActor.Household != null)
                    {
                        foreach (SimDescription description in Households.Humans(selectedActor.Household))
                        {
                            // Custom
                            if (GameStates.sMovingWorldData != null)
                            {
                                CrossWorldControl.Restore(description);
                            }

                            if (description.Child || description.Teen)
                            {
                                Tutorialette.TriggerLesson(Lessons.Pranks, null);
                                break;
                            }
                        }
                    }

                    if (selectedActor.BuffManager != null)
                    {
                        BuffMummysCurse.BuffInstanceMummysCurse element = selectedActor.BuffManager.GetElement(BuffNames.MummysCurse) as BuffMummysCurse.BuffInstanceMummysCurse;
                        if (element != null)
                        {
                            BuffMummysCurse.SetCursedScreenFX(element.CurseStage, false);
                        }
                    }

                    if (selectedActor.CareerManager != null)
                    {
                        selectedActor.CareerManager.UpdateCareerUI();
                    }

                    if (Traveler.Settings.mAllowSpawnWeatherStone && GameUtils.IsInstalled(ProductVersion.EP7) && GameUtils.IsInstalled(ProductVersion.EP8))
                    {
                        Sims3.Gameplay.UI.Responder.Instance.TrySpawnWeatherStone();
                    }
                }

                msg += "H";
                Traveler.InsanityWriteLog(msg);

                // Custom
                if (GameStates.sMovingWorldData != null)
                {
                    GameStatesEx.UpdateMiniSims(GameStatesEx.GetAllSims());

                    foreach (SimDescription sim in Households.All(Household.ActiveHousehold))
                    {
                        MiniSimDescription miniSim = MiniSimDescription.Find(sim.SimDescriptionId);
                        if (miniSim != null)
                        {
                            miniSim.Instantiated = true;
                            if (miniSim.HomeWorld != GameUtils.GetCurrentWorld())
                            {
                                miniSim.HomeWorld = GameUtils.GetCurrentWorld();
                            }
                        }

                        if (sim.HomeWorld != GameUtils.GetCurrentWorld())
                        {
                            sim.HomeWorld = GameUtils.GetCurrentWorld();
                        }
                    }
                }

                GameStates.SetupPostMoveData();
                GameStates.ClearMovingData();
                MovingWorldsWizardCheck();

                // Custom
                Household.IsTravelImport = false;

                InWorldSubStateEx.PlaceLotWizardCheck(this);

                msg += "I";
                Traveler.InsanityWriteLog(msg);

                foreach (Sim sim in LotManager.Actors)
                {
                    try
                    {
                        if (sim.HasBeenDestroyed)
                        {
                            continue;
                        }

                        OccultManager occultManager = sim.OccultManager;
                        if (occultManager != null)
                        {
                            occultManager.RestoreOccultIfNecessary();
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(sim, null, msg, e);
                    }
                }

                msg += "J";
                Traveler.InsanityWriteLog(msg);

                // Custom
                foreach (SimDescription description in SimListing.GetResidents(false).Values)
                {
                    if (description.LotHome == null)
                    {
                        continue;
                    }

                    MiniSimDescription miniSimDescription = description.GetMiniSimDescription();
                    if (miniSimDescription != null)
                    {
                        miniSimDescription.LotHomeId = description.LotHome.LotId;
                    }
                }

                msg += "K";
                Traveler.InsanityWriteLog(msg);
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
            finally
            {
                CASExitLoadScreen.Close();
            }
        }
Esempio n. 9
0
        public static void PlaceLotWizardCheck(InWorldSubState ths)
        {
            try
            {
                if ((GameStates.IsNewGame) && (GameStates.HasTravelData) && (!WorldData.IsPreviousWorld()))
                {
                    WorldData.SetPreviousWorld();

                    WorldName currentWorld = GameUtils.GetCurrentWorld();

                    switch (currentWorld)
                    {
                    case WorldName.China:
                    case WorldName.Egypt:
                    case WorldName.France:
                        break;

                    default:
                        if ((GameStates.sSingleton != null) && (GameStates.sSingleton.mInWorldState != null) && (GameStates.sSingleton.mInWorldState.mSubStates[0xb] != null))
                        {
                            bool isChangingWorlds = GameStates.sIsChangingWorlds;

                            WorldType currentWorldType = GameUtils.GetCurrentWorldType();

                            try
                            {
                                GameUtils.WorldNameToType.Remove(currentWorld);
                                GameUtils.WorldNameToType.Add(currentWorld, WorldType.Base);

                                GameStates.sIsChangingWorlds = false;

                                BinModel.Singleton.PopulateExportBin();

                                EditTownModel.ClearPlaceLotsWizardFlags();

                                Dictionary <CommercialLotSubType, string> lotTypesToPrompt = EditTownModel.LotTypesToPrompt;

                                if (lotTypesToPrompt.Count != 0x0)
                                {
                                    if (BinModel.Singleton.IsClear())
                                    {
                                        BinModel.Singleton.PopulateExportBin();
                                    }

                                    string promptText = Common.LocalizeEAString("Ui/Caption/GameEntry/PlaceEPLotsWizard:EnterPrompt") + '\n';

                                    try
                                    {
                                        InWorldSubState.AutoVenuPlacementData.Parse();

                                        foreach (KeyValuePair <CommercialLotSubType, string> pair in lotTypesToPrompt)
                                        {
                                            promptText = promptText + '\n' + pair.Value;
                                            if (InWorldSubState.AutoVenuPlacementData.HasPlacementDataForWorldName(World.GetWorldFileName()))
                                            {
                                                UIBinInfo                 lotToPlaceInfo    = null;
                                                UIBinInfo                 targetLotInfo     = null;
                                                LotRotationAngle          kLotRotateAuto    = LotRotationAngle.kLotRotateAuto;
                                                List <IExportBinContents> exportBinContents = BinModel.Singleton.ExportBinContents;
                                                if (ths.FindRequiredEPVenuePlacementInfo(pair.Key, exportBinContents, out lotToPlaceInfo, out targetLotInfo, out kLotRotateAuto))
                                                {
                                                    EditTownModel.AddForcedLocationLotToPlace(pair.Key, lotToPlaceInfo, targetLotInfo, kLotRotateAuto);
                                                }
                                            }
                                        }
                                    }
                                    finally
                                    {
                                        InWorldSubState.AutoVenuPlacementData.Shutdown();
                                    }

                                    if (TwoButtonDialog.Show(promptText, Common.LocalizeEAString("Ui/Caption/GameEntry/PlaceEPLotsWizard:Accept"), Common.LocalizeEAString("Ui/Caption/GameEntry/PlaceEPLotsWizard:Decline")))
                                    {
                                        GameStates.sSingleton.mInWorldState.mSubStates[0xb].PlaceRequiredEPVenues();
                                    }
                                }
                            }
                            finally
                            {
                                GameStates.sIsChangingWorlds = isChangingWorlds;

                                GameUtils.WorldNameToType.Remove(currentWorld);
                                GameUtils.WorldNameToType.Add(currentWorld, currentWorldType);
                            }
                        }
                        break;
                    }
                }
                else
                {
                    ths.PlaceLotWizardCheck();
                }
            }
            catch (Exception e)
            {
                Common.Exception("PlaceLotWizardCheck", e);
            }
        }
Esempio n. 10
0
        public static string CheckForReasonsToFailTravel(SimDescription simDescription, Type filter, WorldName worldName, bool isWorldMove, bool testMoveRequested)
        {
            try
            {
                if (simDescription == null) return null;

                if (testMoveRequested)
                {
                    if ((TravelUtil.PlayerMadeTravelRequest) || (GameStates.WorldMoveRequested))
                    {
                        return TravelUtil.LocalizeString(simDescription.IsFemale, "AnotherTravelRequested", new object[] { simDescription });
                    }
                }

                bool playerMadeTravelRequest = TravelUtil.PlayerMadeTravelRequest;
                try
                {
                    TravelUtil.PlayerMadeTravelRequest = false;

                    string failReason = null;
                    if (!InWorldSubState.IsEditTownValid(simDescription.LotHome, ref failReason))
                    {
                        if (!string.IsNullOrEmpty(failReason) && Localization.HasLocalizationString("Gameplay/Visa/TravelUtil:EditTownInvalid" + failReason))
                        {
                            return TravelUtil.LocalizeString(simDescription.IsFemale, "EditTownInvalid" + failReason, new object[] { simDescription });
                        }

                        return TravelUtil.LocalizeString(simDescription.IsFemale, "EditTownInvalid", new object[] { simDescription });
                    }
                }
                finally
                {
                    TravelUtil.PlayerMadeTravelRequest = playerMadeTravelRequest;
                }

                foreach (Sim sim in Households.AllSims(simDescription.Household))
                {
                    try
                    {
                        if (sim.IsDying())
                        {
                            return TravelUtil.LocalizeString(sim.IsFemale, "FamilyMemberIsDying", new object[] { sim });
                        }
                        else if (sim.Autonomy.SituationComponent.InSituationOfType(typeof(ParentsLeavingTownSituation)))
                        {
                            return TravelUtil.LocalizeString(sim.IsFemale, "ParentsOutOfTown", new object[] { sim });
                        }
                        else if (sim.InteractionQueue.HasInteractionOfType(AgeDown.Singleton))
                        {
                            return TravelUtil.LocalizeString(sim.IsFemale, "SomeoneIsAgingDown", new object[] { sim });
                        }
                        else if ((sim != simDescription.CreatedSim) && sim.InteractionQueue.HasInteractionOfType(typeof(IAmMovingInteraction)))
                        {
                            return TravelUtil.LocalizeString(sim.IsFemale, "AnotherTravelRequested", new object[] { sim });
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(sim, e);
                        return "(Error)";
                    }
                }

                if (!isWorldMove)
                {
                    if ((worldName != WorldName.FutureWorld) && (simDescription.ToddlerOrBelow))
                    {
                        if ((filter & Type.Toddlers) == Type.None)
                        {
                            return TravelUtil.LocalizeString(simDescription.IsFemale, "TooYoungToTravel", new object[] { simDescription });
                        }
                    }

                    if ((worldName == WorldName.University) && (simDescription.Teen))
                    {
                        if ((filter & Type.Teens) == Type.None)
                        {
                            return TravelUtil.LocalizeString(simDescription.IsFemale, "TooYoungToTravel", new object[] { simDescription });
                        }
                    }

                    if ((worldName == WorldName.University) && (simDescription.ChildOrBelow))
                    {
                        if ((filter & Type.Children) == Type.None)
                        {
                            return TravelUtil.LocalizeString(simDescription.IsFemale, "TooYoungToTravel", new object[] { simDescription });
                        }
                    }

                    if (simDescription.IsPet)
                    {
                        if ((filter & Type.Pets) == Type.None)
                        {
                            return Common.Localize("Travel:PetDeny", simDescription.IsFemale, new object[] { simDescription });
                        }
                    }

                    if ((worldName != WorldName.University) && (worldName != WorldName.FutureWorld) && (simDescription.CreatedSim != null) && simDescription.CreatedSim.BuffManager.HasElement(BuffNames.WentToLocation))
                    {
                        if ((filter & Type.Recovering) == Type.None)
                        {
                            return TravelUtil.LocalizeString(simDescription.IsFemale, "RecoveringFromVacation", new object[] { simDescription });
                        }
                    }
                }

                if (Sims3.Gameplay.Passport.Passport.IsHouseholdSimAwayInPassport(simDescription.Household))
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "SimInPassport", new object[] { simDescription });
                }

                if ((simDescription.CreatedSim != null) && simDescription.CreatedSim.BuffManager.HasElement(BuffNames.VampireBite))
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "VampireBite", new object[] { simDescription });
                }

                if (simDescription.IsVisuallyPregnant)
                {
                    if ((filter & Type.Pregnant) == Type.None)
                    {
                        return TravelUtil.LocalizeString(simDescription.IsFemale, "IsPregnant", new object[] { simDescription });
                    }
                }

                Sim createdSim = simDescription.CreatedSim;

                if ((createdSim != null) && createdSim.BuffManager.HasElement(BuffNames.MalePregnancy))
                {
                    if ((filter & Type.Pregnant) == Type.None)
                    {
                        return TravelUtil.LocalizeString(simDescription.IsFemale, "ConditionPreventsTravel", new object[] { simDescription });
                    }
                }

                if ((createdSim != null) && createdSim.IsDying())
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "IsDying", new object[] { simDescription });
                }

                if ((createdSim != null) && (createdSim.CurrentInteraction is IGoToJail))
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "IsInJail", new object[] { simDescription });
                }

                if (simDescription.IsEnrolledInBoardingSchool())
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "IsInBoardingSchool", new object[] { simDescription });
                }

                if ((ParentsLeavingTownSituation.Adults != null) && ParentsLeavingTownSituation.Adults.Contains(simDescription.SimDescriptionId))
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "ParentsOutOfTown", new object[] { simDescription });
                }

                if (simDescription.mCurrentPassportChallengeID != PassportChallenges.ChallengeIds.InvalidChallenge)
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "AwayInPassport", new object[] { simDescription });
                }

                if ((createdSim != null) && createdSim.BuffManager.HasElement(BuffNames.Ensorcelled))
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "Ensorcelled", new object[] { simDescription });
                }

                if (filter == Type.None)
                {
                    if ((createdSim != null) && (TravelUtil.HasBlockingTransformBuff(createdSim, worldName == WorldName.FutureWorld)))
                    {
                        return TravelUtil.LocalizeString(simDescription.IsFemale, "NoTravelWhileTransformed", new object[0]);
                    }
                }

                return null;
            }
            catch (Exception e)
            {
                Common.Exception(simDescription, e);
                return "(Error)";
            }
        }