Exemplo n.º 1
0
        public override bool Run()
        {
            if (Actor.IsSelectable)
            {
                PlumbBob.SelectActor(Actor);
                Camera.FocusOnSim(Actor, Pregnancy.kShowPregnancyCameraLerp.Zoom, Pregnancy.kShowPregnancyCameraLerp.Pitch,
                                  Pregnancy.kShowPregnancyCameraLerp.Time, true, false);
                Audio.StartSound("sting_alien_visit");
            }

            Actor.SimDescription.ShowPregnancy();
            Actor.BuffManager.AddElement(AlienUtilsEx.sXenogenesis, Origin.FromPregnancy);
            ActiveTopic.AddToSim(Actor, "Announce Pregnancy");

            /* TODO------------------------------------------------ */
            /* Set alarm to give leave at start of third trimester! */
            /* ---------------------------------------------------- */

            Tutorialette.TriggerLesson(Lessons.Pregnancy, Actor);
            Actor.PlaySoloAnimation("a_alien_pregnancy_inspectStomach");

            /* TODO------------------------------ */
            /* Will not remove jobs at this time! */
            /* ---------------------------------- */

            return(true);
        }
Exemplo n.º 2
0
        public override void Startup()
        {
            // From StateMachine:Startup
            mBaseCallFlag |= BaseCallFlag.kStartup;

            // From InWorldSubState
            while (sDelayNextStateStartupCount > 0x0)
            {
                SpeedTrap.Sleep(0x0);
            }
            EventTracker.SendEvent(new InWorldSubStateEvent(this, true));

            // From EditTownState
            if (SeasonsManager.Enabled)
            {
                SeasonsManager.OnEnterEditTown();
            }

            AudioManager.MusicMode = MusicMode.EditTown;
            UserToolUtils.UserToolGeneric(0xc8, new ResourceKey(0x0L, 0x0, 0x0));
            BorderTreatmentsController.Hide();
            GameUtils.Pause();
            base.PlaceLotWizardCheck();
            EditTownController.Load();
            Tutorialette.TriggerLesson(Lessons.EditTown, null);
            Tutorialette.TriggerLesson(Lessons.PlacingNewVenues, null);
            //Household.DestroyHouseholdsWithoutGuardians();
            CASExitLoadScreen.Close();
            InWorldSubState.EdgeScrollCheck();
            InWorldSubState.OpportunityDialogCheck();
        }
Exemplo n.º 3
0
        public static IPropertyData PurchaceorUpgradeRabbitHole(RealEstateManager ths, RabbitHole rabbitHole)
        {
            IPropertyData data  = null;
            PropertyData  data2 = ths.FindProperty(rabbitHole);

            if (data2 == null)
            {
                if (ths.mOwningHousehold.FamilyFunds >= rabbitHole.RabbitHoleTuning.kInvestCost)
                {
                    NRaas.StoryProgression.Main.Money.AdjustFunds(ths.mOwningHousehold, "PropertyBought", -rabbitHole.RabbitHoleTuning.kInvestCost);
                    data2 = new PropertyData.RabbitHole(rabbitHole, ths);
                    ths.AddToProperties(data2);
                }
            }
            else if (ths.mOwningHousehold.FamilyFunds >= rabbitHole.RabbitHoleTuning.kBuyoutCost)
            {
                ReimburseDeeds(ths, rabbitHole);

                NRaas.StoryProgression.Main.Money.AdjustFunds(ths.mOwningHousehold, "PropertyBought", -rabbitHole.RabbitHoleTuning.kBuyoutCost);

                data2.UpgradeToFullOwnership();
                ths.UpdateProperty(data2);
            }
            data = data2;
            if (data != null)
            {
                Tutorialette.TriggerLesson(Lessons.RealEstate, null);
            }
            return(data);
        }
Exemplo n.º 4
0
        public override bool Run()
        {
            Actor.SimDescription.Pregnancy.mHasShownPregnancy = true;

            if (Actor.IsSelectable)
            {
                PlumbBob.SelectActor(Actor);
                Camera.FocusOnSim(Actor, Pregnancy.kShowPregnancyCameraLerp.Zoom, Pregnancy.kShowPregnancyCameraLerp.Pitch,
                                  Pregnancy.kShowPregnancyCameraLerp.Time, true, false);
                Audio.StartSound("sting_alien_visit");
                //Audio.StartObjectSound(Actor.ObjectId, "sting_alien_visit", false);
            }

            Actor.SimDescription.ShowPregnancy();
            Actor.BuffManager.AddElement(BuffsAndTraits.sXenogenesis, Origin.FromPregnancy);

            if (Actor.BuffManager.HasElement(BuffNames.Nauseous))
            {
                Actor.BuffManager.GetElement(BuffNames.Nauseous).mBuffOrigin = Origin.FromPregnancy;
            }

            ActiveTopic.AddToSim(Actor, "Announce Pregnancy");
            Actor.SimDescription.Pregnancy.TryToGiveLeave();
            Tutorialette.TriggerLesson(Lessons.Pregnancy, Actor);
            Actor.PlaySoloAnimation("a_alien_pregnancy_inspectStomach", true);

            if (Actor.Occupation != null)
            {
                Actor.Occupation.RemoveAllJobs();
            }

            return(true);
        }
