예제 #1
0
        public static new bool StartInternal(Sim abductee, SimDescription alien)
        {
            if (!CommonPregnancy.CanGetPregnant(abductee, true, out string reason))
            {
                Common.DebugNotify("Alien Pregnancy: Auto Fail - " + reason);
                return(false);
            }

            AgingManager.Singleton.CancelAgingAlarmsForSim(abductee.SimDescription.AgingState);

            if (abductee.IsHuman)
            {
                AlienPregnancyProxy pregnancy = new AlienPregnancyProxy(abductee, alien);
                pregnancy.PreggersAlarm = abductee.AddAlarmRepeating(1f, TimeUnit.Hours, new AlarmTimerCallback(pregnancy.HourlyCallback),
                                                                     1f, TimeUnit.Hours, "Hourly Alien Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
                abductee.SimDescription.Pregnancy = pregnancy;
                EventTracker.SendEvent(new PregnancyEvent(EventTypeId.kGotPregnant, abductee, null, pregnancy, null));
            }
            else
            {
                Common.DebugNotify("Alien Pregnancy: Abductee is Pet");
                return(false);
            }

            ((AlienPregnancyProxy)abductee.SimDescription.Pregnancy).ApplyInitialMutationFactors();

            return(true);
        }
예제 #2
0
        public static bool Pollinate(Sim man, Sim woman)
        {
            if (woman.LotHome == null)
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " is homeless.");
                return(false);
            }
            else if (woman.Household.IsServiceNpcHousehold)
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " is an NPC and can not be pollinated.");
                return(false);
            }
            else if ((!AllowOverstuffed) && (woman.Household.NumMembersCountingPregnancy >= 8))
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " house has too many people.");
                return(false);
            }
            else if (woman.SimDescription.Pregnancy != null)
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " has already been pollinated.");
                return(false);
            }
            else if (woman.SimDescription.AgingState.IsAgingInProgress())
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " is too old to be pollinated.");
                return(false);
            }
            else if (woman.SimDescription.Elder)
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " is too old to be pollinated.");
                return(false);
            }

            Sims3.Gameplay.ActorSystems.AgingManager.Singleton.CancelAgingAlarmsForSim(woman);

            Sims3.Gameplay.ActorSystems.Pregnancy p = new Sims3.Gameplay.ActorSystems.Pregnancy(woman, man);

            p.PreggersAlarm = woman.AddAlarmRepeating(1f, TimeUnit.Hours, new AlarmTimerCallback(p.HourlyCallback), 1f, TimeUnit.Hours, "Hourly Pregnancy Update Alarm", AlarmType.AlwaysPersisted);

            woman.SimDescription.Pregnancy = p;

            EventTracker.SendEvent(new Sims3.Gameplay.ActorSystems.PregnancyEvent(EventTypeId.kGotPregnant, woman, man, p, null));

            SimpleMessageDialog.Show("Pollination", woman.Name + " has been successfully pollinated.");
            return(true);
        }
