示例#1
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);
        }
示例#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);

                        // 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);
        }