Ejemplo n.º 1
0
        protected override OptionResult RunAll(List <IMiniSimDescription> sims)
        {
            List <SimDescription> trueSims = new List <SimDescription>();

            foreach (IMiniSimDescription miniSim in sims)
            {
                SimDescription trueSim = miniSim as SimDescription;
                if (trueSim == null)
                {
                    continue;
                }

                trueSims.Add(trueSim);
            }

            int termLen   = 0;
            int totalCost = 0;

            List <IEnrollmentData> list = EnrollmentDialogEx.Show(trueSims[0], trueSims, true, out termLen, out totalCost);

            if ((list != null) && (list.Count > 0))
            {
                AcademicCareer.GlobalTermLength = (AcademicCareer.TermLength)termLen;

                foreach (IEnrollmentData data in list)
                {
                    SimDescription enrollingSimDesc = data.EnrollingSimDesc as SimDescription;
                    if ((enrollingSimDesc != null) &&
                        (enrollingSimDesc.CareerManager != null) &&
                        (enrollingSimDesc.CareerManager.DegreeManager != null))
                    {
                        enrollingSimDesc.CareerManager.DegreeManager.SetEnrollmentData(data);

                        if (enrollingSimDesc.CreatedSim != null)
                        {
                            EventTracker.SendEvent(new AcademicEvent(EventTypeId.kEnrolledInUniversity, enrollingSimDesc.CreatedSim, (AcademicDegreeNames)data.AcademicDegreeName));
                        }

                        AcademicCareer.EnrollSimInAcademicCareer(enrollingSimDesc, (AcademicDegreeNames)data.AcademicDegreeName, data.CourseLoad);

                        CustomAcademicDegrees.AdjustCustomAcademics(enrollingSimDesc);
                    }
                }
            }

            return(OptionResult.SuccessRetain);
        }