예제 #3
0
        public static Pregnancy Start(Sim woman, SimDescription man, bool handlePlantSim)
        {
            if (handlePlantSim)
            {
                if ((SimTypes.IsSelectable(woman)) || (SimTypes.IsSelectable(man)))
                {
                    if (woman.SimDescription.IsPlantSim || man.IsPlantSim)
                    {
                        IGameObject obj2 = GlobalFunctions.CreateObjectOutOfWorld("forbiddenFruit", ProductVersion.EP9, "Sims3.Gameplay.Objects.Gardening.ForbiddenFruit", null);
                        if (obj2 != null)
                        {
                            Inventories.TryToMove(obj2, woman);
                            Audio.StartSound("sting_baby_conception");
                        }

                        return null;
                    }
                }
            }

            AgingManager.Singleton.CancelAgingAlarmsForSim(woman.SimDescription.AgingState);
            Pregnancy p = null;

            if (woman.IsHuman)
            {
                p = new Pregnancy(woman, man);
            }
            else
            {
                p = new PetPregnancy(woman, man);
            }

            p.PreggersAlarm = woman.AddAlarmRepeating(1f, TimeUnit.Hours, p.HourlyCallback, 1f, TimeUnit.Hours, "Hourly Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
            woman.SimDescription.Pregnancy = p;

            EventTracker.SendEvent(new PregnancyEvent(EventTypeId.kGotPregnant, woman, man.CreatedSim, p, null));
            return p;
        }
예제 #4
0
        public static Pregnancy Start(Sim woman, SimDescription man, bool handlePlantSim)
        {
            if (handlePlantSim)
            {
                if ((SimTypes.IsSelectable(woman)) || (SimTypes.IsSelectable(man)))
                {
                    if (woman.SimDescription.IsPlantSim || man.IsPlantSim)
                    {
                        IGameObject obj2 = GlobalFunctions.CreateObjectOutOfWorld("forbiddenFruit", ProductVersion.EP9, "Sims3.Gameplay.Objects.Gardening.ForbiddenFruit", null);
                        if (obj2 != null)
                        {
                            Inventories.TryToMove(obj2, woman);
                            Audio.StartSound("sting_baby_conception");
                        }

                        return(null);
                    }
                }
            }

            AgingManager.Singleton.CancelAgingAlarmsForSim(woman.SimDescription.AgingState);
            Pregnancy p = null;

            if (woman.IsHuman)
            {
                p = new Pregnancy(woman, man);
            }
            else
            {
                p = new PetPregnancy(woman, man);
            }

            p.PreggersAlarm = woman.AddAlarmRepeating(1f, TimeUnit.Hours, p.HourlyCallback, 1f, TimeUnit.Hours, "Hourly Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
            woman.SimDescription.Pregnancy = p;

            EventTracker.SendEvent(new PregnancyEvent(EventTypeId.kGotPregnant, woman, man.CreatedSim, p, null));
            return(p);
        }
예제 #5
0
        public override bool Continue(Sim mom, bool momJustCreated)
        {
            if (mom == null)
            {
                return(false);
            }

            if (momJustCreated)
            {
                mHasRequestedWalkStyle = false;
            }

            mMom = mom;
            mDad = null;
            CheckForDad();
            mTimeMoodSampled              = SimClock.CurrentTime();
            mMom.MoodManager.MoodChanged += new MoodManager.MoodChangedCallback(MoodManager_MoodChanged);
            ActiveTopic.AddToSim(mom, "Pregnancy");

            if (momJustCreated)
            {
                PreggersAlarm = mom.AddAlarmRepeating(1f, TimeUnit.Hours, new AlarmTimerCallback(HourlyCallback), 1f, TimeUnit.Hours,
                                                      "Hourly Alien Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
            }

            mom.SimDescription.Pregnancy = this;
            int arg_C0_0 = mHourOfPregnancy;
            int arg_BF_0 = Aliens.Settings.mPregnancyShow;

            if (mHourOfPregnancy >= Aliens.Settings.mPregnancyShow)
            {
                if (mHourOfPregnancy < Aliens.Settings.mStartLabor)
                {
                    mMom.BuffManager.AddElement(BuffsAndTraits.sXenogenesis, Origin.FromPregnancy);
                }

                ActiveTopic.AddToSim(mMom, "Announce Pregnancy");
            }

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

            if (mHourOfPregnancy >= Aliens.Settings.mStartLabor)
            {
                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);
            }

            if (mHourOfPregnancy == Aliens.Settings.mPregnancyDuration)
            {
                mMom.AddAlarm(1f, TimeUnit.Minutes, new AlarmTimerCallback(HaveTheBaby), "Re-have the baby.", AlarmType.AlwaysPersisted);
            }

            SetPregoBlendShape();

            if (mMom.SimDescription.IsVisuallyPregnant)
            {
                TryToGiveLeave();
            }

            return(true);
        }
예제 #6
0
파일: RubLampEx.cs 프로젝트: yakoder/NRaas
        public override bool Run()
        {
            try
            {
                if (!Actor.Inventory.Contains(Target))
                {
                    if (!Actor.RouteToObjectRadiusAndCheckInUse(Target, 0.7f))
                    {
                        return(false);
                    }

                    StandardEntry();
                    BeginCommodityUpdates();
                    Actor.PlaySoloAnimation("a2o_object_genericSwipe_x", true);
                    if (!Actor.Inventory.TryToAdd(Target))
                    {
                        EndCommodityUpdates(false);
                        StandardExit();
                        return(false);
                    }
                }
                else
                {
                    StandardEntry();
                    BeginCommodityUpdates();
                }

                SocialJigTwoPerson person = GlobalFunctions.CreateObjectOutOfWorld(SocialJig.SocialJigMedatorNames.SocialJigTwoPerson.ToString()) as SocialJigTwoPerson;
                person.RegisterParticipants(Actor, null);
                Sim createdSim = null;
                try
                {
                    World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(Actor.Position);
                    fglParams.BooleanConstraints |= FindGoodLocationBooleans.Routable;
                    if (GlobalFunctions.PlaceAtGoodLocation(person, fglParams, true))
                    {
                        Route r = Actor.CreateRoute();
                        r.PlanToSlot(person, person.GetSlotForActor(Actor, true));
                        r.DoRouteFail = true;
                        if (Actor.DoRoute(r))
                        {
                            bool paramValue = false;
                            mSummonGenieBroadcast = new ReactionBroadcaster(Actor, kSummonGenieBroadcastParams, SummonGenieBroadcastCallback);
                            Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.Gameplay.Gameflow.GameSpeed.Normal, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Gameplay);
                            if (Target.mGenieDescription == null)
                            {
                                Target.mGenieDescription = OccultGenie.CreateGenie(Actor, Target);
                                createdSim = Target.mGenieDescription.CreatedSim;
                                EventTracker.SendEvent(EventTypeId.kCleanLamp, Actor, Target);
                                paramValue = true;
                            }
                            else
                            {
                                createdSim = Target.mGenieDescription.Instantiate(Vector3.OutOfWorld, false);
                                OccultGenie occultType          = null;
                                DateAndTime previousDateAndTime = SimClock.CurrentTime();
                                do
                                {
                                    SpeedTrap.Sleep(0xa);
                                    occultType = createdSim.OccultManager.GetOccultType(OccultTypes.None | OccultTypes.Genie) as OccultGenie;
                                }while ((occultType == null) && (SimClock.ElapsedTime(TimeUnit.Minutes, previousDateAndTime) < 120f));

                                if (occultType != null)
                                {
                                    occultType.SetGenieLampRelations(Actor, createdSim, Target);
                                }
                                else
                                {
                                    createdSim.Destroy();
                                    createdSim = null;
                                }
                            }

                            if (createdSim != null)
                            {
                                createdSim.FadeOut(false, false, 0f);
                                createdSim.GreetSimOnLot(Actor.LotCurrent);
                                createdSim.AddToWorld();
                                Slot slotForActor = person.GetSlotForActor(createdSim, false);
                                createdSim.SetPosition(person.GetSlotPosition(slotForActor));
                                createdSim.SetForward(person.GetForwardOfSlot(slotForActor));
                                IGameObject actor = GlobalFunctions.CreateObject("GenieLamp", ProductVersion.EP6, Vector3.OutOfWorld, 0x0, Vector3.UnitZ, null, null);
                                if (!actor.IsActorUsingMe(Actor))
                                {
                                    actor.AddToUseList(Actor);
                                }
                                EnterStateMachine("GenieLampSummon", "Enter", "x");
                                SetActor("lamp", actor);
                                SetParameter("isFirstTime", paramValue);
                                AnimateSim("Exit");
                                actor.Destroy();
                                createdSim.FadeIn();
                                VisualEffect effect = VisualEffect.Create("ep6GenieAppearSmoke_main");
                                effect.SetPosAndOrient(createdSim.Position, Vector3.UnitX, Vector3.UnitZ);
                                effect.SubmitOneShotEffect(VisualEffect.TransitionType.SoftTransition);
                                OpportunityManager opportunityManager = Actor.OpportunityManager;
                                if ((opportunityManager != null) && opportunityManager.HasOpportunity(OpportunityNames.EP6_ReleaseGenie_SummonGenie))
                                {
                                    OccultGenie genie2 = createdSim.OccultManager.GetOccultType(OccultTypes.Genie) as OccultGenie;
                                    if (genie2 == null)
                                    {
                                        createdSim.Destroy();
                                        createdSim = null;
                                    }
                                    else
                                    {
                                        OccultGenieEx.OnFreedFromLamp(genie2, Actor, createdSim, true);
                                        if (opportunityManager.GetLastOpportunity(OpportunityCategory.Special) == OpportunityNames.EP6_ReleaseGenie_SummonGenie)
                                        {
                                            opportunityManager.ClearLastOpportunity(OpportunityCategory.Special);
                                        }

                                        EventTracker.SendEvent(EventTypeId.kGrantedWishToFreeGenie, Actor, Target);
                                        if (Target.InInventory)
                                        {
                                            Actor.Inventory.RemoveByForce(Target);
                                            if (Target.IsOnHandTool)
                                            {
                                                Target.RemoveFromWorld();
                                            }
                                        }
                                        else
                                        {
                                            Target.RemoveFromWorld();
                                        }
                                        EnterStateMachine("FreeTheGenie", "Enter", "x");
                                        SetActor("x", createdSim);
                                        AnimateSim("Exit");
                                    }
                                }
                                else
                                {
                                    Target.mGenieSocializingEvent        = EventTracker.AddListener(EventTypeId.kSocialInteraction, OnSocialization);
                                    Target.CheckGenieReturnToLamp        = createdSim.AddAlarmRepeating(1f, TimeUnit.Minutes, Target.CheckGenieReturnToLampCallback, "Genie Check to return to lamp", AlarmType.AlwaysPersisted);
                                    Target.mTimeSinceLastSocialWithGenie = SimClock.CurrentTime();
                                }
                            }
                        }
                    }
                }
                finally
                {
                    person.Destroy();
                }

                EndCommodityUpdates(true);
                StandardExit(createdSim == null, createdSim == null);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
예제 #7
0
        public override bool Continue(Sim mom, bool momJustCreated)
        {
            if (mom == null)
            {
                return(false);
            }

            if (momJustCreated)
            {
                mHasRequestedWalkStyle = false;
            }

            mMom = mom;
            mDad = null;
            SimDescription simDescription;

            if (RobotDadDescriptionID != 0uL)
            {
                simDescription = SimDescription.Find(RobotDadDescriptionID);
            }
            else
            {
                simDescription = SimDescription.Find(DadDescriptionId);
            }

            if (simDescription != null && simDescription.IsMale && simDescription.TeenOrAbove)
            {
                mDad = simDescription.CreatedSim;
            }

            mTimeMoodSampled              = SimClock.CurrentTime();
            mMom.MoodManager.MoodChanged += new MoodManager.MoodChangedCallback(MoodManager_MoodChanged);
            ActiveTopic.AddToSim(mom, "Pregnancy");

            if (momJustCreated)
            {
                PreggersAlarm = mom.AddAlarmRepeating(1f, TimeUnit.Hours, new AlarmTimerCallback(HourlyCallback), 1f, TimeUnit.Hours,
                                                      "Hourly Robot Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
            }

            mom.SimDescription.Pregnancy = this;
            int arg_C0_0 = mHourOfPregnancy;

            if (mHourOfPregnancy >= 0)
            {
                if (mHourOfPregnancy < Woohooer.Settings.mRobotHoursOfPregnancy)
                {
                    mMom.BuffManager.AddElement(BuffNames.Pregnant, Origin.FromPregnancy);
                }

                ActiveTopic.AddToSim(mMom, "Announce Pregnancy");

                if (mDad != null && !mDad.HasBeenDestroyed)
                {
                    ActiveTopic.AddToSim(mDad, "Pregnant", mDad.SimDescription);
                }
            }

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

            // Robots will not have a labor stage.

            if (mHourOfPregnancy == Woohooer.Settings.mRobotHoursOfPregnancy)
            {
                mMom.AddAlarm(1f, TimeUnit.Minutes, new AlarmTimerCallback(HaveTheBaby), "Have the baby", AlarmType.AlwaysPersisted);
            }

            TryToGiveLeave();

            return(true);
        }
예제 #8
0
        private static Pregnancy StartInternal(Sim femBot, SimDescription manBot, SimDescription dnaF, SimDescription dnaM)
        {
            // Start robo surrogate pregnancy here!

            if ((dnaF.IsPlantSim || dnaM.IsPlantSim) && !Woohooer.Settings.mAllowPlantSimPregnancy)
            {
                IGameObject gameObject = GlobalFunctions.CreateObjectOutOfWorld("forbiddenFruit", ProductVersion.EP9,
                                                                                "Sims3.Gameplay.Objects.Gardening.ForbiddenFruit", null);

                if (gameObject != null)
                {
                    femBot.Inventory.TryToAdd(gameObject);
                    Audio.StartSound("sting_baby_conception");
                }

                return(null);
            }
            else
            {
                if (femBot.SimDescription.Pregnancy != null)
                {
                    return(null);
                }

                if (!femBot.Household.IsTouristHousehold && femBot.LotHome == null)
                {
                    return(null);
                }

                if (!femBot.Household.CanAddSpeciesToHousehold(femBot.SimDescription.Species, 1, true))
                {
                    return(null);
                }

                if (femBot.SimDescription.AgingState != null && femBot.SimDescription.AgingState.IsAgingInProgress())
                {
                    return(null);
                }

                if (Stylist.IsStyleeJobTargetOfAnyStyler(femBot))
                {
                    return(null);
                }

                AgingManager.Singleton.CancelAgingAlarmsForSim(femBot);

                if (femBot.IsHuman)
                {
                    RobotPregnancyProxy pregnancy = new RobotPregnancyProxy(femBot, manBot, dnaF, dnaM);
                    pregnancy.PreggersAlarm = femBot.AddAlarmRepeating(1f, TimeUnit.Hours, new AlarmTimerCallback(pregnancy.HourlyCallback), 1f, TimeUnit.Hours,
                                                                       "Hourly Robot Surrogate Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
                    femBot.SimDescription.Pregnancy = pregnancy;
                    EventTracker.SendEvent(new PregnancyEvent(EventTypeId.kGotPregnant, femBot, (manBot != null) ? manBot.CreatedSim : null, pregnancy, null));
                    (femBot.SimDescription.Pregnancy as RobotPregnancyProxy).ApplyInitialMutationFactors();

                    return(femBot.SimDescription.Pregnancy);
                }
                else
                {
                    Common.DebugNotify("RobotPregnancyProxy.StartInternal" + Common.NewLine + " - How did you get here?!");
                    return(null);
                }
            }
        }
예제 #9
0
        public override bool Continue(Sim mom, bool momJustCreated)
        {
            if (mom == null)
            {
                return(false);
            }

            if (momJustCreated)
            {
                mHasRequestedWalkStyle = false;
            }

            mMom                          = mom;
            mDad                          = null;
            mTimeMoodSampled              = SimClock.CurrentTime();
            mMom.MoodManager.MoodChanged += new MoodManager.MoodChangedCallback(MoodManager_MoodChanged);
            ActiveTopic.AddToSim(mom, "Pregnancy");

            if (momJustCreated)
            {
                PreggersAlarm = mom.AddAlarmRepeating(1f, TimeUnit.Hours, new AlarmTimerCallback(HourlyCallback), 1f, TimeUnit.Hours,
                                                      "Hourly Human Surrogate Pregnancy Update Alarm", AlarmType.AlwaysPersisted);
            }

            mom.SimDescription.Pregnancy = this;
            int arg_C0_0 = mHourOfPregnancy;
            int arg_BF_0 = kHourToShowPregnantBuff;

            if (mHourOfPregnancy >= kHourToShowPregnantBuff)
            {
                if (mHourOfPregnancy < kHourToStartContractions)
                {
                    mMom.BuffManager.AddElement(BuffNames.Pregnant, Origin.FromPregnancy);
                }

                ActiveTopic.AddToSim(mMom, "Announce Pregnancy");
            }

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

            if (mHourOfPregnancy >= kHourToStartContractions)
            {
                // Add BabyIsComing moodlet here!

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

                mContractionBroadcast = new ReactionBroadcaster(mMom, kContractionBroadcasterParams,
                                                                new ReactionBroadcaster.BroadcastCallback(StartReaction), new ReactionBroadcaster.BroadcastCallback(CancelReaction));
                // Add TakeToHospital interaction here!
                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);
            }

            if (mHourOfPregnancy == kHoursOfPregnancy)
            {
                mMom.AddAlarm(1f, TimeUnit.Minutes, new AlarmTimerCallback(HaveTheBaby), "Re-have the baby", AlarmType.AlwaysPersisted);
            }

            SetPregoBlendShape();

            if (mMom.SimDescription.IsVisuallyPregnant)
            {
                TryToGiveLeave();
            }

            return(true);
        }