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);
                    }
                }
            }
        }
Esempio n. 2
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();
                }
            }
        }
Esempio n. 3
0
        public static Lot PromptForLot()
        {
            Lot baseCampLot = LotManager.GetBaseCampLot();

            if (!UIUtils.IsOkayToStartModalDialog(false, true))
            {
                return(null);
            }

            List <IMapTagPickerInfo> mapTagPickerInfos = new List <IMapTagPickerInfo>();

            mapTagPickerInfos.Add(new MapTagPickerLotInfo(baseCampLot, MapTagType.BaseCamp));
            Dictionary <ulong, bool> dictionary = new Dictionary <ulong, bool>();

            foreach (Lot lot in LotManager.AllLots)
            {
                if (!lot.IsResidentialLot)
                {
                    continue;
                }

                if (lot.IsWorldLot)
                {
                    continue;
                }

                if (lot.Household != null)
                {
                    continue;
                }

                if (lot.ResidentialLotSubType == ResidentialLotSubType.kEP1_PlayerOwnable)
                {
                    continue;
                }

                Lot.LotMetrics metrics = new Lot.LotMetrics();
                lot.GetLotMetrics(ref metrics);
                if (metrics.FridgeCount == 0)
                {
                    continue;
                }

                if ((lot != null) && !dictionary.ContainsKey(lot.LotId))
                {
                    dictionary[lot.LotId] = true;
                    mapTagPickerInfos.Add(new MapTagPickerLotInfo(lot, MapTagType.AvailableHousehold));
                }
            }

            GameUtils.EnableSceneDraw(true);
            LoadingScreenController.Unload();
            while (LoadingScreenController.Instance != null)
            {
                SpeedTrap.Sleep(0);
            }

            IMapTagPickerInfo info = MapTagPickerDialog.Show(mapTagPickerInfos, TravelUtil.LocalizeString("ChooseHomeLot", new object[0]), TravelUtil.LocalizeString("Accept", new object[0]), false);

            if (info == null)
            {
                return(null);
            }

            return(LotManager.GetLot(info.LotId));
        }
Esempio n. 4
0
        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);
                    }
                }
            }
        }
Esempio n. 5
0
            public override bool Test(Sim actor, Phone target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (base.Test(actor, target, isAutonomous, ref greyedOutTooltipCallback))
                {
                    if (isAutonomous)
                    {
                        if (!Woohooer.Settings.mWoohootyTextAutonomous[PersistedSettings.GetSpeciesIndex(actor)])
                        {
                            return(false);
                        }
                    }

                    if (!actor.IsAtHome)
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(TravelUtil.LocalizeString(actor.IsFemale, "NotAtHome", new object[] { actor }));
                        return(false);
                    }

                    if (!base.CanSimInviteOver(actor, isAutonomous) || !base.CanInviteOverToLot(actor.LotCurrent, isAutonomous))
                    {
                        greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(TravelUtil.LocalizeString(actor.IsFemale, "CannotInviteOver", new object[] { actor }));
                        return(false);
                    }

                    if (actor.SimDescription.IsEP11Bot)
                    {
                        if ((actor.TraitManager == null) || !actor.TraitManager.HasElement(TraitNames.CapacityToLoveChip))
                        {
                            return(false);
                        }
                    }

                    bool flag  = false;
                    bool flag2 = false;
                    if (actor.SimDescription.Teen && Woohooer.Settings.AllowTeen(true))
                    {
                        flag = true;
                    }

                    if (actor.SimDescription.Teen && Woohooer.Settings.AllowTeenAdult(true))
                    {
                        flag2 = true;
                    }

                    bool locationTest = false;

                    foreach (IMiniRelationship relationship in Relationship.GetMiniRelationships(actor.SimDescription))
                    {
                        SimDescription description = SimDescription.Find(relationship.GetOtherSimDescriptionId(actor.SimDescription));
                        if (description != null && description.CreatedSim != null && description.CreatedSim.LotCurrent != actor.LotCurrent && !description.ChildOrBelow && description.IsHuman)
                        {
                            if (!flag && actor.SimDescription.Teen && description.Teen)
                            {
                                continue;
                            }

                            if (!flag2 && actor.SimDescription.Teen && description.YoungAdultOrAbove)
                            {
                                continue;
                            }

                            if (isAutonomous && !CommonSocials.CheckAutonomousGenderPreference(actor.SimDescription, description))
                            {
                                continue;
                            }

                            if (isAutonomous && !CommonWoohoo.SatisfiesCooldown(actor, description.CreatedSim, isAutonomous, ref greyedOutTooltipCallback))
                            {
                                continue;
                            }

                            if (!locationTest)
                            {
                                // only humans can use this so we don't need to keep scanning the lot each loop
                                if (!CommonWoohoo.HasWoohooableObject(actor.LotHome, actor, description.CreatedSim))
                                {
                                    return(false);
                                }
                                else
                                {
                                    locationTest = true;
                                }
                            }


                            return(true);
                        }
                    }
                }

                return(false);
            }