Exemplo n.º 5
0
 private Phone.Call.ConversationBehavior onCallConnectedBase()
 {
     if (base.BalloonIconData != null)
     {
         base.Actor.ThoughtBalloonManager.ShowBalloon(base.BalloonIconData);
     }
     base.Actor.SkillManager.AddElement(SkillNames.SocialNetworking);
     if (base.Actor.IsSelectable)
     {
         Tutorialette.TriggerLesson(Lessons.SocialNetworking, base.Actor);
     }
     base.AnimateSim(kAnimStates[(int)base.AnimState]);
     return(Phone.Call.ConversationBehavior.NoBehavior);
 }
 public static void TriggerLesson(Lessons lesson, Sim sim)
 {
     if (!IntroTutorial.IsRunning && !Sims3.SimIFace.Environment.HasEditInGameModeSwitch && Tutorialette.AreTutorialTipsEnabled())
     {
         InWorldSubState inWorldSubState = GameStates.GetInWorldSubState();
         if (inWorldSubState != null)
         {
             string stateName = inWorldSubState.StateName;
             if (stateName != "Play Flow" && Tutorialette.IsValidLesson(lesson, sim))
             {
                 TutorialetteNotification.Show(Tutorialette.sLessonTnsKeys[lesson].LessonTnsKey, (int)lesson);
             }
         }
     }
 }
