public override void Init(ForeignVisitorsSituation parent)
            {
                try
                {
                    if (parent.Host.IsSelectable)
                    {
                        StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/Situations/InviteForeignVisitors:GoPrepare", new object[] { parent.Host }), StyledNotification.NotificationStyle.kGameMessagePositive));
                    }

                    parent.Host.Motives.CreateMotive(parent.PreparationMotive());
                    parent.OnPreparation();

                    float time = SimClock.ElapsedTime(TimeUnit.Hours, SimClock.CurrentTime(), Parent.StartTime) - parent.GetParams().HoursBeforePartyToInvite;
                    if (time <= 0f)
                    {
                        Parent.SetState(new TryInviteEx(Parent));
                    }
                    else
                    {
                        mAlarmGuestInvite = AlarmManager.AddAlarm(time, TimeUnit.Hours, TimeToInviteGuestsEx, "Invite Guests To Foreign Visitors Situation", AlarmType.AlwaysPersisted, Parent.Host);
                        AlarmManager.AlarmWillYield(mAlarmGuestInvite);
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("PrepareEx:Init", e);
                }
            }
Beispiel #2
0
        protected void TriggerMoveToNewWorldEx()
        {
            RemoveTriggerAlarm();
            List <Sim> allTravelers = new List <Sim>(Followers);

            allTravelers.Add(Actor);

            // Custom
            string reason = null;

            if (Helpers.TravelUtilEx.FinalBoardingCall(Actor.Household, allTravelers, WorldName.Undefined, true, ref reason))
            {
                ForeignVisitorsSituation.ForceKillForeignVisitorsSituation();
                HolographicProjectionSituation.ForceKillHolographicVisitorsSituation();
                Camera.SetView(CameraView.MapView, false, true);

                // Custom
                GameStatesEx.MoveToNewWorld(DestinationWorldName, TravelingSimGuids, mMovingWorldSaved, mPackFurniture);
            }
            else
            {
                GameStates.WorldMoveRequested = false;
                Actor.ShowTNSIfSelectable(Common.LocalizeEAString(Actor.IsFemale, "Gameplay/Visa/TravelUtil:ForceMoveCancel") + Common.NewLine + Common.NewLine + reason, StyledNotification.NotificationStyle.kSystemMessage, ObjectGuid.InvalidObjectGuid);
                foreach (Sim sim in allTravelers)
                {
                    if (!sim.IsDying())
                    {
                        sim.AddExitReason(ExitReason.CanceledByScript);
                    }
                }
            }
        }
Beispiel #3
0
        public override void HourlyCallback()
        {
            if (GameUtils.IsOnVacation() || GameUtils.IsUniversityWorld())
            {
                Common.DebugNotify(mMom.FullName + Common.NewLine + "RobotPregnancy.HourlyCallback" + Common.NewLine + " - Pregnancy Paused");
                return;
            }

            mHourOfPregnancy++;

            string msg = mMom.FullName + Common.NewLine + "RobotPregnancy.HourlyCallback" + Common.NewLine + " - Hour: " + mHourOfPregnancy + Common.NewLine;

            if (mMom.Household.IsTouristHousehold)
            {
                msg += " - Foreign Sim" + Common.NewLine;

                ForeignVisitorsSituation foreignVisitorsSituation = ForeignVisitorsSituation.TryGetForeignVisitorsSituation(mMom);

                if (mHourOfPregnancy == Woohooer.Settings.mForeignRobotDisplayTNS && foreignVisitorsSituation != null)
                {
                    StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:ForeignBabyIsComingTNS",
                                                                                                      new object[] { mMom }), StyledNotification.NotificationStyle.kGameMessagePositive), "glb_tns_baby_coming_r2");
                }

                if (mHourOfPregnancy == Woohooer.Settings.mForeignRobotLeavesWorld)
                {
                    if (foreignVisitorsSituation != null)
                    {
                        foreignVisitorsSituation.MakeGuestGoHome(mMom);
                    }
                    else if (mMom.SimDescription.AssignedRole != null)
                    {
                        mMom.SimDescription.AssignedRole.RemoveSimFromRole();
                    }
                }

                if (mHourOfPregnancy > Woohooer.Settings.mForeignRobotLeavesWorld)
                {
                    Common.DebugNotify(msg);

                    mHourOfPregnancy--;
                    return;
                }
            }

            if (mHourOfPregnancy >= Woohooer.Settings.mRobotHourToStartWalkingPregnant)
            {
                ActiveTopic.AddToSim(mMom, "Pregnant", mMom.SimDescription);
                RequestPregnantWalkStyle();
            }

            if (mHourOfPregnancy == Woohooer.Settings.mRobotHoursOfPregnancy)
            {
                msg += " - Having the Baby";
                HaveTheBaby();
            }

            Common.DebugNotify(msg);
        }
        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);
                    }
                }
            }
        }
            private bool UnpackForeignVisitors(ForeignVisitorsSituation ths)
            {
                foreach (MiniSimDescription description in ths.GuestMiniDescriptions)
                {
                    SimDescription simDescription = MiniSims.ImportWithCheck(description);
                    if (simDescription == null)
                    {
                        continue;
                    }

                    ths.GuestDescriptions.Add(simDescription);
                }

                return(ths.GuestDescriptions.Count > 0x0);
            }
