protected void TriggerMoveToNewWorldEx() { RemoveTriggerAlarm(); List <Sim> allTravelers = new List <Sim>(Followers); allTravelers.Add(Actor); // Custom string reason = null; if (Helpers.TravelUtilEx.FinalBoardingCall(Actor.Household, allTravelers, WorldName.Undefined, true, ref reason)) { ForeignVisitorsSituation.ForceKillForeignVisitorsSituation(); HolographicProjectionSituation.ForceKillHolographicVisitorsSituation(); Camera.SetView(CameraView.MapView, false, true); // Custom GameStatesEx.MoveToNewWorld(DestinationWorldName, TravelingSimGuids, mMovingWorldSaved, mPackFurniture); } else { GameStates.WorldMoveRequested = false; Actor.ShowTNSIfSelectable(Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Visa/TravelUtil:ForceMoveCancel") + Common.NewLine + Common.NewLine + reason, StyledNotification.NotificationStyle.kSystemMessage, ObjectGuid.InvalidObjectGuid); foreach (Sim sim in allTravelers) { if (!sim.IsDying()) { sim.AddExitReason(ExitReason.CanceledByScript); } } } }
private static void OneDayPassedVacationUpdates(Household ths) { if (GameStates.CurrentDayOfTrip == GameStates.TripLength) { if (!GameStates.IsTravelling) { StyledNotification.Format format = new StyledNotification.Format(Common.LocalizeEAString("Gameplay/Vacation:OneDayLeft"), StyledNotification.NotificationStyle.kSystemMessage); StyledNotification.Show(format); } ths.mLastDayAlarm = AlarmManager.Global.AddAlarm(SimClock.HoursUntil(12f), TimeUnit.Hours, ths.HalfDayLeft, "Half Day left TNS", AlarmType.AlwaysPersisted, ths); } else if (GameStates.CurrentDayOfTrip > GameStates.TripLength) { bool denyTravel = false; if (!GameStates.IsTravelling) { foreach (Sim sim in Households.AllSims(ths)) { sim.VisaManager.UpdateDaysSpentInWorld(GameUtils.GetCurrentWorld(), GameStates.CurrentDayOfTrip - 0x1); if (sim.IsDying()) { denyTravel = true; } } } if (!denyTravel) { GameStates.StopSnappingPicturesIfNeccessary(); Sims3.Gameplay.UI.HudModel hudModel = Sims3.Gameplay.UI.Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel; if (hudModel != null) { WorldName currentWorld = GameUtils.GetCurrentWorld(); string str = hudModel.LocationName(currentWorld); SimpleMessageDialog.Show(TravelUtil.LocalizeString("TripOverCaption", new object[0x0]), TravelUtil.LocalizeString("TripOverText", new object[] { str }), ModalDialog.PauseMode.PauseSimulator); } } if (!denyTravel) { Traveler.SaveGame(); TravelUtil.PlayerMadeTravelRequest = true; // Calls custom function GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); } } }
private new void TriggerTravelToUniversityWorld() { RemoveTriggerAlarm(); List <Sim> allTravelers = new List <Sim>(TravelingSims); allTravelers.Add(Actor); string reason = null; // Custom if (Helpers.TravelUtilEx.FinalBoardingCall(Actor.Household, allTravelers, WorldName.University, false, ref reason)) { int travelDuration = (TravelDuration / 7) * Traveler.Settings.mUniversityTermLength; ForeignVisitorsSituation.ForceKillForeignVisitorsSituation(); HolographicProjectionSituation.ForceKillHolographicVisitorsSituation(); Camera.SetView(CameraView.MapView, false, true); int tripLength = (TravelUtil.sOverriddenTripLength > 0x0) ? TravelUtil.sOverriddenTripLength : travelDuration; int lastTimeAtUniversity = -2147483648; foreach (Sim sim in allTravelers) { if (lastTimeAtUniversity < sim.DegreeManager.LastTimeAtUniversity) { lastTimeAtUniversity = sim.DegreeManager.LastTimeAtUniversity; } } int numDaysSinceLastInDestWorld = -1; if (lastTimeAtUniversity >= 0x0) { numDaysSinceLastInDestWorld = SimClock.ElapsedCalendarDays() - lastTimeAtUniversity; } // Custom GameStatesEx.TravelToVacationWorld(kUniversityWorldName, mTravelingSimsGuids, tripLength, numDaysSinceLastInDestWorld); } else { Actor.ShowTNSIfSelectable(TravelUtil.LocalizeString(Actor.IsFemale, "CantTravelTNS", new object[] { TravelCost }) + Common.NewLine + Common.NewLine + reason, StyledNotification.NotificationStyle.kSystemMessage, ObjectGuid.InvalidObjectGuid); Actor.ModifyFunds(TravelCost); foreach (Sim sim2 in allTravelers) { if (!sim2.IsDying()) { sim2.AddExitReason(ExitReason.CanceledByScript); } } } }
protected override void OnPerform() { if (!mSimGuids.Contains(mActor.SimDescription.SimDescriptionId)) { mSimGuids.Add(mActor.SimDescription.SimDescriptionId); } ForeignVisitorsSituation.ForceKillForeignVisitorsSituation(); HolographicProjectionSituation.ForceKillHolographicVisitorsSituation(); Camera.SetView(CameraView.MapView, false, true); // Custom CleanUpReservedVehicles(mActor, mFollowers); if (mPortal != null) { mPortal.StopActiveFX(); } // Custom GameStatesEx.TravelToVacationWorld(WorldName.FutureWorld, mSimGuids, 0x0, 0x0); CauseEffectService.GetInstance().SetDepartureTimePortal(mPortal.ObjectId); }
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); }
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); }
private static void OneDayPassedUniversityUpdates(Household ths) { try { if (GameStates.CurrentDayOfTrip == GameStates.TripLength) { Household.ReportCardHelper helper = null; foreach (SimDescription description in Households.All(ths)) { if (description == null) { continue; } if (description.OccupationAsAcademicCareer == null) { continue; } if (helper == null) { helper = new Household.ReportCardHelper(); } helper.AddGPA(description.SimDescriptionId, description.OccupationAsAcademicCareer.GetGradeAsLetter()); } if (helper != null) { AlarmManager.Global.AddAlarm(SimClock.HoursUntil(Household.kWhenReportCardArrives), TimeUnit.Hours, helper.ReportCardArrives, "Report Card Arrives", AlarmType.AlwaysPersisted, ths); } // Correction for potential error in OnTermCompleted() Corrections.CleanupAcademics(null); foreach (Household household in Household.sHouseholdList) { if (household == null) { continue; } if (household.IsPreviousTravelerHousehold) { continue; } foreach (SimDescription sim in household.SimDescriptions) { if (sim == null) { continue; } try { AcademicCareer occupationAsAcademicCareer = sim.OccupationAsAcademicCareer; if (occupationAsAcademicCareer != null) { AcademicCareerEx.OnTermCompleted(occupationAsAcademicCareer); } } catch (Exception e) { Common.Exception(sim, e); } } } AlarmManager.Global.RemoveAlarm(ths.mLastDayAlarm); ths.mLastDayAlarm = AlarmManager.Global.AddAlarm(SimClock.HoursUntil(Household.kWhenOneHourLeftTNSAppears), TimeUnit.Hours, ths.OneHourLeft, "One Hour left TNS", AlarmType.AlwaysPersisted, ths); AlarmManager.Global.RemoveAlarm(ths.mTriggerUniversityReturnFlowAlarm); ths.mTriggerUniversityReturnFlowAlarm = AlarmManager.Global.AddAlarm(SimClock.HoursUntil(Household.kWhenSimsStartLeaving), TimeUnit.Hours, BeginReturnFromUniversityFlow, "Start University Return Home Flow Alarm", AlarmType.AlwaysPersisted, ths); } else if (GameStates.CurrentDayOfTrip > GameStates.TripLength) { bool denyTravel = false; if (!GameStates.IsTravelling) { foreach (Sim sim in ths.AllActors) { if ((sim != null) && sim.IsDying()) { denyTravel = true; } } } GameStates.StopSnappingPicturesIfNeccessary(); if (Sims3.Gameplay.UI.Responder.Instance.HudModel is HudModel) { Common.FunctionTask.Perform(ths.ShowTripOverDialog); } if (!denyTravel) { Traveler.SaveGame(); TravelUtil.PlayerMadeTravelRequest = true; // Custom GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); } } else if (GameStates.CurrentDayOfTrip <= 0x1) { AlarmManager.Global.RemoveAlarm(Household.mAtUnivTutorialAlarm); Household.mAtUnivTutorialAlarm = AlarmHandle.kInvalidHandle; AlarmManager.Global.RemoveAlarm(Household.mDormsTutorialAlarm); Household.mDormsTutorialAlarm = AlarmHandle.kInvalidHandle; Household.mAtUnivTutorialAlarm = AlarmManager.Global.AddAlarmDay(Household.kTimeAtUnivTutorial, ~DaysOfTheWeek.None, Household.TriggerAtUniversityTutorial, "At University Lesson", AlarmType.AlwaysPersisted, null); Household.mDormsTutorialAlarm = AlarmManager.Global.AddAlarmDay(Household.kTimeDormsTutorial, ~DaysOfTheWeek.None, Household.TriggerDormsTutorial, "Dorms Lesson", AlarmType.AlwaysPersisted, null); } else if (GameStates.CurrentDayOfTrip == (GameStates.TripLength - 0x1)) { float num2 = SimClock.HoursUntil(Household.kWhenOneDayLeftTNSAppears); ths.mLastDayAlarm = AlarmManager.Global.AddAlarm(num2, TimeUnit.Hours, ths.OneDayLeft, "One Day left TNS", AlarmType.AlwaysPersisted, ths); } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(ths, e); } }
public override bool Run() { try { Actor.PlaySoloAnimation("a_react_waveA_standing_x", true); EventTracker.SendEvent(new TravelUtil.TravelEvent(EventTypeId.kReturnedFromVacation, Actor, null, GameStates.sTravelData.mDestWorld, GameStates.sTravelData.mCurrentDayOfTrip)); if (GameStates.sTravelData.mEarlyDepartures == null) { GameStates.sTravelData.mEarlyDepartures = new List <Sim>(); } GameStates.sTravelData.mEarlyDepartures.Add(Actor); if (Households.AllHumans(Actor.Household).Count == 0x1) { GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); return(true); } if (Actor.IsActiveSim) { LotManager.SelectNextSim(); } Actor.SimDescription.DnPExportData = new DnPExportData(Actor.SimDescription); if (Actor.OpportunityManager != null) { Actor.OpportunityManager.StoreOpportunitiesForTravel(); } if (Actor.BuffManager != null) { Actor.BuffManager.StoreBuffsForTravel(Actor.SimDescription); } Actor.Household.RemoveSim(Actor); Actor.NullDnPManager(); Actor.Motives.FreezeDecayEverythingExcept(new CommodityKind[0x0]); Actor.Autonomy.IncrementAutonomyDisabled(); try { Actor.DisablePieMenuOnSim = true; if (DestinationLot != null) { Route r = Actor.CreateRoute(); r.DoRouteFail = false; DestinationLot.PlanToLot(r); Actor.DoRoute(r); } Actor.FadeOut(true, false, 1f); } finally { Actor.DisablePieMenuOnSim = false; } return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } finally { TravelUtil.PlayerMadeTravelRequest = false; } return(false); }
public override bool Run() { try { string str; mTimeTravelDef = InteractionDefinition as Definition; if (!Target.RouteToMachine(Actor, false, null)) { return(false); } if (!TimePortalTravelEx.PreTimeTravel1(this)) { return(false); } if (!TimePortalTravelEx.PreTimeTravel2(this)) { return(false); } Actor.SimDescription.Contactable = false; EnterStateMachine("TimeMachine", "Enter", "x"); SetActor("timeMachine", Target); SetParameter("isFuture", mTimeTravelDef.TimePeriod == TimeMachine.TravelTimePeriod.Future); AddOneShotScriptEventHandler(0x3ee, OnEnterAnimationEvent); AddOneShotScriptEventHandler(0x66, ToggleHiddenAnimationEvent); AnimateSim("GetIn"); Target.EnableRoutingFootprint(Actor); mTimeTravelAlarm = AlarmManager.Global.AddAlarmRepeating(RandomUtil.GetFloat(TimeMachine.kMinutesBetweenAdventureTNSMin, TimeMachine.kMinutesBetweenAdventureTNSMax), TimeUnit.Minutes, new AlarmTimerCallback(TimeTravelCallback), RandomUtil.GetFloat(TimeMachine.kMinutesBetweenAdventureTNSMin, TimeMachine.kMinutesBetweenAdventureTNSMax), TimeUnit.Minutes, "Time Travel Alarm For:" + Actor.SimDescription.FullName, AlarmType.AlwaysPersisted, Actor); Target.SetMaterial("InUse"); bool succeeded = true; if (!GameUtils.IsFutureWorld()) { // Custom succeeded = TimePortalEx.TravelToFuture(null, Actor, new List <Sim>(), new List <ulong>()); } succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); EndCommodityUpdates(succeeded); Target.PickExitStateAndSound(mTimeTravelDef.TimePeriod, out str, out mExitSound); AddOneShotScriptEventHandler(0x3e9, OnExitAnimationEvent); AddOneShotScriptEventHandler(0x3ef, OnExitAnimationEvent); AddOneShotScriptEventHandler(0x67, ToggleHiddenAnimationEvent); AnimateSim(str); if (!TimePortalTravelEx.PostTimeTravel1(this, succeeded)) { return(false); } Target.SetMaterial("default"); AnimateSim("Exit"); if (!string.IsNullOrEmpty(mTravelSummary)) { Actor.ShowTNSIfSelectable(mTravelSummary, StyledNotification.NotificationStyle.kGameMessagePositive, Target.ObjectId, Actor.ObjectId); } StandardExit(); Target.Repairable.UpdateBreakage(Actor); InventingSkill skill = Actor.SkillManager.GetSkill <InventingSkill>(SkillNames.Inventing); if (succeeded && (skill != null)) { skill.RegisterTimeTravelDone(); } if (GameUtils.IsFutureWorld()) { EventTracker.SendEvent(EventTypeId.kTravelToPresent, Actor); // Custom GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } finally { TravelUtil.PlayerMadeTravelRequest = false; } }
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(); } }
protected new void TriggerTravelToVacationWorld() { RemoveTriggerAlarm(); List <Sim> allTravelers = new List <Sim>(Followers); allTravelers.Add(Actor); string reason = null; // Custom if ((TravelingSimGuids.Count == 0) || (Helpers.TravelUtilEx.FinalBoardingCall(Actor.Household, allTravelers, DestinationWorldName, false, ref reason))) { ForeignVisitorsSituation.ForceKillForeignVisitorsSituation(); HolographicProjectionSituation.ForceKillHolographicVisitorsSituation(); int lastTimeOnVacation = -2147483648; foreach (Sim sim in allTravelers) { if (lastTimeOnVacation < sim.VisaManager.LastTimeOnVacation) { lastTimeOnVacation = sim.VisaManager.LastTimeOnVacation; } } int numDaysSinceLastInDestWorld = -1; if (lastTimeOnVacation > 0) { numDaysSinceLastInDestWorld = SimClock.ElapsedCalendarDays() - lastTimeOnVacation; } Camera.SetView(CameraView.MapView, false, true); int tripLength = (TravelUtil.sOverriddenTripLength > 0x0) ? TravelUtil.sOverriddenTripLength : TravelDuration; // Custom GameStatesEx.TravelToVacationWorld(DestinationWorldName, TravelingSimGuids, tripLength, numDaysSinceLastInDestWorld); TelemetryStats.VacationTelemetryInfo vacationTelemetryInfo = new TelemetryStats.VacationTelemetryInfo(); vacationTelemetryInfo.LeavingHomeWorld = true; vacationTelemetryInfo.WorldId = DestinationWorldName; int num2 = 0x0; if (TravelingSimGuids.Count > 0) { vacationTelemetryInfo.NumberOfSimsInHoushold = Households.NumSims(Actor.Household); vacationTelemetryInfo.NumberOfSimsThatDidTravel = allTravelers.Count; foreach (Sim sim in Households.AllSims(Actor.Household)) { // Custom if (CommonSpace.Helpers.TravelUtilEx.CheckForReasonsToFailTravel(sim.SimDescription, Traveler.Settings.mTravelFilter, DestinationWorldName, false, false) == null) { num2++; } } } else { vacationTelemetryInfo.NumberOfSimsInHoushold = 0; vacationTelemetryInfo.NumberOfSimsThatDidTravel = 0; } vacationTelemetryInfo.NumberOfSimsAbleToTravel = num2; vacationTelemetryInfo.VisaLevels = new PairedListDictionary <ulong, int>(); foreach (Sim sim2 in allTravelers) { int visaLevel = sim2.VisaManager.GetVisaLevel(DestinationWorldName); vacationTelemetryInfo.VisaLevels.Add(sim2.SimDescription.SimDescriptionId, visaLevel); } vacationTelemetryInfo.TravelDateAndTime = SimClock.CurrentTime(); EventTracker.SendEvent(new VacationInfoEvent(EventTypeId.kVacationTelemetryInfo, vacationTelemetryInfo)); } else { if (DestinationWorldName == WorldName.FutureWorld) { Actor.ShowTNSIfSelectable(TravelUtil.LocalizeString(Actor.IsFemale, "CantTravelFutureTNS", new object[] { TravelCost }), StyledNotification.NotificationStyle.kSystemMessage, ObjectGuid.InvalidObjectGuid); } else { Actor.ShowTNSIfSelectable(TravelUtil.LocalizeString(Actor.IsFemale, "CantTravelTNS", new object[] { TravelCost }) + Common.NewLine + Common.NewLine + reason, StyledNotification.NotificationStyle.kSystemMessage, ObjectGuid.InvalidObjectGuid); } Actor.ModifyFunds(TravelCost); foreach (Sim sim3 in allTravelers) { if (!sim3.IsDying()) { sim3.AddExitReason(ExitReason.CanceledByScript); } } } }
public override bool Run() { try { Target.mRoutingSims.Add(Actor); if (!Target.RouteToPortal(Actor)) { Actor.AddExitReason(ExitReason.RouteFailed); Target.mRoutingSims.Remove(Actor); return(false); } Target.mRoutingSims.Remove(Actor); List <Sim> lazyList = new List <Sim>(); if (!TimePortalTravelWithEx.PreTimeTravel1(this, this, lazyList)) { return(false); } mTargetPortal = Target; mTargetPortal.AddToUseList(Actor); if (!TimePortalTravelWithEx.PreTimeTravel2(this, lazyList)) { return(false); } mTargetPortal.EnableFootprint(FootprintPlacementHash); mTargetPortal.PushSimsFromFootprint(FootprintPlacementHash, Actor, null, false); EnterStateMachine("AncientPortal", "Enter", "x", "portal"); AddOneShotScriptEventHandler(0x65, HideSim); AddOneShotScriptEventHandler(0x66, ShowSim); AnimateSim("InsidePortal"); SetActor("portal", mTargetPortal); bool succeeded = true; if (!GameUtils.IsFutureWorld()) { // Custom succeeded = TimePortalEx.TravelToFuture(null, Actor, new List <Sim>(mFollowerGroup), new List <ulong>(mFollowerGroupIDs)); } if (succeeded) { foreach (Sim sim7 in lazyList) { Skill futureSkill = sim7.SkillManager.GetElement(SkillNames.Future); if (futureSkill != null) { futureSkill.AddPoints(TimePortalTravelWithEx.kFollowerFutureSkillPointGain, true, false); } } } Slot slotName = mTargetPortal.GetRoutingSlots()[0x0]; Vector3 positionOfSlot = mTargetPortal.GetPositionOfSlot(slotName); Vector3 forwardOfSlot = mTargetPortal.GetForwardOfSlot(slotName); Actor.SetPosition(positionOfSlot); Actor.SetForward(forwardOfSlot); mTargetPortal.DisableFootprint(FootprintPlacementHash); AnimateSim("Exit"); for (int i = 0x0; i < kPotentialTravelBuffs.Length; i++) { if (RandomUtil.RandomChance(kChanceForEachBuff)) { Actor.BuffManager.AddElement(kPotentialTravelBuffs[i], Origin.FromAncientPortal); } } EndCommodityUpdates(succeeded); StandardExit(); mTargetPortal.RemoveFromUseList(Actor); Actor.Wander(1f, 2f, false, RouteDistancePreference.PreferNearestToRouteOrigin, false); if (GameUtils.IsFutureWorld()) { // Custom GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); TimePortalTravelWithEx.SendEventForActorAndFollowers(Actor, lazyList, EventTypeId.kTravelToPresent); } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } finally { TravelUtil.PlayerMadeTravelRequest = false; } }
public override void Startup() { Common.StringBuilder msg = new Common.StringBuilder("InWorldStateEx:Startup"); Traveler.InsanityWriteLog(msg); try { // StateMachineState:Startup() mBaseCallFlag |= BaseCallFlag.kStartup; //base.Startup(); msg += Common.NewLine + "A"; Traveler.InsanityWriteLog(msg); Sims3.Gameplay.UI.Responder.GameStartup(); mEnteredFromTravelling = GameStates.IsTravelling; bool flag = false; try { ModalDialog.EnableModalDialogs = false; if (World.IsEditInGameFromWBMode()) { Sims3.Gameplay.Autonomy.Autonomy.DisableMoodContributors = true; } msg += Common.NewLine + "B"; Traveler.InsanityWriteLog(msg); mStateMachine = StateMachine.Create(0x1, "InWorld"); mSubStates[0] = new LiveModeStateEx(GameStates.IsMovingWorlds); // Custom mSubStates[1] = new BuildModeState(); mSubStates[2] = new BuyModeState(); mSubStates[12] = new ShoppingModeState(); mSubStates[3] = new CASFullModeState(); mSubStates[4] = new CASDresserModeState(); mSubStates[5] = new CASMirrorModeState(); mSubStates[6] = new CASTattooModeState(); mSubStates[7] = new CASStylistModeState(); mSubStates[8] = new CASTackModeState(); mSubStates[9] = new CASCollarModeState(); mSubStates[10] = new CASSurgeryFaceModeState(); mSubStates[11] = new CASSurgeryBodyModeState(); mSubStates[15] = new PlayFlowStateEx(); // Custom mSubStates[14] = new EditTownStateEx(); // Custom mSubStates[16] = new BlueprintModeState(); mSubStates[17] = new CASMermaidModeState(); mSubStates[0x12] = new CABModeState(); mSubStates[0x13] = new CABModeEditState(); foreach (InWorldSubState state in mSubStates) { mStateMachine.AddState(state); } msg += Common.NewLine + "C"; Traveler.InsanityWriteLog(msg); StateMachineManager.AddMachine(mStateMachine); if (GameStates.IsTravelling || GameStates.IsEditingOtherTown) { try { Sims3.Gameplay.WorldBuilderUtil.CharacterImportOnGameLoad.RemapSimDescriptionIds(); } catch (Exception e) { Common.DebugException("RemapSimDescriptionIds", e); } } else { CrossWorldControl.sRetention.RestoreHouseholds(); } msg += Common.NewLine + "D"; Traveler.InsanityWriteLog(msg); if (GameStates.IsTravelling) { msg += Common.NewLine + "E1"; Traveler.InsanityWriteLog(msg); bool fail = false; if (!GameStatesEx.ImportTravellingHousehold()) { msg += Common.NewLine + "E3"; fail = true; } if ((GameStates.TravelHousehold == null) && (GameStates.sTravelData.mState == GameStates.TravelData.TravelState.StartVacation)) { msg += Common.NewLine + "E4"; fail = true; } if (fail) { msg += Common.NewLine + "E5"; Traveler.InsanityWriteLog(msg); GameStates.sStartupState = SubState.EditTown; GameStates.ClearTravelStatics(); WorldData.SetVacationWorld(true, true); } } else if ((!GameStates.IsEditingOtherTown) && (GameStates.HasTravelData) && (GameStates.TravelHousehold == null)) { switch (GameUtils.GetCurrentWorldType()) { case WorldType.Base: case WorldType.Downtown: msg += Common.NewLine + "E2"; Traveler.InsanityWriteLog(msg); GameStates.ClearTravelStatics(); break; } } // Custom if (GameStates.sMovingWorldData != null) { Household.IsTravelImport = true; } msg += Common.NewLine + "F1"; Traveler.InsanityWriteLog(msg); List <Household> households = new List <Household>(Household.sHouseholdList); foreach (Household a in households) { if ((a.LotHome != null) && (a.LotHome.Household == null)) { a.LotHome.mHousehold = a; } foreach (SimDescription simA in Households.All(a)) { // Must be validated prior to SimDescription:PostLoadFixup() if (simA.GameObjectRelationships != null) { for (int index = simA.GameObjectRelationships.Count - 1; index >= 0; index--) { if ((simA.GameObjectRelationships[index] == null) || (simA.GameObjectRelationships[index].GameObjectDescription == null) || (simA.GameObjectRelationships[index].GameObjectDescription.GameObject == null) || (!Objects.IsValid(simA.GameObjectRelationships[index].GameObjectDescription.GameObject.ObjectId))) { simA.GameObjectRelationships.RemoveAt(index); } } } foreach (Household b in households) { if (a == b) { continue; } if (!b.Contains(simA)) { continue; } if (b.NumMembers == 1) { continue; } try { b.Remove(simA, false); msg += Common.NewLine + "Duplicate: " + simA.FullName; } catch (Exception e) { Common.Exception(simA, e); } } } } msg += Common.NewLine + "F2"; Traveler.InsanityWriteLog(msg); // Required to ensure that all homeworld specific data is fixed up properly (specifically careers) using (BaseWorldReversion reversion = new BaseWorldReversion()) { // Reset this, to allow the Seasons Manager to activate properly SeasonsManager.sSeasonsValidForWorld = SeasonsManager.Validity.Undetermined; try { mPostWorldInitializers = new Initializers("PostWorldInitializers", this); using (CareerStore store = new CareerStore()) { //InitializersEx.Initialize(mPostWorldInitializers); mPostWorldInitializers.Initialize(); } } catch (Exception e) { Traveler.InsanityException(msg, e); } } msg += Common.NewLine + "G1"; Traveler.InsanityWriteLog(msg); try { if (GameStates.TravelHousehold != null) { LinkToTravelHousehold(); WorldName worldName = GameUtils.GetCurrentWorld(); switch (worldName) { case WorldName.China: case WorldName.Egypt: case WorldName.France: break; default: foreach (SimDescription sim in Households.All(GameStates.TravelHousehold)) { if (sim.VisaManager == null) { continue; } WorldData.OnLoadFixup(sim.VisaManager); sim.VisaManager.SetVisaLevel(worldName, 3); } break; } } } catch (Exception e) { Traveler.InsanityException(msg, e); } msg += Common.NewLine + "G2"; Traveler.InsanityWriteLog(msg); List <SimDescription> dyingSims = null; if (GameStates.IsTravelling) { dyingSims = GameStatesEx.PostTravelingFixUp(); } msg += Common.NewLine + "H"; Traveler.InsanityWriteLog(msg); if (GameStates.IsEditingOtherTown) { GameStates.PostLoadEditTownFixup(); } msg += Common.NewLine + "I"; Traveler.InsanityWriteLog(msg); // We must stop the travel actions from running if the homeworld is an EA vacation world WorldData.SetVacationWorld(true, false); GameStates.NullEditTownDataDataIfEditingOriginalStartingWorld(); try { if (GameUtils.IsAnyTravelBasedWorld()) { if ((dyingSims != null) && (AgingManager.NumberAgingYearsElapsed != -1f)) { float yearsGone = GameStates.NumberAgingYearsElapsed - AgingManager.NumberAgingYearsElapsed; // Custom function FixUpAfterTravel(yearsGone, dyingSims); } AgingManager.NumberAgingYearsElapsed = GameStates.NumberAgingYearsElapsed; } } catch (Exception e) { Traveler.InsanityException(msg, e); } msg += Common.NewLine + "J"; Traveler.InsanityWriteLog(msg); Sims3.Gameplay.Gameflow.GameSpeed pause = Sims3.Gameplay.Gameflow.GameSpeed.Pause; if (GameStates.StartupState == SubState.LiveMode) { flag = !GameStates.IsEditingOtherTown && (((GameStates.ForceStateChange || !PlayFlowModel.Singleton.GameEntryLive) || (PlumbBob.SelectedActor != null)) || GameStates.IsTravelling); if (flag) { if (Sims3.Gameplay.Gameflow.sGameLoadedFromWorldFile) { pause = Sims3.SimIFace.Gameflow.GameSpeed.Normal; } else { pause = Sims3.Gameplay.Gameflow.sPersistedGameSpeed; } } } msg += Common.NewLine + "K"; Traveler.InsanityWriteLog(msg); Sims3.Gameplay.Gameflow.sGameLoadedFromWorldFile = false; string s = CommandLine.FindSwitch("speed"); if (s != null) { int num2; if (int.TryParse(s, out num2)) { pause = (Sims3.Gameplay.Gameflow.GameSpeed)num2; } else { ParserFunctions.TryParseEnum <Sims3.Gameplay.Gameflow.GameSpeed>(s, out pause, Sims3.Gameplay.Gameflow.GameSpeed.Normal); } } msg += Common.NewLine + "L"; Traveler.InsanityWriteLog(msg); Sims3.Gameplay.Gameflow.SetGameSpeed(pause, Sims3.Gameplay.Gameflow.SetGameSpeedContext.GameStates); NotificationManager.Load(); MainMenu.TriggerPendingFsiWorldNotifications(); } finally { ModalDialog.EnableModalDialogs = true; } if (SocialFeatures.Accounts.IsLoggedIn()) { Notify(0, 0, 0L); } switch (GameStates.StartupState) { case SubState.EditTown: msg += Common.NewLine + "StartupState: EditTown"; GameUtils.EnableSceneDraw(true); LoadingScreenController.Unload(); GotoEditTown(); break; case SubState.PlayFlow: if (World.IsEditInGameFromWBMode()) { msg += Common.NewLine + "StartupState: PlayFlow (A)"; GameUtils.EnableSceneDraw(true); LoadingScreenController.Unload(); GotoLiveMode(); } else if (!PlayFlowModel.PlayFlowEnabled || !PlayFlowModel.Singleton.GameEntryLive) { msg += Common.NewLine + "StartupState: PlayFlow (B)"; GameUtils.EnableSceneDraw(true); LoadingScreenController.Unload(); GotoLiveMode(); } else { msg += Common.NewLine + "StartupState: PlayFlow (C)"; GotoPlayFlow(); } break; case SubState.LiveMode: // Custom if (((!GameUtils.IsOnVacation() && !GameUtils.IsFutureWorld()) || EditTownModel.IsAnyLotBaseCampStatic() || EditTownModelEx.IsAnyUnoccupiedLotStatic()) && flag) { bool directToGame = false; if (!GameStates.IsTravelling) { // Entering an existing save directToGame = true; } else if (EditTownModel.IsAnyLotBaseCampStatic()) { // Normal transition to base camp directToGame = true; } else if (!GameUtils.IsInstalled(ProductVersion.EP9)) { // Use custom household selection directToGame = true; } // Custom if ((flag) && (directToGame)) { msg += Common.NewLine + "StartupState: LiveMode (A)"; GotoLiveMode(); break; } else { msg += Common.NewLine + "StartupState: LiveMode (C)"; GameUtils.EnableSceneDraw(true); LoadingScreenController.Unload(); GotoPlayFlow(); break; } } msg += Common.NewLine + "StartupState: LiveMode (B)"; GameUtils.EnableSceneDraw(true); LoadingScreenController.Unload(); GotoEditTown(); break; } msg += Common.NewLine + "M"; Traveler.InsanityWriteLog(msg); if (Sims3.Gameplay.Gameflow.sShowObjectReplacedWarning) { SimpleMessageDialog.Show(Common.LocalizeEAString("Ui/Warning/LoadGame:Warning"), Common.LocalizeEAString("Ui/Warning/LoadGame:ReplacedObjects"), ModalDialog.PauseMode.PauseSimulator); Sims3.Gameplay.Gameflow.sShowObjectReplacedWarning = false; } } catch (Exception e) { Traveler.InsanityException(msg, e); } finally { //Common.WriteLog(msg); } }
private new static void TriggerTravelToHomeWorld() { SimpleMessageDialog.Show(TravelUtil.LocalizeString("TermOverCaption", new object[0x0]), TravelUtil.LocalizeString("TermOverText", new object[0x0]), ModalDialog.PauseMode.PauseSimulator); GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); }