Esempio n. 6
0
        public static string CheckForReasonsToFailTravel(SimDescription simDescription, Type filter, WorldName worldName, bool isWorldMove, bool testMoveRequested)
        {
            try
            {
                if (simDescription == null) return null;

                if (testMoveRequested)
                {
                    if ((TravelUtil.PlayerMadeTravelRequest) || (GameStates.WorldMoveRequested))
                    {
                        return TravelUtil.LocalizeString(simDescription.IsFemale, "AnotherTravelRequested", new object[] { simDescription });
                    }
                }

                bool playerMadeTravelRequest = TravelUtil.PlayerMadeTravelRequest;
                try
                {
                    TravelUtil.PlayerMadeTravelRequest = false;

                    string failReason = null;
                    if (!InWorldSubState.IsEditTownValid(simDescription.LotHome, ref failReason))
                    {
                        if (!string.IsNullOrEmpty(failReason) && Localization.HasLocalizationString("Gameplay/Visa/TravelUtil:EditTownInvalid" + failReason))
                        {
                            return TravelUtil.LocalizeString(simDescription.IsFemale, "EditTownInvalid" + failReason, new object[] { simDescription });
                        }

                        return TravelUtil.LocalizeString(simDescription.IsFemale, "EditTownInvalid", new object[] { simDescription });
                    }
                }
                finally
                {
                    TravelUtil.PlayerMadeTravelRequest = playerMadeTravelRequest;
                }

                foreach (Sim sim in Households.AllSims(simDescription.Household))
                {
                    try
                    {
                        if (sim.IsDying())
                        {
                            return TravelUtil.LocalizeString(sim.IsFemale, "FamilyMemberIsDying", new object[] { sim });
                        }
                        else if (sim.Autonomy.SituationComponent.InSituationOfType(typeof(ParentsLeavingTownSituation)))
                        {
                            return TravelUtil.LocalizeString(sim.IsFemale, "ParentsOutOfTown", new object[] { sim });
                        }
                        else if (sim.InteractionQueue.HasInteractionOfType(AgeDown.Singleton))
                        {
                            return TravelUtil.LocalizeString(sim.IsFemale, "SomeoneIsAgingDown", new object[] { sim });
                        }
                        else if ((sim != simDescription.CreatedSim) && sim.InteractionQueue.HasInteractionOfType(typeof(IAmMovingInteraction)))
                        {
                            return TravelUtil.LocalizeString(sim.IsFemale, "AnotherTravelRequested", new object[] { sim });
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(sim, e);
                        return "(Error)";
                    }
                }

                if (!isWorldMove)
                {
                    if ((worldName != WorldName.FutureWorld) && (simDescription.ToddlerOrBelow))
                    {
                        if ((filter & Type.Toddlers) == Type.None)
                        {
                            return TravelUtil.LocalizeString(simDescription.IsFemale, "TooYoungToTravel", new object[] { simDescription });
                        }
                    }

                    if ((worldName == WorldName.University) && (simDescription.Teen))
                    {
                        if ((filter & Type.Teens) == Type.None)
                        {
                            return TravelUtil.LocalizeString(simDescription.IsFemale, "TooYoungToTravel", new object[] { simDescription });
                        }
                    }

                    if ((worldName == WorldName.University) && (simDescription.ChildOrBelow))
                    {
                        if ((filter & Type.Children) == Type.None)
                        {
                            return TravelUtil.LocalizeString(simDescription.IsFemale, "TooYoungToTravel", new object[] { simDescription });
                        }
                    }

                    if (simDescription.IsPet)
                    {
                        if ((filter & Type.Pets) == Type.None)
                        {
                            return Common.Localize("Travel:PetDeny", simDescription.IsFemale, new object[] { simDescription });
                        }
                    }

                    if ((worldName != WorldName.University) && (worldName != WorldName.FutureWorld) && (simDescription.CreatedSim != null) && simDescription.CreatedSim.BuffManager.HasElement(BuffNames.WentToLocation))
                    {
                        if ((filter & Type.Recovering) == Type.None)
                        {
                            return TravelUtil.LocalizeString(simDescription.IsFemale, "RecoveringFromVacation", new object[] { simDescription });
                        }
                    }
                }

                if (Sims3.Gameplay.Passport.Passport.IsHouseholdSimAwayInPassport(simDescription.Household))
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "SimInPassport", new object[] { simDescription });
                }

                if ((simDescription.CreatedSim != null) && simDescription.CreatedSim.BuffManager.HasElement(BuffNames.VampireBite))
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "VampireBite", new object[] { simDescription });
                }

                if (simDescription.IsVisuallyPregnant)
                {
                    if ((filter & Type.Pregnant) == Type.None)
                    {
                        return TravelUtil.LocalizeString(simDescription.IsFemale, "IsPregnant", new object[] { simDescription });
                    }
                }

                Sim createdSim = simDescription.CreatedSim;

                if ((createdSim != null) && createdSim.BuffManager.HasElement(BuffNames.MalePregnancy))
                {
                    if ((filter & Type.Pregnant) == Type.None)
                    {
                        return TravelUtil.LocalizeString(simDescription.IsFemale, "ConditionPreventsTravel", new object[] { simDescription });
                    }
                }

                if ((createdSim != null) && createdSim.IsDying())
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "IsDying", new object[] { simDescription });
                }

                if ((createdSim != null) && (createdSim.CurrentInteraction is IGoToJail))
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "IsInJail", new object[] { simDescription });
                }

                if (simDescription.IsEnrolledInBoardingSchool())
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "IsInBoardingSchool", new object[] { simDescription });
                }

                if ((ParentsLeavingTownSituation.Adults != null) && ParentsLeavingTownSituation.Adults.Contains(simDescription.SimDescriptionId))
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "ParentsOutOfTown", new object[] { simDescription });
                }

                if (simDescription.mCurrentPassportChallengeID != PassportChallenges.ChallengeIds.InvalidChallenge)
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "AwayInPassport", new object[] { simDescription });
                }

                if ((createdSim != null) && createdSim.BuffManager.HasElement(BuffNames.Ensorcelled))
                {
                    return TravelUtil.LocalizeString(simDescription.IsFemale, "Ensorcelled", new object[] { simDescription });
                }

                if (filter == Type.None)
                {
                    if ((createdSim != null) && (TravelUtil.HasBlockingTransformBuff(createdSim, worldName == WorldName.FutureWorld)))
                    {
                        return TravelUtil.LocalizeString(simDescription.IsFemale, "NoTravelWhileTransformed", new object[0]);
                    }
                }

                return null;
            }
            catch (Exception e)
            {
                Common.Exception(simDescription, e);
                return "(Error)";
            }
        }
Esempio n. 7
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();
 }