Beispiel #6
0
            protected override void OnPerform()
            {
                if (!mSimGuids.Contains(mActor.SimDescription.SimDescriptionId))
                {
                    mSimGuids.Add(mActor.SimDescription.SimDescriptionId);
                }

                ForeignVisitorsSituation.ForceKillForeignVisitorsSituation();
                HolographicProjectionSituation.ForceKillHolographicVisitorsSituation();
                Camera.SetView(CameraView.MapView, false, true);

                // Custom
                CleanUpReservedVehicles(mActor, mFollowers);

                if (mPortal != null)
                {
                    mPortal.StopActiveFX();
                }

                // Custom
                GameStatesEx.TravelToVacationWorld(WorldName.FutureWorld, mSimGuids, 0x0, 0x0);
                CauseEffectService.GetInstance().SetDepartureTimePortal(mPortal.ObjectId);
            }
            public override void Init(ForeignVisitorsSituation parent)
            {
                try
                {
                    base.Init(parent);

                    AlarmManager.RemoveAlarm(mAlarmHandle);

                    float time = SimClock.ElapsedTime(TimeUnit.Hours, SimClock.CurrentTime(), Parent.StartTime) - parent.GetParams().PreparationTime;
                    if (time <= 0)
                    {
                        Parent.SetState(new PrepareEx(Parent));
                    }
                    else
                    {
                        mAlarmHandle = AlarmManager.AddAlarm(time, TimeUnit.Hours, TimeToPrepareEx, "Prepare Foreign Visit", AlarmType.AlwaysPersisted, Parent.Host);
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("WaitForPreparationsEx:Init", e);
                }
            }
Beispiel #8
0
        public override void HourlyCallback()
        {
            if (GameUtils.IsOnVacation() || GameUtils.IsUniversityWorld())
            {
                Common.DebugNotify("AlienPregnancy.HourlyCallback - Pregnancy paused");
                return;
            }

            mHourOfPregnancy++;

            string msg = mMom.FullName + Common.NewLine
                         + "AlienPregnancy.HourlyCallback" + Common.NewLine
                         + " - Hour: " + mHourOfPregnancy + Common.NewLine;

            if (mHourOfPregnancy == Aliens.Settings.mPregnancyShow)
            {
                msg += " - Showing Pregnancy";

                InteractionInstance instance = ShowAlienPregnancy.Singleton.CreateInstance(mMom, mMom,
                                                                                           new InteractionPriority(InteractionPriorityLevel.ESRB), false, false);
                instance.Hidden = true;
                mMom.InteractionQueue.AddNext(instance);

                Common.DebugNotify(msg);

                return;
            }

            if (mMom.Household.IsTouristHousehold)
            {
                msg += " - Mother is Tourist" + Common.NewLine;

                ForeignVisitorsSituation situation = ForeignVisitorsSituation.TryGetForeignVisitorsSituation(mMom);

                if (mHourOfPregnancy == Aliens.Settings.mForeignShowTNS && situation != null)
                {
                    StyledNotification.Show(new StyledNotification.Format(
                                                Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:ForeignBabyIsComingTNS",
                                                                            new object[] { mMom }), StyledNotification.NotificationStyle.kGameMessagePositive));
                }

                if (mHourOfPregnancy == Aliens.Settings.mForeignLeaves)
                {
                    msg += " - Sending Pregnant Tourist Home";

                    if (situation != null)
                    {
                        situation.MakeGuestGoHome(mMom);
                    }
                    else if (mMom.SimDescription.AssignedRole != null)
                    {
                        mMom.SimDescription.AssignedRole.RemoveSimFromRole();
                    }

                    Common.DebugNotify(msg);
                }

                if (mHourOfPregnancy > Aliens.Settings.mForeignLeaves)
                {
                    msg += " - Walking Back 1 Hour";

                    mHourOfPregnancy--;

                    Common.DebugNotify(msg);

                    return;
                }
            }

            if (mHourOfPregnancy >= Aliens.Settings.mStartWalk)
            {
                ActiveTopic.AddToSim(mMom, "Pregnant", mMom.SimDescription);
                RequestPregnantWalkStyle();
            }

            if (mHourOfPregnancy == Aliens.Settings.mStartLabor)
            {
                msg += " - Beginning Labor" + Common.NewLine;

                for (int i = 0; i < Aliens.Settings.mNumPuddles; i++)
                {
                    PuddleManager.AddPuddle(mMom.PositionOnFloor);
                }

                if (mMom.IsSelectable)
                {
                    StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:BabyIsComingTNS",
                                                                                                      new object[] { mMom }), StyledNotification.NotificationStyle.kGameMessageNegative), "glb_tns_baby_coming_r2");
                }

                mMom.BuffManager.RemoveElement(BuffsAndTraits.sXenogenesis);
                mMom.BuffManager.AddElement(BuffsAndTraits.sAlienBabyIsComing, Origin.FromPregnancy);

                if (mContractionBroadcast != null)
                {
                    mContractionBroadcast.Dispose();
                }

                mContractionBroadcast = new ReactionBroadcaster(mMom, kContractionBroadcasterParams,
                                                                new ReactionBroadcaster.BroadcastCallback(StartReaction), new ReactionBroadcaster.BroadcastCallback(CancelReaction));
                mMom.AddInteraction(TakeToHospitalEx.Singleton);
                InteractionInstance entry = HaveContraction.Singleton.CreateInstance(mMom, mMom,
                                                                                     new InteractionPriority(InteractionPriorityLevel.High, 10f), false, false);
                mMom.InteractionQueue.Add(entry);
                mContractionsAlarm = mMom.AddAlarmRepeating(5f, TimeUnit.Minutes, new AlarmTimerCallback(TriggerContraction), 5f, TimeUnit.Minutes,
                                                            "Trigger Contractions Alarm", AlarmType.AlwaysPersisted);
                EventTracker.SendEvent(EventTypeId.kPregnancyContractionsStarted, mMom);
            }

            if (mHourOfPregnancy >= Aliens.Settings.mPregnancyDuration)
            {
                msg += " - Delivering Baby" + Common.NewLine;
                HaveTheBaby();
            }

            SetPregoBlendShape();

            Common.DebugNotify(msg);
        }
