Beispiel #1
0
        public override void OnPhoneFinished()
        {
            try
            {
                if (GameUtils.gGameUtils.GetCurrentWorldName() == WorldName.University)
                {
                    if (mIsEnrolled)
                    {
                        if (mTravelers != null)
                        {
                            Actor.ModifyFunds(-mTuitionCost);

                            AcademicCareerEx.Enroll(mTravelers);
                        }
                    }
                }
                else
                {
                    base.OnPhoneFinished();
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
        }
Beispiel #2
0
            public bool IncrementOneDay(SimDescription sim, ref Household.ReportCardHelper reportCardHelper)
            {
                try
                {
                    mCurrentDay++;

                    // Set for possible use in sub-routines
                    AcademicCareer.GlobalTermLength = mLength;

                    int length = (int)mLength * NRaas.Careers.Settings.mHomeworldUniversityTermLength;

                    Common.DebugNotify("Increment One Day\n" + mCurrentDay + "\n" + length, sim);

                    AcademicCareer academicCareer = sim.OccupationAsAcademicCareer;
                    if (academicCareer == null)
                    {
                        return(false);
                    }

                    if (mCurrentDay >= length)
                    {
                        if (SimTypes.IsSelectable(sim))
                        {
                            if (reportCardHelper == null)
                            {
                                reportCardHelper = new Household.ReportCardHelper();
                            }

                            reportCardHelper.AddGPA(sim.SimDescriptionId, academicCareer.GetGradeAsLetter());
                        }

                        AcademicCareerEx.OnTermCompleted(academicCareer);
                        return(false);
                    }
                    else if (mCurrentDay == (length - 0x1))
                    {
                        if (SimTypes.IsSelectable(sim))
                        {
                            float num2 = SimClock.HoursUntil(Household.kWhenOneDayLeftTNSAppears);

                            AlarmManager.Global.RemoveAlarm(sim.Household.mLastDayAlarm);
                            sim.Household.mLastDayAlarm = AlarmManager.Global.AddAlarm(num2, TimeUnit.Hours, sim.Household.OneDayLeft, "One Day left TNS", AlarmType.AlwaysPersisted, sim);
                        }
                    }
                }
                catch (ResetException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    Common.Exception(sim, e);
                }

                return(true);
            }
        public override bool Run()
        {
            try
            {
                StandardEntry();
                if (!Target.StartComputing(this, SurfaceHeight.Table, true))
                {
                    StandardExit();
                    return(false);
                }

                Target.StartVideo(Computer.VideoType.Browse);
                AnimateSim("GenericTyping");
                bool flag = DoTimedLoop(kTimeToSpendEnrolling, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                if (flag)
                {
                    List <SimDescription> others = null;
                    int tuitionCost = 0;

                    flag = AcademicCareerEx.EnrollInAcademicCareer(Actor, Traveler.Settings.mTravelFilter, out others, out tuitionCost);
                    if (flag)
                    {
                        if (GameUtils.gGameUtils.GetCurrentWorldName() == WorldName.University)
                        {
                            if (others != null)
                            {
                                Actor.ModifyFunds(-tuitionCost);

                                AcademicCareerEx.Enroll(others);
                            }
                        }
                        else
                        {
                            TravelUtil.TriggerTravelToUniversityWorld(others, tuitionCost);
                        }
                    }
                }

                Target.StopComputing(this, Computer.StopComputingAction.TurnOff, false);
                StandardExit();
                return(flag);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Beispiel #4
0
        public override bool InRabbitHole()
        {
            try
            {
                List <SimDescription> others = null;
                int tuitionCost = 0;

                try
                {
                    List <SimDescription> choices = new List <SimDescription>();
                    foreach (SimDescription sim in Households.Humans(Actor.Household))
                    {
                        if (sim.TeenOrAbove)
                        {
                            choices.Add(sim);
                        }
                    }

                    if (AcademicCareerEx.EnrollInAcademicCareer(Actor, choices, out others, out tuitionCost))
                    {
                        if (others != null)
                        {
                            Actor.ModifyFunds(-tuitionCost);

                            foreach (SimDescription sim in others)
                            {
                                AcademicHelper.AddAcademic(sim, AcademicCareer.GlobalTermLength);
                            }

                            AcademicCareerEx.Enroll(others);
                        }
                    }
                }
                finally
                {
                    TravelUtil.PlayerMadeTravelRequest = false;
                }

                return(true);
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
            }
            return(true);
        }
Beispiel #5
0
        public override Phone.Call.ConversationBehavior OnCallConnected()
        {
            try
            {
                if (AcademicCareerEx.EnrollInAcademicCareer(Actor, Traveler.Settings.mTravelFilter, out mTravelers, out mTuitionCost))
                {
                    mIsEnrolled = true;
                    return(Phone.Call.ConversationBehavior.ExpressSatisfaction);
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(Phone.Call.ConversationBehavior.ExpressDisappointment);
        }
Beispiel #6
0
        public override bool Run()
        {
            try
            {
                List <SimDescription> others = null;
                int tuitionCost = 0;

                if (AcademicCareerEx.EnrollInAcademicCareer(Actor, Traveler.Settings.mTravelFilter, out others, out tuitionCost))
                {
                    TravelUtil.TriggerTravelToUniversityWorld(others, tuitionCost);
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Beispiel #7
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);
            }
        }