예제 #1
0
        protected override void PrivatePerformAction(bool prompt)
        {
            Overwatch.Log(Name);

            int count = 0;

            foreach (ElevatorDoors obj in Sims3.Gameplay.Queries.GetObjects <ElevatorDoors>())
            {
                ElevatorInterior.ElevatorPortalComponent comp = obj.InteriorObj.ElevatorPortal as ElevatorInterior.ElevatorPortalComponent;
                if (comp != null)
                {
                    if (comp.mAssignedSims != null)
                    {
                        foreach (SimDescription sim in new List <SimDescription>(comp.mAssignedSims.Keys))
                        {
                            if (sim.CreatedSim != null)
                            {
                                ResetSimTask.Perform(sim.CreatedSim, true);
                            }
                        }
                    }
                }

                obj.SetObjectToReset();
                count++;
            }

            Overwatch.Log("Elevators Reset: " + count);
        }
예제 #2
0
파일: StuckCheck.cs 프로젝트: yakoder/NRaas
            protected override void OnPerform()
            {
                ulong id = mSim.SimDescription.SimDescriptionId;

                try
                {
                    if (Overwatch.Settings.mStuckCheckReset)
                    {
                        if (!Instantiation.AttemptToPutInSafeLocation(mSim, mDestination, !mSim.SimDescription.IsImaginaryFriend))
                        {
                            ResetSimTask.Perform(mSim, true);
                        }
                    }
                }
                finally
                {
                    //sData.Remove(id);
                    sRouteData.Remove(id);
                }

                // Keeps Stationary notices for debug only
                if (mSuffix == "Stationary" && !Common.kDebugging)
                {
                    return;
                }

                Common.Notify(mSim, Common.Localize("StuckCheck:" + mSuffix, mSim.IsFemale, new object[] { mSim }));
            }
예제 #3
0
파일: ErrorTrap.cs 프로젝트: pepoluan/NRaas
            protected override void OnPerform()
            {
                try
                {
                    Sim sim = mSim.CreatedSim;
                    if (sim == null)
                    {
                        return;
                    }

                    if (sim.SocialComponent == null)
                    {
                        sim = ResetSimTask.Perform(sim, false);
                        if (sim == null)
                        {
                            return;
                        }
                    }

                    if (sim.SocialComponent != null)
                    {
                        sim.SwitchToOutfitWithoutSpin(Sim.ClothesChangeReason.GoingOutside, mCategory, true);
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(mSim, e);
                }
            }
예제 #4
0
        public override void Dispose()
        {
            if (CopCar != null)
            {
                List <Sim> actors = new List <Sim>(CopCar.ActorsUsingMe);
                foreach (Sim actor in actors)
                {
                    ResetSimTask.Perform(actor, true);
                }
            }

            base.Dispose();
        }
예제 #5
0
파일: Reset.cs 프로젝트: yakoder/NRaas
        public static Sim ResetSim(Sim sim, bool resetAll)
        {
            if (resetAll)
            {
                if (MasterController.Settings.IsExcludedLot(sim.LotCurrent))
                {
                    return(sim);
                }

                if (MasterController.Settings.IsExcludedLot(sim.LotHome))
                {
                    return(sim);
                }
            }

            return(ResetSimTask.Perform(sim, true));
        }
예제 #6
0
파일: Reset.cs 프로젝트: yakoder/NRaas
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                if (!AcceptCancelDialog.Show(Common.Localize("Reset:Prompt", me.IsFemale, new object[] { me })))
                {
                    return(false);
                }
            }

            if (me.CreatedSim == null)
            {
                if (me.LotHome != null)
                {
                    Instantiation.Perform(me, null);
                }
            }
            else
            {
                ResetSimTask.Perform(me.CreatedSim, true);
            }
            return(true);
        }
예제 #7
0
        protected override void PrivatePerformAction(bool prompt)
        {
            try
            {
                Overwatch.Log("Cleanup Skill Modifiers");

                float vampireTotal = OccultVampire.kSkillGainModifierArtistic;
                vampireTotal += OccultVampire.kSkillGainModifierCreative;
                vampireTotal += OccultVampire.kSkillGainModifierMental;
                vampireTotal += OccultVampire.kSkillGainModifierMusical;
                vampireTotal += OccultVampire.kSkillGainModifierPhysical;

                float vampireAverage = vampireTotal / 5;

                foreach (SimDescription sim in Household.EverySimDescription())
                {
                    try
                    {
                        if (sim.SkillManager == null)
                        {
                            continue;
                        }

                        float maxMultiplier = 2;

                        OccultVampire vampire = sim.OccultManager.GetOccultType(OccultTypes.Vampire) as OccultVampire;
                        if ((vampire != null) && (vampire.AppliedNightBenefits))
                        {
                            maxMultiplier += vampireAverage;
                        }

                        if (sim.SkillManager.mSkillModifiers != null)
                        {
                            bool recompute = false;

                            foreach (KeyValuePair <SkillNames, float> modifier in sim.SkillManager.mSkillModifiers)
                            {
                                if (modifier.Value > maxMultiplier)
                                {
                                    recompute = true;
                                }
                                else if (modifier.Value < -1)
                                {
                                    recompute = true;
                                }
                            }

                            if (recompute)
                            {
                                ResetSimTask.ResetSkillModifiers(sim);

                                Overwatch.Log("Recalculated Skill Modifiers : " + sim.FullName);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(sim, e);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(Name, e);
            }
        }
예제 #8
0
        public override void LoadUI()
        {
            Common.StringBuilder msg = new Common.StringBuilder("LiveModeStateEx:LoadUI" + Common.NewLine);

            try
            {
                bool reset = false;

                Sim selectedActor = PlumbBob.SelectedActor;
                if (selectedActor != null)
                {
                    msg += Common.NewLine + "SelectedActor: " + selectedActor.FullName;

                    // Elements used by HudModel:Initialize()
                    if (selectedActor.SkillManager == null)
                    {
                        reset = true;
                        msg  += Common.NewLine + "SkillManager: null";
                    }
                    else if (selectedActor.SocialComponent == null)
                    {
                        reset = true;
                        msg  += Common.NewLine + "SocialComponent: null";
                    }
                    else if (selectedActor.CareerManager == null)
                    {
                        reset = true;
                        msg  += Common.NewLine + "CareerManager: null";
                    }
                    else if (selectedActor.TraitManager == null)
                    {
                        reset = true;
                        msg  += Common.NewLine + "TraitManager: null";
                    }
                    else if (selectedActor.SimDescription == null)
                    {
                        reset = true;
                        msg  += Common.NewLine + "SimDescription: null";
                    }
                    else if (selectedActor.InteractionQueue == null)
                    {
                        reset = true;
                        msg  += Common.NewLine + "InteractionQueue: null";
                    }
                    else if (selectedActor.OccultManager == null)
                    {
                        reset = true;
                        msg  += Common.NewLine + "OccultManager: null";
                    }
                    else if (selectedActor.CelebrityManager == null)
                    {
                        reset = true;
                        msg  += Common.NewLine + "CelebrityManager: null";
                    }
                }
                else
                {
                    msg += Common.NewLine + "No SelectedActor";
                }

                if (reset)
                {
                    msg += Common.NewLine + "Perform Reset";

                    selectedActor = ResetSimTask.Perform(selectedActor, false);

                    if (selectedActor == null)
                    {
                        PlumbBob.DoSelectActor(null, true);
                    }
                    else
                    {
                        DreamCatcher.SelectNoLotCheckImmediate(selectedActor, false, true);
                    }
                }

                base.LoadUI();

                /*
                 * // From LiveModeState:LoadUI
                 * mMapTagController = new MapTagControllerEx();
                 * Simulator.AddObject(mMapTagController);
                 * HudController.Load();*/
            }
            catch (Exception e)
            {
                Traveler.InsanityException(msg, e);
            }
        }
예제 #9
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();
            }
        }
예제 #10
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                mAdoptionParams = AdoptionDialog.Show(Common.Localize(GetTitlePrefix() + ":Prompt", me.IsFemale, new object[] { me }));
                if (mAdoptionParams.mCancelled)
                {
                    return(false);
                }
            }

            List <SimDescription> residents = new List <SimDescription>();

            foreach (SimDescription sim in SimListing.GetResidents(true).Values)
            {
                if (!sim.IsHuman)
                {
                    continue;
                }

                residents.Add(sim);
            }

            SimDescription dad = RandomUtil.GetRandomObjectFromList(residents);
            SimDescription mom = RandomUtil.GetRandomObjectFromList(residents);

            SimDescription newKid = null;

            if ((dad != null) && (mom != null))
            {
                if (dad.CelebrityManager == null)
                {
                    dad.Fixup();
                }

                if (mom.CelebrityManager == null)
                {
                    mom.Fixup();
                }

                newKid = Genetics.MakeDescendant(dad, mom, mAdoptionParams.mAge, mAdoptionParams.mIsFemale ? CASAgeGenderFlags.Female : CASAgeGenderFlags.Male, 100, new Random(), false, false, true);
            }
            else
            {
                SimUtils.SimCreationSpec spec = new SimUtils.SimCreationSpec();
                spec.Gender = mAdoptionParams.mIsFemale ? CASAgeGenderFlags.Female : CASAgeGenderFlags.Male;
                spec.Age    = mAdoptionParams.mAge;
                spec.Normalize();
                newKid = spec.Instantiate();
            }

            if (newKid == null)
            {
                Common.Notify(Common.Localize(GetTitlePrefix() + ":Failure"));
                return(false);
            }

            string genderName = null;

            if (newKid.IsFemale)
            {
                genderName = Common.Localize("BabyGender:Female");
            }
            else
            {
                genderName = Common.Localize("BabyGender:Male");
            }

            string name = StringInputDialog.Show(Name, Common.Localize("InstaBaby:NamePrompt", newKid.IsFemale, new object[0]), newKid.FirstName);

            if (!string.IsNullOrEmpty(name))
            {
                newKid.FirstName = name;
            }

            newKid.LastName = me.LastName;

            me.Household.Add(newKid);

            newKid.WasAdopted = true;

            Sim adoptedChild = Instantiation.Perform(newKid, null);

            if (adoptedChild != null)
            {
                ResetSimTask.UpdateInterface(adoptedChild);

                SocialWorkerAdoptionSituation.InstantiateNewKid instantiateNewKid = new SocialWorkerAdoptionSituation.InstantiateNewKid();

                instantiateNewKid.AssignTraits(adoptedChild);

                instantiateNewKid.GiveImaginaryFriendDoll(newKid);

                me.Genealogy.AddChild(newKid.Genealogy);

                if (me.CreatedSim != null)
                {
                    ActiveTopic.AddToSim(me.CreatedSim, "Recently Had Baby");

                    EventTracker.SendEvent(EventTypeId.kAdoptedChild, me.CreatedSim, adoptedChild);
                    EventTracker.SendEvent(EventTypeId.kNewOffspring, me.CreatedSim, adoptedChild);
                    EventTracker.SendEvent(EventTypeId.kParentAdded, adoptedChild, me.CreatedSim);
                }

                MidlifeCrisisManager.OnHadChild(me);

                Genealogy spouse = me.Genealogy.Spouse;
                if (spouse != null)
                {
                    spouse.AddChild(newKid.Genealogy);

                    SimDescription spouseDesc = spouse.SimDescription;
                    if (spouseDesc != null)
                    {
                        MidlifeCrisisManager.OnHadChild(spouseDesc);

                        if (spouseDesc.CreatedSim != null)
                        {
                            ActiveTopic.AddToSim(spouseDesc.CreatedSim, "Recently Had Baby");

                            EventTracker.SendEvent(EventTypeId.kAdoptedChild, spouseDesc.CreatedSim, adoptedChild);
                            EventTracker.SendEvent(EventTypeId.kNewOffspring, spouseDesc.CreatedSim, adoptedChild);
                            EventTracker.SendEvent(EventTypeId.kParentAdded, adoptedChild, spouseDesc.CreatedSim);
                        }
                    }
                }

                EventTracker.SendEvent(EventTypeId.kChildBornOrAdopted, null, adoptedChild);
            }

            return(true);
        }
예제 #11
0
파일: ResetCheck.cs 프로젝트: yakoder/NRaas
        protected override void PrivatePerformAction(bool prompt)
        {
            Overwatch.Log(Name);

            foreach (Sim createdSim in new List <Sim> (LotManager.Actors))
            {
                if (createdSim.SimDescription == null)
                {
                    continue;
                }

                StuckSimData other;
                if (!sData.TryGetValue(createdSim.SimDescription.SimDescriptionId, out other))
                {
                    other = new StuckSimData();

                    sData.Add(createdSim.SimDescription.SimDescriptionId, other);
                }

                try
                {
                    bool reset = false;

                    SimDescription sim = createdSim.SimDescription;

                    if (TestAging(sim, other))
                    {
                        reset = true;
                    }

                    if (reset)
                    {
                        string notice = Common.Localize(GetTitlePrefix() + ":" + other.Reason + "Two", sim.IsFemale, new object[] { sim });

                        if (other.mAgingSituation)
                        {
                            ResetSimTask.Perform(createdSim, true);
                            sData.Remove(sim.SimDescriptionId);
                        }
                        else
                        {
                            AgeTransitionTask.Perform(createdSim);
                        }

                        Overwatch.AlarmNotify(notice);

                        Overwatch.Log(notice);
                    }
                    else if (other.Valid)
                    {
                        if (Overwatch.Settings.mReportFirstResetCheck)
                        {
                            string notice = Common.Localize(GetTitlePrefix() + ":" + other.Reason + "One", sim.IsFemale, new object[] { sim });

                            Overwatch.Notify(createdSim, notice);

                            Overwatch.Log(notice);
                            Overwatch.Log(" Was Negative: " + other.mWasNegative);
                            Overwatch.Log(" Aging Situation: " + other.mAgingSituation);
                        }

                        if (other.mWasNegative)
                        {
                            AgeTransitionTask.Perform(createdSim);
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(createdSim, e);
                }
            }
        }