Ejemplo n.º 2
0
        public static PlaceResults LocateHomeAndPlaceSimsAtVacationWorld(Household household, ref Sim simToSelect)
        {
            PlaceResults results = PlaceResults.Failure;

            Common.StringBuilder msg = new Common.StringBuilder("LocateHomeAndPlaceSimsAtVacationWorld" + Common.NewLine);

            try
            {
                if (household != null)
                {
                    msg += "A";

                    if (GameStates.DestinationTravelWorld == WorldName.University)
                    {
                        Dictionary <SimDescription, AcademicDegreeManager> managers = new Dictionary <SimDescription, AcademicDegreeManager>();

                        try
                        {
                            foreach (SimDescription sim in Households.All(household))
                            {
                                if (sim.CareerManager == null)
                                {
                                    continue;
                                }

                                managers[sim] = sim.CareerManager.DegreeManager;

                                if ((sim.ChildOrBelow) || (sim.IsPet))
                                {
                                    sim.CareerManager.mDegreeManager = null;
                                }
                                else if ((sim.CareerManager.DegreeManager != null) && (sim.CareerManager.DegreeManager.EnrollmentCouseLoad == 0))
                                {
                                    sim.CareerManager.mDegreeManager = null;
                                }
                            }

                            TravelUtil.MoveIntoUniversityHousehold(household);

                            foreach (SimDescription sim in Households.All(household))
                            {
                                CustomAcademicDegrees.AdjustCustomAcademics(sim);
                            }
                        }
                        finally
                        {
                            foreach (SimDescription sim in Households.All(household))
                            {
                                if (sim.CareerManager == null)
                                {
                                    continue;
                                }

                                AcademicDegreeManager manager;
                                if (!managers.TryGetValue(sim, out manager))
                                {
                                    continue;
                                }

                                sim.CareerManager.mDegreeManager = manager;
                            }
                        }

                        results = PlaceResults.BaseCamp;
                    }
                    else
                    {
                        TravelUtil.ProcessDeedsAndMoveInHousehold(household);

                        if (household.LotHome == null)
                        {
                            msg += "B";

                            bool manual = false;

                            Lot choice = PromptForLot();
                            if (choice == null)
                            {
                                choice = FindLot();
                            }
                            else
                            {
                                manual = true;
                            }

                            if (choice != null)
                            {
                                msg += "C";

                                msg += Common.NewLine + choice.Name + Common.NewLine;

                                choice.MoveIn(household);

                                Mailbox mailboxOnLot = Mailbox.GetMailboxOnLot(choice);
                                if (mailboxOnLot != null)
                                {
                                    mailboxOnLot.ListenToReturnFromWorld();
                                }

                                if (household.LotHome != null)
                                {
                                    msg += "D";

                                    if (manual)
                                    {
                                        results = PlaceResults.BaseCamp;
                                    }
                                    else
                                    {
                                        results = PlaceResults.Residential;
                                    }
                                }
                            }
                        }
                        else
                        {
                            msg += "E";

                            results = PlaceResults.BaseCamp;
                        }
                    }

                    if (household.LotHome != null)
                    {
                        msg += "F";

                        foreach (Service service in Services.AllServices)
                        {
                            if (service == null)
                            {
                                continue;
                            }

                            if (service.DefaultIsRequested())
                            {
                                continue;
                            }

                            service.MakeServiceRequest(household.LotHome, false, ObjectGuid.InvalidObjectGuid);
                        }

                        TravelUtil.TriggerTutorial(household);
                        TravelUtil.PlaceSimsOnSafeSpots(household, ref simToSelect);
                    }
                }
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
            finally
            {
                Traveler.InsanityWriteLog(msg);
            }

            return(results);
        }
Ejemplo n.º 3
0
        public static PlaceResults LocateHomeAndPlaceSimsAtVacationWorld(Household household, ref Sim simToSelect)
        {
            PlaceResults results = PlaceResults.Failure;

            Common.StringBuilder msg = new Common.StringBuilder("LocateHomeAndPlaceSimsAtVacationWorld" + Common.NewLine);

            try
            {
                if (household != null)
                {
                    msg += "A";

                    if (GameStates.DestinationTravelWorld == WorldName.University)
                    {
                        Dictionary <SimDescription, AcademicDegreeManager> managers = new Dictionary <SimDescription, AcademicDegreeManager>();

                        try
                        {
                            foreach (SimDescription sim in Households.All(household))
                            {
                                if (sim.CareerManager == null)
                                {
                                    continue;
                                }

                                managers[sim] = sim.CareerManager.DegreeManager;

                                if ((sim.ChildOrBelow) || (sim.IsPet))
                                {
                                    sim.CareerManager.mDegreeManager = null;
                                }
                                else if ((sim.CareerManager.DegreeManager != null) && (sim.CareerManager.DegreeManager.EnrollmentCouseLoad == 0))
                                {
                                    sim.CareerManager.mDegreeManager = null;
                                }
                            }

                            TravelUtil.MoveIntoUniversityHousehold(household);

                            foreach (SimDescription sim in Households.All(household))
                            {
                                CustomAcademicDegrees.AdjustCustomAcademics(sim);
                            }
                        }
                        finally
                        {
                            foreach (SimDescription sim in Households.All(household))
                            {
                                if (sim.CareerManager == null)
                                {
                                    continue;
                                }

                                AcademicDegreeManager manager;
                                if (!managers.TryGetValue(sim, out manager))
                                {
                                    continue;
                                }

                                sim.CareerManager.mDegreeManager = manager;
                            }
                        }

                        results = PlaceResults.BaseCamp;
                    }
                    else
                    {
                        TravelUtil.ProcessDeedsAndMoveInHousehold(household);

                        if (household.LotHome == null)
                        {
                            msg += "B";

                            bool manual = false;

                            Lot choice = PromptForLot();
                            if (choice == null)
                            {
                                choice = FindLot();
                            }
                            else
                            {
                                manual = true;
                            }

                            if (choice != null)
                            {
                                msg += "C";

                                msg += Common.NewLine + choice.Name + Common.NewLine;

                                choice.MoveIn(household);

                                Mailbox mailboxOnLot = Mailbox.GetMailboxOnLot(choice);
                                if (mailboxOnLot != null)
                                {
                                    mailboxOnLot.ListenToReturnFromWorld();
                                }

                                if (household.LotHome != null)
                                {
                                    msg += "D";

                                    if (manual)
                                    {
                                        results = PlaceResults.BaseCamp;
                                    }
                                    else
                                    {
                                        results = PlaceResults.Residential;
                                    }
                                }
                            }
                        }
                        else
                        {
                            msg += "E";

                            results = PlaceResults.BaseCamp;
                        }
                    }

                    if (household.LotHome != null)
                    {
                        msg += "F";

                        foreach (Service service in Services.AllServices)
                        {
                            if (service == null)
                            {
                                continue;
                            }

                            if (service.DefaultIsRequested())
                            {
                                continue;
                            }

                            service.MakeServiceRequest(household.LotHome, false, ObjectGuid.InvalidObjectGuid);
                        }

                        TravelUtil.TriggerTutorial(household);
                        TravelUtil.PlaceSimsOnSafeSpots(household, ref simToSelect);

                        // core block in pusharriveinteraction on ITimePortal preventing teens who travel alone from getting the arrive interaction thus
                        // appearing invisible
                        bool flag = true;
                        foreach (SimDescription desc in household.SimDescriptions)
                        {
                            if (desc.YoungAdultOrAbove)
                            {
                                flag = false;
                                break;
                            }
                        }

                        ITimePortal[] portalArray;
                        if (flag && ArriveHomeBehaviorInVacationWorld.ShouldArriveByTimePortal(household.LotHome, out portalArray))
                        {
                            new Common.AlarmTask(3f, TimeUnit.Minutes, PushArriveHomeInteractionEx);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
            finally
            {
                Traveler.InsanityWriteLog(msg);
            }

            return(results);
        }