Exemplo n.º 7
0
        public override bool Run()
        {
            try
            {
                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                if (mWoohooee == null)
                {
                    mWoohooee = definition.ITarget(this);
                }

                Tutorialette.TriggerLesson(Lessons.FutureTravel, Actor);

                List <Sim> followersFromSelectedObjects = new List <Sim>();
                followersFromSelectedObjects.Add(mWoohooee);

                bool flag = mDestination.RouteOutside(Actor, followersFromSelectedObjects);

                CommonWoohoo.RunPostWoohoo(Actor, mWoohooee, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                Actor.BuffManager.AddElement(BuffNames.MissedMyStop, Origin.FromWooHooOnHoverTrain);

                if (CommonPregnancy.IsSuccess(Actor, mWoohooee, Autonomous, definition.GetStyle(this)))
                {
                    CommonPregnancy.Impregnate(Actor, mWoohooee, Autonomous, definition.GetStyle(this));
                }

                mWoohooee.BuffManager.AddElement(BuffNames.MissedMyStop, Origin.FromWooHooOnHoverTrain);

                return(flag);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
Exemplo n.º 8
0
        public override void PregnancyComplete(List <Sim> newborns, List <Sim> followers)
        {
            if (mMom.IsSelectable)
            {
                Audio.StartObjectSound(mMom.ObjectId, "sting_baby_born_alien", false);
            }

            Tutorialette.TriggerLesson(Lessons.Babies, mMom);
            EventTracker.SendEvent(new PregnancyEvent(EventTypeId.kHadBaby, mMom, mDad, this, newborns));

            mMom.BuffManager.RemoveElement(AlienUtilsEx.sXenogenesis);
            mMom.BuffManager.RemoveElement(AlienUtilsEx.sBabyIsComing);
            mMom.RemoveInteractionByType(TakeToHospitalEx.Singleton);
            UnrequestPregnantWalkStyle();

            if (mMom.TraitManager.HasElement(AlienUtilsEx.sAlreadyExamined))
            {
                mMom.TraitManager.RemoveElement(AlienUtilsEx.sAlreadyExamined);
            }

            if (!mMom.SimDescription.IsVampire)
            {
                Motive motive = mMom.Motives.GetMotive(CommodityKind.Hunger);

                if (motive != null)
                {
                    motive.PregnantMotiveDecay = false;
                }
            }

            Motive motive2 = mMom.Motives.GetMotive(CommodityKind.Bladder);

            if (motive2 != null)
            {
                motive2.PregnantMotiveDecay = false;
            }

            BuffNames buffName = BuffNames.ItsABoy;

            switch (newborns.Count)
            {
            case 1:
                buffName = newborns[0].IsFemale ? BuffNames.ItsAGirl : BuffNames.ItsABoy;
                break;

            case 2:
                buffName = BuffNames.ItsTwins;
                break;

            case 3:
                buffName = BuffNames.ItsTriplets;
                break;

            case 4:
                buffName = sItsQuadruplets;
                break;
            }

            mMom.BuffManager.AddElement(buffName, Origin.FromNewBaby);

            if (mMom.TraitManager.HasElement(TraitNames.Dramatic))
            {
                mMom.PlayReaction(ReactionTypes.JoyousCrying, ReactionSpeed.NowOrLater);
            }

            if (followers != null)
            {
                foreach (Sim current in followers)
                {
                    if (current.SimDescription.ToddlerOrAbove)
                    {
                        current.BuffManager.AddElement(buffName, Origin.FromNewBaby);
                    }
                }
            }

            bool flag = !mMom.Household.IsActive;

            foreach (Sim current2 in newborns)
            {
                if (flag)
                {
                    current2.SimDescription.AgingState.AgeUpWithinNDays(kMaxDaysAsNPCBaby);
                }

                current2.SimDescription.PushAgingEnabledToAgingManager();
            }

            mMom.SimDescription.NullOutPregnancy();
        }
Exemplo n.º 9
0
        public override bool Run()
        {
            try
            {
                if (!Actor.RouteToObjectRadialRangeAndCheckInUse(Target, Target.MinorPetTuning.CaptureRouteRange[0x0], Target.MinorPetTuning.CaptureRouteRange[0x1]))
                {
                    return(false);
                }
                bool escaped = Target.Escaped;
                StandardEntry();
                EnterStateMachine("MinorPetCapture", "Enter", "x");
                SetActor("pet", Target);
                SetParameter("petType", Target.Data.MinorPetType);
                BeginCommodityUpdates();
                bool succeeded = escaped || RandomUtil.RandomChance01(Target.Data.CatchChance);
                if (succeeded)
                {
                    Target.FadeOut();
                    Target.StopBehaviorSMC();
                    AnimateSim("Capture");

                    // Custom
                    if (Actor.Inventory.TryToAdd(Target, false))
                    {
                        string str;
                        if (escaped)
                        {
                            str = Localization.LocalizeString(Actor.IsFemale, "Gameplay/Objects/MinorPets/Recapture:TNS", new object[] { Actor, Target.GetLocalizedName() });
                        }
                        else
                        {
                            Target.Captured = true;
                            string localizedPetType   = MinorPet.GetLocalizedPetType(Target.Data.MinorPetType);
                            string localizedPetRarity = MinorPet.GetLocalizedPetRarity(Target.Data.Rarity);
                            str = Localization.LocalizeGenderString("Gameplay/Objects/MinorPets:CaptureTNS", new object[] { Actor, Actor, Target.LocalizedSpeciesName, localizedPetType, localizedPetRarity });
                        }

                        Actor.ShowTNSIfSelectable(str, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, Actor.ObjectId);
                        EventTracker.SendEvent(new MinorPetEvent(EventTypeId.kCaughtMinorPet, Actor, Target, Target.Data.MinorPetType));
                        using (List <Sim> .Enumerator enumerator = Actor.Household.Sims.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                Sim current = enumerator.Current;
                                EventTracker.SendEvent(new Event(EventTypeId.kArkBuilder, Actor, Target));
                            }
                        }
                        if (Target is IBird)
                        {
                            Tutorialette.TriggerLesson(Lessons.Birds, null);
                        }
                        else
                        {
                            Tutorialette.TriggerLesson(Lessons.MinorPets, null);
                        }
                    }
                    else
                    {
                        mDestroyPet = true;
                    }
                }
                else
                {
                    Target.FadeOut();
                    mDestroyPet = true;
                    bool flag3 = RandomUtil.CoinFlip();
                    AnimateSim(flag3 ? "CaptureFailBad" : "CaptureFail");
                    if (flag3)
                    {
                        Actor.BuffManager.AddElement(BuffNames.Bitten, Origin.FromUncapturedMinorPet);
                    }
                }
                AnimateSim("Exit");
                EndCommodityUpdates(succeeded);
                StandardExit();
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Exemplo n.º 10
0
        public override bool Run()
        {
            try
            {
                Vector3 vector4;
                if (Actor.LotCurrent.IsHouseboatLot())
                {
                    mIsHouseboat = true;
                }
                mSittingInBoatPosture = Actor.Posture as SittingInBoat;

                Vector3 mPoint       = Hit.mPoint;
                Vector3 newTargetPos = mPoint;
                if (mSittingInBoatPosture == null)
                {
                    if (!mIsHouseboat)
                    {
                        if (IsNearHiddenIsland(mPoint))
                        {
                            Vector3 invalid = Vector3.Invalid;
                            World.GetNearestSwimmingPoint(Actor.Position, ref invalid, ref mPoint);
                        }

                        if (!RouteToFishingLocation(mPoint, Actor, Hit.mType, Hit.mId))
                        {
                            Actor.PlayRouteFailure(new ThumbnailKey(ResourceKey.CreatePNGKey("w_fishing_skill", ResourceUtils.ProductVersionToGroupId(ProductVersion.BaseGame)), ThumbnailSize.Medium));
                            return(false);
                        }
                    }
                    else if (!RouteToFishingLocationOnHouseboat(Actor, ref mPoint, Actor, Hit.mType, Hit.mId, ref newTargetPos))
                    {
                        return(false);
                    }
                }
                else
                {
                    Boat container = mSittingInBoatPosture.Container as Boat;
                    if (container != null)
                    {
                        mPoint = container.GetFishingPosition(mSittingInBoatPosture);
                        if (World.GetTerrainType(mPoint.x, mPoint.z, container.Level) != 2)
                        {
                            return(false);
                        }

                        RoutingComponent routingComponent = container.RoutingComponent;
                        if ((routingComponent == null) || routingComponent.IsRouting)
                        {
                            return(false);
                        }
                    }
                }

                if (mIsHouseboat && World.GetHouseboatDisplayToWorldPosition(Actor.LotCurrent.LotId, newTargetPos, out vector4))
                {
                    PrepFishing(mPoint, vector4);
                }
                else
                {
                    PrepFishing(mPoint, mPoint);
                }

                WaterTypes waterType = FishingSpot.GetWaterType(Hit.mType);
                Fishing    fishing   = Actor.SkillManager.AddElement(SkillNames.Fishing) as Fishing;
                fishing.TypesOfWaterFishedIn = waterType | fishing.TypesOfWaterFishedIn;
                if (!BaitSelected)
                {
                    BaitInfoSelected = fishing.mBaitInfo;
                }
                if (BaitInfoSelected != null)
                {
                    BaitInUse = FindProperBait(BaitInfoSelected);
                    Actor.InteractionQueue.FireQueueChanged();
                }
                else if (fishing.SkillLevel > kNoBaitUsedLesson)
                {
                    Tutorialette.TriggerLesson(Lessons.FishingSkill, Actor);
                }

                BeginCommodityUpdates();

                bool succeeded = false;

                MotiveDelta delta = null;

                try
                {
                    StartStages();
                    if (Actor.TraitManager.HasElement(TraitNames.Angler))
                    {
                        mIsAngler = true;
                        delta     = AddMotiveDelta(CommodityKind.Fun, kAnglerFunPerHour);
                    }

                    mLoopLengthForNextFish = mFishingData.GetNextFishTimeLength(mIsAngler, fishing.IsFisherman());
                    mShowTns = mFishingData.ShouldShowFishingTns(Actor, BaitInUse);
                    mCurrentStateMachine.SetParameter("skillLevel", fishing.GetSkillLevelParameterForJazzGraph());
                    if (BaitInUse != null)
                    {
                        fishing.mBaitInfo = new Fishing.BaitInfo(BaitInUse);
                    }
                    else
                    {
                        fishing.mBaitInfo = null;
                    }

                    AnimateSim("Fish");
                    Actor.RegisterGroupTalk();

                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new Interaction <Sim, Terrain> .InsideLoopFunction(LoopFunc), mCurrentStateMachine);

                    Actor.UnregisterGroupTalk();
                    if (BaitInUse != null)
                    {
                        Actor.Inventory.SetNotInUse(BaitInUse);
                    }

                    if (mSittingInBoatPosture == null)
                    {
                        AnimateSim("Exit");
                    }
                    else
                    {
                        AnimateSim("ExitFishing");
                        mSittingInBoatPosture.CurrentStateMachine.RequestState("x", "SimIdle");
                    }
                }
                finally
                {
                    StandardExit(false, false);
                    if (mIsAngler)
                    {
                        RemoveMotiveDelta(delta);
                    }

                    EndCommodityUpdates(succeeded);
                }
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Exemplo n.º 11
0
        public static bool Show(IMovingModel model)
        {
            if (IntroTutorial.IsRunning && !IntroTutorial.AreYouExitingTutorial())
            {
                return(false);
            }

            if (ScreenGrabController.InProgress || VideoGrabHelper.InUse)
            {
                return(false);
            }

            UserToolUtils.OnClose();
            Sims3.Gameplay.UI.Responder.Instance.HudModel.CloseSecondaryInventory();
            PopupMenu.CloseOptions();
            Tutorialette.TriggerLesson(Lessons.Moving, null);
            List <IMapTagPickerInfo> mapTagPickerInfos = null;
            string titleText   = Localization.LocalizeString("Ui/Caption/MovingDialog:ChooseLocation", new object[0]);
            string confirmText = Localization.LocalizeString("Ui/Caption/MovingDialog:ChooseConfirm", new object[0]);

            MoveDialogBase.Result running = MoveDialogBase.Result.Running;
            ulong         maxValue        = ulong.MaxValue;
            HouseboatSize houseboatSize   = HouseboatSize.None;

            if (!MoveDialog.Show(model))
            {
                return(false);
            }

            SceneMgrWindow sceneWindow = UIManager.GetSceneWindow();

            if (sceneWindow != null)
            {
                sceneWindow.StopForwardingAllEvents();
            }

            do
            {
                switch (running)
                {
                case MoveDialogBase.Result.LotSelect:
                case MoveDialogBase.Result.HouseSelect:
                case MoveDialogBase.Result.LotAndHouseSelect:
                case MoveDialogBase.Result.PortSelect:
                    running = MoveDialog.RunWithPickedLot(maxValue, houseboatSize);
                    break;

                default:
                    running = MoveDialog.Run();
                    break;
                }

                switch (running)
                {
                case MoveDialogBase.Result.LotSelect:
                case MoveDialogBase.Result.HouseSelect:
                case MoveDialogBase.Result.LotAndHouseSelect:
                case MoveDialogBase.Result.PortSelect:
                    if (mapTagPickerInfos == null)
                    {
                        mapTagPickerInfos = new List <IMapTagPickerInfo>();
                    }
                    else
                    {
                        mapTagPickerInfos.Clear();
                    }

                    bool isSource = model.SourceIsSelectedHousehold();
                    int  householdBuyingPowerFunds = model.GetHouseholdBuyingPowerFunds(isSource);
                    bool flag3 = true;
                    if (running == MoveDialogBase.Result.PortSelect)
                    {
                        flag3 = ChangeHouseboatDialog.Show(false, ref houseboatSize, true);
                    }

                    if (flag3)
                    {
                        foreach (Lot lot in LotManager.AllLots)
                        {
                            if ((!lot.IsWorldLot && lot.IsResidentialLot) && (lot.IsApartmentLot || (lot.Household == null)))
                            {
                                if (running == MoveDialogBase.Result.PortSelect)
                                {
                                    if ((lot.CommercialLotSubType == CommercialLotSubType.kEP10_Port) && lot.IsUnoccupiedPortLot())
                                    {
                                        HouseboatInfo info = HouseboatUtils.GetInfo(houseboatSize);
                                        MovingToPortMapTagPickerLotInfo item = new MovingToPortMapTagPickerLotInfo(lot, MapTagType.PortLot, info.Price);
                                        mapTagPickerInfos.Add(item);
                                    }
                                }
                                else if (((!lot.IsWorldLot && lot.IsResidentialLot) && (lot.ResidentialLotSubType != ResidentialLotSubType.kEP10_PrivateLot)) && ((lot.IsApartmentLot || (lot.Household == null)) && !UnchartedIslandMarker.DoesLotHaveUnchartedIslandMarker(lot)))
                                {
                                    if (lot.IsApartmentLot)
                                    {
                                        if ((running == MoveDialogBase.Result.HouseSelect) && ((lot.Household == null) || !model.HouseholdIsSource(lot.Household.HouseholdId)))
                                        {
                                            MapTagPickerLotInfo item = new MapTagPickerLotInfo(lot, MapTagType.Apartment);
                                            mapTagPickerInfos.Add(item);
                                        }
                                    }
                                    else if (World.LotIsEmpty(lot.LotId) && lot.IsLotEmptyFromObjects())
                                    {
                                        if (running != MoveDialogBase.Result.HouseSelect)
                                        {
                                            MapTagPickerLotInfo info;

                                            // Custom
                                            if (Mover.GetLotCost(lot) <= householdBuyingPowerFunds)
                                            {
                                                info = new MapTagPickerLotInfo(lot, MapTagType.AvailableEmptyLot);
                                            }
                                            else
                                            {
                                                info = new MapTagPickerLotInfo(lot, MapTagType.UnavailableEmptyLot);
                                            }

                                            mapTagPickerInfos.Add(info);
                                        }
                                    }
                                    else if (running != MoveDialogBase.Result.LotSelect)
                                    {
                                        MapTagPickerLotInfo info2;

                                        // Custom
                                        if (Mover.GetLotCost(lot) <= householdBuyingPowerFunds)
                                        {
                                            info2 = new MapTagPickerLotInfo(lot, MapTagType.AvailableEmptyHouse);
                                        }
                                        else
                                        {
                                            info2 = new MapTagPickerLotInfo(lot, MapTagType.UnavailableEmptyHouse);
                                        }
                                        mapTagPickerInfos.Add(info2);
                                    }
                                }
                            }
                        }
                    }
                    IMapTagPickerInfo info3 = null;

                    if (flag3)
                    {
                        bool flag4;
                        info3 = MapTagPickerDialog.Show(mapTagPickerInfos, titleText, confirmText, null, false, 0f, false, out flag4);
                    }
                    if (info3 != null)
                    {
                        maxValue = info3.LotId;
                    }
                    break;
                }
            }while ((running != MoveDialogBase.Result.Accepted) && (running != MoveDialogBase.Result.Cancelled));

            if (sceneWindow != null)
            {
                sceneWindow.StartForwardingEventsToGame();
            }

            MoveDialog.Shutdown();
            return(running == MoveDialogBase.Result.Accepted);
        }
Exemplo n.º 12
0
        public override void Startup()
        {
            Common.StringBuilder msg = new Common.StringBuilder("LiveModeStateEx:Startup" + Common.NewLine);
            Traveler.InsanityWriteLog(msg);

            try
            {
                UIManager.BlackBackground(false);

                msg += "A1";
                Traveler.InsanityWriteLog(msg);

                // StateMachineState:Startup()
                mBaseCallFlag |= BaseCallFlag.kStartup;

                // InWorldSubState:Startup()
                while (sDelayNextStateStartupCount > 0x0)
                {
                    SpeedTrap.Sleep();
                }

                msg += "A2";
                Traveler.InsanityWriteLog(msg);

                EventTracker.SendEvent(new InWorldSubStateEvent(this, true));

                //base.Startup();

                msg += "A3";
                Traveler.InsanityWriteLog(msg);

                ShowUI(true);

                if (CameraController.IsMapViewModeEnabled() && !TutorialModel.Singleton.IsTutorialRunning())
                {
                    CameraController.EnableCameraMapView(true);
                }

                msg += "B";
                Traveler.InsanityWriteLog(msg);

                CASExitLoadScreen.Close();

                bool traveling = false;
                if (GameStates.IsTravelling)
                {
                    if (GameStates.sTravelData == null)
                    {
                        GameStates.ClearTravelStatics();
                    }
                    else
                    {
                        traveling = true;
                        GameStatesEx.OnArrivalAtVacationWorld();
                    }
                }

                msg += "C";
                Traveler.InsanityWriteLog(msg);

                if (GameStates.sNextSimToSelect != null)
                {
                    DreamCatcher.SelectNoLotCheckImmediate(GameStates.sNextSimToSelect, true, true);
                    GameStates.sNextSimToSelect = null;
                }

                msg += "D";
                Traveler.InsanityWriteLog(msg);

                bool flag2 = false;
                if (LoadingScreenController.Instance != null)
                {
                    if ((GameStates.IsPerfTestRunning || (CommandLine.FindSwitch("campos") != null)) || (CommandLine.FindSwitch("camtarget") != null))
                    {
                        msg += "D1";
                        Traveler.InsanityWriteLog(msg);

                        GameUtils.EnableSceneDraw(true);
                        LoadingScreenController.Unload();
                    }
                    else if (traveling)
                    {
                        msg += "D2";
                        Traveler.InsanityWriteLog(msg);

                        uint customFlyThroughIndex = CameraController.GetCustomFlyThroughIndex();
                        if (GameStates.IsNewGame && (customFlyThroughIndex != 0x0))
                        {
                            msg += "D3";
                            Traveler.InsanityWriteLog(msg);

                            WaitForLotLoad(true, false);
                            ShowUI(false);
                            ShowMaptags(false);

                            msg += "D4";
                            Traveler.InsanityWriteLog(msg);

                            AudioManager.MusicMode = MusicMode.Flyby;
                            CameraController.OnCameraFlyThroughFinishedCallback += OnCameraFlyThroughFinishedEvent;
                            CameraController.StartFlyThrough(customFlyThroughIndex, false);
                            flag2 = true;

                            msg += "D5";
                            Traveler.InsanityWriteLog(msg);

                            GameUtils.EnableSceneDraw(true);
                            LoadingScreenController.Unload();
                            while (LoadingScreenController.Instance != null)
                            {
                                Sleep(0.0);
                            }
                        }
                        else
                        {
                            msg += "D6";
                            Traveler.InsanityWriteLog(msg);

                            WaitForLotLoad(true, true);
                            Camera.SetView(CameraView.SimView, true, true);
                        }
                    }
                    else
                    {
                        msg += "D7";
                        Traveler.InsanityWriteLog(msg);

                        Camera.RestorePersistedState();

                        msg += "D8";
                        Traveler.InsanityWriteLog(msg);

                        WaitForLotLoad(false, true);
                    }
                }
                else if (traveling)
                {
                    msg += "D9";
                    Traveler.InsanityWriteLog(msg);

                    WaitForLotLoad(!GameUtils.IsUniversityWorld(), true);
                    Camera.SetView(CameraView.SimView, true, true);
                }

                msg += "E";
                Traveler.InsanityWriteLog(msg);

                UserToolUtils.UserToolGeneric(0xc8, new ResourceKey(0x0L, 0x0, 0x0));
                if (!flag2)
                {
                    GameUtils.Unpause();
                }

                if (AudioManager.MusicMode != MusicMode.Flyby)
                {
                    AudioManager.MusicMode = MusicMode.None;
                }

                msg += "F";
                Traveler.InsanityWriteLog(msg);

                InWorldSubState.EdgeScrollCheck();
                InWorldSubState.OpportunityDialogCheck();

                try
                {
                    DreamsAndPromisesManager.ValidateLifetimeWishes();
                }
                catch (Exception e)
                {
                    Common.Exception(msg, e);
                }

                LifeEventManager.ValidatePendingLifeEvents();
                if (GameUtils.IsInstalled(ProductVersion.EP9))
                {
                    Tutorialette.TriggerLesson(Lessons.Degrees, Sim.ActiveActor);
                }

                if (GameUtils.GetCurrentWorldType() == WorldType.Base)
                {
                    Tutorialette.TriggerLesson(Lessons.Traveling, Sim.ActiveActor);
                }

                if (Sims3.Gameplay.ActiveCareer.ActiveCareer.ActiveCareerShowGeneralLesson)
                {
                    Tutorialette.TriggerLesson(Lessons.Professions, Sim.ActiveActor);
                }

                msg += "G";
                Traveler.InsanityWriteLog(msg);

                Tutorialette.TriggerLesson(Lessons.AgingStageLengths, Sim.ActiveActor);

                Sim selectedActor = PlumbBob.SelectedActor;
                if (selectedActor != null)
                {
                    // Custom
                    if (GameStates.sMovingWorldData != null)
                    {
                        WorldData.MergeFromCrossWorldData();
                    }

                    if (selectedActor.LotHome != null)
                    {
                        if (selectedActor.LotHome.HasVirtualResidentialSlots)
                        {
                            Tutorialette.TriggerLesson(Lessons.ApartmentLiving, selectedActor);
                        }
                    }
                    else
                    {
                        Lot lot = Helpers.TravelUtilEx.FindLot();
                        if (lot != null)
                        {
                            lot.MoveIn(selectedActor.Household);

                            foreach (SimDescription sim in Households.All(selectedActor.Household))
                            {
                                if (sim.CreatedSim == null)
                                {
                                    FixInvisibleTask.Perform(sim, false);
                                }
                                else
                                {
                                    bool replace = (sim.CreatedSim == selectedActor);

                                    ResetSimTask.Perform(sim.CreatedSim, false);

                                    if (replace)
                                    {
                                        selectedActor = sim.CreatedSim;
                                    }
                                }
                            }

                            msg += "MoveIn";
                        }
                    }

                    if (selectedActor.Household != null)
                    {
                        foreach (SimDescription description in Households.Humans(selectedActor.Household))
                        {
                            // Custom
                            if (GameStates.sMovingWorldData != null)
                            {
                                CrossWorldControl.Restore(description);
                            }

                            if (description.Child || description.Teen)
                            {
                                Tutorialette.TriggerLesson(Lessons.Pranks, null);
                                break;
                            }
                        }
                    }

                    if (selectedActor.BuffManager != null)
                    {
                        BuffMummysCurse.BuffInstanceMummysCurse element = selectedActor.BuffManager.GetElement(BuffNames.MummysCurse) as BuffMummysCurse.BuffInstanceMummysCurse;
                        if (element != null)
                        {
                            BuffMummysCurse.SetCursedScreenFX(element.CurseStage, false);
                        }
                    }

                    if (selectedActor.CareerManager != null)
                    {
                        selectedActor.CareerManager.UpdateCareerUI();
                    }

                    if (Traveler.Settings.mAllowSpawnWeatherStone && GameUtils.IsInstalled(ProductVersion.EP7) && GameUtils.IsInstalled(ProductVersion.EP8))
                    {
                        Sims3.Gameplay.UI.Responder.Instance.TrySpawnWeatherStone();
                    }
                }

                msg += "H";
                Traveler.InsanityWriteLog(msg);

                // Custom
                if (GameStates.sMovingWorldData != null)
                {
                    GameStatesEx.UpdateMiniSims(GameStatesEx.GetAllSims());

                    foreach (SimDescription sim in Households.All(Household.ActiveHousehold))
                    {
                        MiniSimDescription miniSim = MiniSimDescription.Find(sim.SimDescriptionId);
                        if (miniSim != null)
                        {
                            miniSim.Instantiated = true;
                            if (miniSim.HomeWorld != GameUtils.GetCurrentWorld())
                            {
                                miniSim.HomeWorld = GameUtils.GetCurrentWorld();
                            }
                        }

                        if (sim.HomeWorld != GameUtils.GetCurrentWorld())
                        {
                            sim.HomeWorld = GameUtils.GetCurrentWorld();
                        }
                    }
                }

                GameStates.SetupPostMoveData();
                GameStates.ClearMovingData();
                MovingWorldsWizardCheck();

                // Custom
                Household.IsTravelImport = false;

                InWorldSubStateEx.PlaceLotWizardCheck(this);

                msg += "I";
                Traveler.InsanityWriteLog(msg);

                foreach (Sim sim in LotManager.Actors)
                {
                    try
                    {
                        if (sim.HasBeenDestroyed)
                        {
                            continue;
                        }

                        OccultManager occultManager = sim.OccultManager;
                        if (occultManager != null)
                        {
                            occultManager.RestoreOccultIfNecessary();
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(sim, null, msg, e);
                    }
                }

                msg += "J";
                Traveler.InsanityWriteLog(msg);

                // Custom
                foreach (SimDescription description in SimListing.GetResidents(false).Values)
                {
                    if (description.LotHome == null)
                    {
                        continue;
                    }

                    MiniSimDescription miniSimDescription = description.GetMiniSimDescription();
                    if (miniSimDescription != null)
                    {
                        miniSimDescription.LotHomeId = description.LotHome.LotId;
                    }
                }

                msg += "K";
                Traveler.InsanityWriteLog(msg);
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
            finally
            {
                CASExitLoadScreen.Close();
            }
        }
Exemplo n.º 13
0
        public override void PregnancyComplete(List <Sim> newborns, List <Sim> followers)
        {
            if (mMom.IsSelectable)
            {
                Audio.StartObjectSound(mMom.ObjectId, "sting_baby_born", false);
            }

            Tutorialette.TriggerLesson(Lessons.Babies, mMom);
            EventTracker.SendEvent(new PregnancyEvent(EventTypeId.kHadBaby, mMom, mDad, this, newborns));

            if (mDad != null)
            {
                EventTracker.SendEvent(new PregnancyEvent(EventTypeId.kHadBaby, mDad, mMom, this, newborns));
            }

            mMom.RemoveInteractionByType(TakeToHospital.Singleton);
            mMom.BuffManager.RemoveElement(BuffNames.BabyIsComing);
            UnrequestPregnantWalkStyle();

            if (!mMom.SimDescription.IsVampire)
            {
                Motive motive = mMom.Motives.GetMotive(CommodityKind.Hunger);

                if (motive != null)
                {
                    motive.PregnantMotiveDecay = false;
                }
            }

            Motive motive2 = mMom.Motives.GetMotive(CommodityKind.Bladder);

            if (motive2 != null)
            {
                motive2.PregnantMotiveDecay = false;
            }

            BuffNames buffNames = BuffNames.ItsABoy;

            switch (newborns.Count)
            {
            case 1:
                if (newborns[0].IsFemale)
                {
                    buffNames = BuffNames.ItsAGirl;
                }
                break;

            case 2:
                buffNames = BuffNames.ItsTwins;
                break;

            case 3:
                buffNames = BuffNames.ItsTriplets;
                break;

            case 4:
                buffNames = CommonPregnancy.sItsQuadruplets;
                break;
            }

            mMom.BuffManager.AddElement(buffNames, Origin.FromNewBaby);

            if (mMom.HasTrait(TraitNames.Dramatic))
            {
                mMom.PlayReaction(ReactionTypes.JoyousCrying, ReactionSpeed.NowOrLater);
            }

            if (mDad != null && !mDad.HasBeenDestroyed && mDad.BuffManager.AddElement(buffNames, Origin.FromNewBaby))
            {
                if (mDad.HasTrait(TraitNames.Dramatic))
                {
                    mDad.PlayReaction(ReactionTypes.JoyousCrying, ReactionSpeed.NowOrLater);
                }

                if (mDad.IsSelectable && !mMom.Household.Contains(mDad.SimDescription))
                {
                    string titleText = null;

                    switch (buffNames)
                    {
                    case BuffNames.ItsABoy:
                        titleText = Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:DadBabyBuffBoy", new object[]
                        {
                            mDad,
                            mMom,
                            newborns[0]
                        });
                        break;

                    case BuffNames.ItsAGirl:
                        titleText = Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:DadBabyBuffGirl", new object[]
                        {
                            mDad,
                            mMom,
                            newborns[0]
                        });
                        break;

                    case BuffNames.ItsTwins:
                        titleText = Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:DadBabyBuffTwins", new object[]
                        {
                            mDad,
                            mMom,
                            newborns[0],
                            newborns[1]
                        });
                        break;

                    case BuffNames.ItsTriplets:
                        titleText = Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:DadBabyBuffTriplets", new object[]
                        {
                            mDad,
                            mMom,
                            newborns[0],
                            newborns[1],
                            newborns[2]
                        });
                        break;

                    default:
                        titleText = Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:DadBabyBuffTriplets", new object[]
                        {
                            mDad,
                            mMom,
                            newborns[0],
                            newborns[1],
                            newborns[2],
                            newborns[3]
                        });
                        break;
                    }

                    StyledNotification.Show(new StyledNotification.Format(titleText, StyledNotification.NotificationStyle.kGameMessagePositive),
                                            "glb_tns_baby_coming_r2");
                }
            }

            if (followers != null)
            {
                foreach (Sim current in followers)
                {
                    if (current.SimDescription.ToddlerOrAbove)
                    {
                        current.BuffManager.AddElement(buffNames, Origin.FromNewBaby);
                    }
                }
            }

            foreach (Sim current2 in newborns)
            {
                if (!mMom.Household.IsActive)
                {
                    current2.SimDescription.AgingState.AgeUpWithinNDays(kMaxDaysAsNPCBaby);
                }

                current2.SimDescription.PushAgingEnabledToAgingManager();
            }

            mMom.SimDescription.NullOutPregnancy();
        }
Exemplo n.º 14
0
        public override bool Run()
        {
            try
            {
                if (!Target.RouteToCone(Actor))
                {
                    return(false);
                }

                StandardEntry();

                try
                {
                    BeginCommodityUpdates();
                    if (((Target.mJobSelectionDay.Ticks == 0x0L) || (SimClock.CurrentDayOfWeek != Target.mJobSelectionDay.DayOfWeek)) || (SimClock.ElapsedTime(TimeUnit.Days, Target.mJobSelectionDay) >= 1f))
                    {
                        Target.mAvailableJobs.Clear();
                        Target.mTakenJobs.Clear();
                        Target.mJobSelectionDay = SimClock.CurrentTime();
                        Target.StartTimer();
                    }

                    if (GameUtils.IsUniversityWorld())
                    {
                        EnterStateMachine("JobBoard", "Enter", "x");
                        SetActor("jobBoard", Target);
                        AnimateSim("Exit");
                    }
                    else
                    {
                        Actor.PlaySoloAnimation("a2o_postBoxJobBoard_checkBoard_x", true);
                    }

                    EndCommodityUpdates(true);

                    Definition definition = InteractionDefinition as Definition;

                    Tutorialette.TriggerLesson(Lessons.QuestTracker, Actor);
                    if (Autonomous || !UIUtils.IsOkayToStartModalDialog())
                    {
                        Actor.Wander(kMinWanderDistance, kMaxWanderDistance, false, RouteDistancePreference.NoPreference, false);
                    }
                    else
                    {
                        OpportunityNames choice = OpportunityNames.Undefined;
                        if (Target.mTakenJobs.Count >= kOpportunitiesPerDay)
                        {
                            string msg = "JobBoardEmptyTNS";
                            if (GameUtils.IsUniversityWorld())
                            {
                                msg = "JobBoardEmptyTNSEP9";
                            }

                            Actor.ShowTNSIfSelectable(LocalizeString(Actor.IsFemale, msg, new object[0x0]), StyledNotification.NotificationStyle.kSimTalking);
                        }
                        else
                        {
                            if ((Target.mAvailableJobs.Count + Target.mTakenJobs.Count) < kOpportunitiesPerDay)
                            {
                                List <Opportunity> opportunities = OpportunityEx.GetAllOpportunities(Actor, definition.mOppName);

                                List <float> weights = new List <float>();
                                foreach (Opportunity opp in opportunities)
                                {
                                    float num = Actor.SimDescription.OpportunityHistory.HasRejectedOpportunity(opp.Guid) ? OpportunityHistory.kUserRejectedOpportunityWeightMultiplier : 1f;
                                    weights.Add(opp.ChanceToGetOnPhone * num);
                                }

                                Opportunity opportunity = null;
                                while (opportunities.Count > 0)
                                {
                                    int index = RandomUtil.GetWeightedIndex(weights.ToArray());

                                    opportunity = opportunities[index];

                                    weights.RemoveAt(index);
                                    opportunities.RemoveAt(index);

                                    if (!Target.mAvailableJobs.Contains(opportunity.Guid))
                                    {
                                        Target.mAvailableJobs.Add(opportunity.Guid);
                                        Target.mIndexOfLastChosen = Target.mAvailableJobs.Count - 0x1;

                                        if (!OpportunityEx.Perform(Actor.SimDescription, opportunity.Guid))
                                        {
                                            return(false);
                                        }

                                        choice = opportunity.Guid;
                                        break;
                                    }
                                }

                                if (choice == OpportunityNames.Undefined)
                                {
                                    Actor.ShowTNSIfSelectable(LocalizeString(Actor.IsFemale, "NoValidOppsTNS", new object[] { Actor }), StyledNotification.NotificationStyle.kGameMessagePositive, Target.ObjectId, Actor.ObjectId);
                                    return(false);
                                }
                            }
                            else
                            {
                                choice = OpportunityNames.Undefined;
                                int count = Target.mAvailableJobs.Count;
                                if (count > 0x0)
                                {
                                    int num2 = (Target.mIndexOfLastChosen + 0x1) % count;
                                    for (int i = 0x0; i < Target.mAvailableJobs.Count; i++)
                                    {
                                        int num4 = (i + num2) % count;
                                        OpportunityNames names3 = Target.mAvailableJobs[num4];
                                        if ((Actor.OpportunityManager.IsOpportunityAvailable(names3)) && (Actor.OpportunityManager.IsOpportunityCategory(names3, definition.mOppName)))
                                        {
                                            choice = names3;
                                            Target.mIndexOfLastChosen = num4;
                                            break;
                                        }
                                    }
                                }

                                if (choice != OpportunityNames.Undefined)
                                {
                                    if (!OpportunityEx.Perform(Actor.SimDescription, choice))
                                    {
                                        return(false);
                                    }
                                }
                                else
                                {
                                    Actor.ShowTNSIfSelectable(LocalizeString(Actor.IsFemale, "NoValidOppsTNS", new object[] { Actor }), StyledNotification.NotificationStyle.kGameMessagePositive, Target.ObjectId, Actor.ObjectId);
                                }
                            }

                            if (choice != OpportunityNames.Undefined)
                            {
                                Target.mIndexOfLastChosen = 0x0;
                                Target.mAvailableJobs.Remove(choice);
                                Target.mTakenJobs.Add(choice);
                                if (Target.mTakenJobs.Count >= kOpportunitiesPerDay)
                                {
                                    Target.StopHelperEffect();
                                }
                            }
                        }
                    }
                }
                finally
                {
                    StandardExit();
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }