Пример #1
0
        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();
                }
            }
        }
Пример #2
0
        public override bool Run()
        {
            try
            {
                if (Responder.Instance.TutorialModel.IsTutorialRunning())
                {
                    if (!Target.CancelTutorial())
                    {
                        return(false);
                    }
                    Responder.Instance.TutorialModel.ForceExitTutorial();
                }

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

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

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

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

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

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

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

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

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

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

                    // Custom
                    GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld();

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

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

            return(false);
        }
Пример #3
0
        public override bool Run()
        {
            try
            {
                if (Responder.Instance.TutorialModel.IsTutorialRunning())
                {
                    if (!Target.CancelTutorial())
                    {
                        return(false);
                    }
                    Responder.Instance.TutorialModel.ForceExitTutorial();
                }

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

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

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

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

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

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

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

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

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

                AnimateSim("Exit");

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

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

            return(false);
        }
Пример #4
0
        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);
        }
Пример #6
0
        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 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;
            }
        }
Пример #8
0
 private new static void TriggerTravelToHomeWorld()
 {
     SimpleMessageDialog.Show(TravelUtil.LocalizeString("TermOverCaption", new object[0x0]), TravelUtil.LocalizeString("TermOverText", new object[0x0]), ModalDialog.PauseMode.PauseSimulator);
     GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld();
 }