Beispiel #9
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);
                    }
                }
            }
        }
 public PrepareEx(ForeignVisitorsSituation parent)
     : base(parent)
 {
 }
 public WaitForPreparationsEx(ForeignVisitorsSituation parent)
     : base(parent)
 {
 }
 public override void Init(ForeignVisitorsSituation parent)
 {
     mAlarmRetryInviteGuests = AlarmManager.AddAlarm(0f, TimeUnit.Seconds, InviteGuestsIfHostAtHomeEx, "Invite foreign visitors", AlarmType.AlwaysPersisted, Parent.Host);
     AlarmManager.AlarmWillYield(mAlarmRetryInviteGuests);
 }
 public TryInviteEx(ForeignVisitorsSituation parent)
     : base(parent)
 {
 }
Beispiel #14
0
        public override void HourlyCallback()
        {
            if (GameUtils.IsOnVacation() || GameUtils.IsUniversityWorld())
            {
                Common.DebugNotify(mMom.FullName + Common.NewLine + "HumanSurrogatePregnancy.HourlyCallback" + Common.NewLine + " - Pregnancy Paused");
                return;
            }

            mHourOfPregnancy++;

            string msg = mMom.FullName + Common.NewLine + "HumanSurrogatePregnancy.HourlyCallback" + Common.NewLine +
                         " - Hour: " + mHourOfPregnancy + Common.NewLine;

            if (mHourOfPregnancy == kHourToStartPregnantMotives)
            {
                mMom.BuffManager.AddElement(BuffNames.Nauseous, Origin.FromUnknown);
            }

            if (mHourOfPregnancy < kHourToShowPregnantBuff && mHourOfPregnancy > kHourToStartPregnantMotives)
            {
                mMom.BuffManager.AddElement(BuffNames.Nauseous, Origin.FromUnknown);
            }

            if (mMom.Household.IsTouristHousehold)
            {
                msg += " - Foreign Sim" + Common.NewLine;

                ForeignVisitorsSituation foreignVisitorsSituation = ForeignVisitorsSituation.TryGetForeignVisitorsSituation(mMom);

                if (mHourOfPregnancy == kForeignSimDisplaysTNS && foreignVisitorsSituation != null)
                {
                    StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:ForeignBabyIsComingTNS",
                                                                                                      new object[] { mMom }), StyledNotification.NotificationStyle.kGameMessagePositive), "glb_tns_baby_coming_r2");
                }

                if (mHourOfPregnancy == kForeignSimLeavesWorld)
                {
                    if (foreignVisitorsSituation != null)
                    {
                        foreignVisitorsSituation.MakeGuestGoHome(mMom);
                    }
                    else if (mMom.SimDescription.AssignedRole != null)
                    {
                        mMom.SimDescription.AssignedRole.RemoveSimFromRole();
                    }
                }

                if (mHourOfPregnancy > kForeignSimLeavesWorld)
                {
                    Common.DebugNotify(msg);

                    mHourOfPregnancy--;
                    return;
                }
            }

            if (mHourOfPregnancy == kHourToShowPregnantBuff)
            {
                msg += " - Adding Pregnant Buff" + Common.NewLine;
                Common.DebugNotify(msg);

                InteractionInstance interactionInstance = ShowPregnancyEx.Singleton.CreateInstance(mMom, mMom,
                                                                                                   new InteractionPriority(InteractionPriorityLevel.ESRB), false, false);
                interactionInstance.Hidden = true;
                mMom.InteractionQueue.AddNext(interactionInstance);
                return;
            }

            if (mHourOfPregnancy >= kHourToStartWalkingPregnant)
            {
                ActiveTopic.AddToSim(mMom, "Pregnant", mMom.SimDescription);
                RequestPregnantWalkStyle();
            }

            if (mHourOfPregnancy == kHourToStartContractions)
            {
                msg += " - Starting Labor" + Common.NewLine;

                for (int i = 0; i < kNumberOfPuddlesForWaterBreak; i++)
                {
                    PuddleManager.AddPuddle(mMom.PositionOnFloor);
                }

                if (mMom.IsSelectable)
                {
                    StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:BabyIsComingTNS",
                                                                                                      new object[] { mMom }), StyledNotification.NotificationStyle.kGameMessageNegative), "glb_tns_baby_coming_r2");
                }

                mMom.BuffManager.RemoveElement(BuffNames.Pregnant);
                mMom.BuffManager.AddElement(BuffNames.BabyIsComing, Origin.FromPregnancy);

                if (mContractionBroadcast != null)
                {
                    mContractionBroadcast.Dispose();
                }

                mContractionBroadcast = new ReactionBroadcaster(mMom, kContractionBroadcasterParams,
                                                                new ReactionBroadcaster.BroadcastCallback(StartReaction), new ReactionBroadcaster.BroadcastCallback(CancelReaction));
                mMom.AddInteraction(TakeToHospital.Singleton);
                InteractionInstance entry = HaveContraction.Singleton.CreateInstance(mMom, mMom, new InteractionPriority(InteractionPriorityLevel.High, 10f), false, false);
                mMom.InteractionQueue.Add(entry);
                mContractionsAlarm = mMom.AddAlarmRepeating(5f, TimeUnit.Minutes, new AlarmTimerCallback(TriggerContraction),
                                                            5f, TimeUnit.Minutes, "Trigger Contractions Alarm", AlarmType.AlwaysPersisted);
                EventTracker.SendEvent(EventTypeId.kPregnancyContractionsStarted, mMom);
            }

            if (mHourOfPregnancy == kHoursOfPregnancy)
            {
                msg += " - Having the Baby";
                HaveTheBaby();
            }

            SetPregoBlendShape();

            Common.DebugNotify(msg);
        }