Exemplo n.º 1
0
        protected virtual OptionResult RunAll(List <LotHouseItem> houses)
        {
            if (houses != null)
            {
                bool askedAndAnswered = !CanApplyAll();

                foreach (LotHouseItem house in houses)
                {
                    if (!Allow(house.mLot, house.mHouse))
                    {
                        continue;
                    }

                    if (Run(house.mLot, house.mHouse) == OptionResult.Failure)
                    {
                        return(OptionResult.Failure);
                    }

                    if (!askedAndAnswered)
                    {
                        askedAndAnswered = true;

                        if (houses.Count > 1)
                        {
                            if ((AutoApplyAll()) || (AcceptCancelDialog.Show(Common.Localize("HouseholdInteraction:ApplyAll"))))
                            {
                                ApplyAll = true;
                            }
                        }
                    }
                }

                return(RunResult);
            }
            return(OptionResult.Failure);
        }
Exemplo n.º 2
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            if (mSkill == null)
            {
                if (!AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":AllPrompt")))
                {
                    return(OptionResult.Failure);
                }
            }

            OptionResult result = base.Run(parameters);

            if (result != OptionResult.Failure)
            {
                if (Value < 0)
                {
                    Value = 0;
                }

                PriorValues.sFactorChanged = true;
            }

            return(result);
        }
Exemplo n.º 3
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                string msg = "Selectability:UnPrompt";
                if (me.IsNeverSelectable)
                {
                    msg = "Selectability:Prompt";
                }

                if (!AcceptCancelDialog.Show(Common.Localize(msg, me.IsFemale, new object[] { me })))
                {
                    return(false);
                }

                mSelectable = !me.IsNeverSelectable;
            }

            me.IsNeverSelectable = mSelectable;

            if ((!me.IsNeverSelectable) && (me.CreatedSim != null) && (me.Household == Household.ActiveHousehold))
            {
                using (SafeStore store = new SafeStore(me, SafeStore.Flag.None))
                {
                    if (Household.RoommateManager.IsNPCRoommate(me))
                    {
                        Household.RoommateManager.MakeRoommateSelectable(me);
                    }
                    else
                    {
                        me.CreatedSim.OnBecameSelectable();
                    }
                }
            }
            return(true);
        }
Exemplo n.º 4
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                if (!AcceptCancelDialog.Show(Common.Localize("QuitCareer:Prompt", me.IsFemale, new object[] { me })))
                {
                    return(false);
                }
            }

            EnsureCoworkerLists(me);

            if (me.Occupation != null)
            {
                me.Occupation.LeaveJobNow(Career.LeaveJobReason.kQuit);

                if (me.CreatedSim != null)
                {
                    me.CreatedSim.InteractionQueue.CancelAllInteractionsByType(WorkInRabbitHole.Singleton);
                }
            }

            return(true);
        }
Exemplo n.º 5
0
        protected override OptionResult Run(GameHitParameters <Sim> parameters)
        {
            if (!AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":Prompt", parameters.mTarget.IsFemale, new object[] { parameters.mTarget })))
            {
                return(OptionResult.Failure);
            }

            SimDescription sim = parameters.mTarget.SimDescription;

            SimOutfit geneOutfit = CASParts.GetOutfit(sim, CASParts.sPrimary, false);

            CASParts.Key outfitKey = new CASParts.Key(Dresser.GetStoreOutfitKey(OutfitCategories.Career, sim.IsUsingMaternityOutfits));

            SimOutfit source = CASParts.GetOutfit(sim, outfitKey, true);

            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, new CASParts.Key(OutfitCategories.Career, 1), geneOutfit))
            {
                new SavedOutfit(source).Apply(builder, false, null, CASParts.GeneticBodyTypes);
            }

            sim.CareerOutfitIndex = 1;

            return(OptionResult.SuccessRetain);
        }
Exemplo n.º 6
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            if (!AcceptCancelDialog.Show(Common.Localize("ClearNotices:Prompt")))
            {
                return(OptionResult.Failure);
            }

            NotificationManager manager = NotificationManager.Instance;

            if (manager == null)
            {
                return(OptionResult.Failure);
            }

            foreach (KeyValuePair <NotificationManager.TNSCategory, List <Notification> > pair in manager.mNotifications)
            {
                foreach (Notification notice in new List <Notification>(pair.Value))
                {
                    manager.Remove(notice);
                }
            }

            return(OptionResult.SuccessClose);
        }
Exemplo n.º 7
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (Sim.AssignedRole != null)
            {
                if (ManagerCareer.IsRegisterInstalled())
                {
                    if ((Sim.LotHome == null) && (Sim.Occupation == null))
                    {
                        IncStat("Registered Retiremenet");

                        GetData <CareerSimData>(Sim).Retire();
                    }
                }

                return(true);
            }
            else if (SimTypes.IsSpecial(Sim))
            {
                IncStat("Special");
                return(false);
            }

            bool enroll = false;

            if (GameUtils.IsUniversityWorld())
            {
                enroll = true;
            }
            else if (Careers.TestCareer(this, Sim, OccupationNames.AcademicCareer))
            {
                if (Careers.AllowHomeworldUniversity(Sim))
                {
                    AcademicDegreeManager degreeManager = Sim.CareerManager.DegreeManager;
                    if (degreeManager != null)
                    {
                        if (!degreeManager.HasCompletedAnyDegree())
                        {
                            enroll = true;
                        }
                    }
                }
            }

            if (!mForce)
            {
                if (GetValue <ManualCareerOption, bool>(Sim))
                {
                    IncStat("Manual");
                    return(false);
                }
            }

            List <OccupationNames> careers = new List <OccupationNames>();
            bool dream = Careers.GetPotentialCareers(this, Sim, careers, mCheckQuit);

            bool partTime = false;

            if (Sim.Teen)
            {
                bool scoreSuccess = true;
                if (mForce)
                {
                    if (AddScoring("FindJob", Sim) < 0)
                    {
                        scoreSuccess = false;
                    }
                }
                else
                {
                    if (AddScoring("ChanceFindJob", Sim) < 0)
                    {
                        scoreSuccess = false;
                    }
                }

                if ((!scoreSuccess) && (!GetValue <ForceTeensOption, bool>()))
                {
                    IncStat("Score Fail");
                    return(false);
                }
                partTime = true;
            }

            if (partTime)
            {
                List <OccupationNames> partTimeList = new List <OccupationNames>();

                AddStat(Sim.Age + ": Part-time Choices", careers.Count);

                foreach (OccupationNames career in careers)
                {
                    Career staticCareer = CareerManager.GetStaticCareer(career);
                    if (staticCareer == null)
                    {
                        continue;
                    }

                    if (staticCareer is School)
                    {
                        continue;
                    }

                    CareerLocation location = Career.FindClosestCareerLocation(Sim, staticCareer.Guid);
                    if (location == null)
                    {
                        continue;
                    }

                    if (!AllowStandalone(location))
                    {
                        continue;
                    }

                    foreach (CareerLocation loc in location.Owner.CareerLocations.Values)
                    {
                        Career possible = loc.Career;

                        if (!possible.IsPartTime)
                        {
                            continue;
                        }

                        if (ManagerCareer.IsPlaceholderCareer(possible))
                        {
                            continue;
                        }

                        partTimeList.Add(possible.Guid);
                    }
                }

                careers = partTimeList;

                AddStat(Sim.Age + ": Part-time Final", careers.Count);
            }
            else
            {
                AddStat(Sim.Age + ": Full-time Final", careers.Count);
            }

            if ((!mForce) && (!dream) && (Sim.Occupation != null) && (!(Sim.Occupation is Retired)))
            {
                IncStat("Non-Dream Employed");
                return(false);
            }

            if (enroll)
            {
                AcademicDegreeNames degreeName = AcademicDegreeNames.Undefined;

                foreach (DreamJob job in ManagerCareer.GetDreamJob(Sim))
                {
                    if (job == null)
                    {
                        continue;
                    }

                    foreach (AcademicDegreeStaticData data in AcademicDegreeManager.sDictionary.Values)
                    {
                        if (data.AssociatedOccupations.Contains(job.mCareer))
                        {
                            degreeName = data.AcademicDegreeName;
                            break;
                        }
                    }
                }

                if (degreeName == AcademicDegreeNames.Undefined)
                {
                    degreeName = AcademicDegreeManager.ChooseWeightRandomSuitableDegree(Sim);
                }

                if (!Careers.IsDegreeAllowed(Manager, Sim, degreeName))
                {
                    degreeName = Careers.GetAllowedDegree(Manager, Sim);
                }

                if (degreeName != AcademicDegreeNames.Undefined)
                {
                    if (AcademicCareer.GlobalTermLength == AcademicCareer.TermLength.kInvalid)
                    {
                        AcademicCareer.GlobalTermLength = AcademicCareer.TermLength.kOneWeek;
                    }

                    AcademicCareer.EnrollSimInAcademicCareer(Sim, degreeName, AcademicCareer.ChooseRandomCoursesPerDay());
                    return(true);
                }
            }

            bool promptForJob = GetValue <ChooseCareerOption, bool>();

            if ((promptForJob) && (!Careers.MatchesAlertLevel(Sim)))
            {
                promptForJob = false;
            }

            if (careers.Count > 0)
            {
                if ((Sim.Occupation != null) && (careers.Contains(Sim.Occupation.Guid)))
                {
                    IncStat("Already Has Choice");
                    return(false);
                }

                if (!promptForJob)
                {
                    if (AskForJob(Sim, RandomUtil.GetRandomObjectFromList(careers)))
                    {
                        return(true);
                    }
                }
            }

            if ((!mForce) && (Sim.Occupation != null))
            {
                IncStat("Already Employed");
                return(false);
            }

            List <Occupation> allCareers = null;

            if (careers.Count > 0)
            {
                allCareers = new List <Occupation>();

                foreach (Career career in CareerManager.CareerList)
                {
                    if (careers.Contains(career.Guid))
                    {
                        allCareers.Add(career);
                    }
                }
            }

            if ((allCareers == null) || (allCareers.Count == 0))
            {
                if (Sim.LifetimeWish == (uint)LifetimeWant.JackOfAllTrades)
                {
                    allCareers = GetChoices(true);
                }
            }

            if ((allCareers == null) || (allCareers.Count == 0))
            {
                allCareers = GetChoices(false);
            }

            if (allCareers.Count > 0)
            {
                AddStat("Random Choices", allCareers.Count);

                if ((promptForJob) && (AcceptCancelDialog.Show(ManagerSim.GetPersonalInfo(Sim, Common.Localize("ChooseCareer:Prompt", Sim.IsFemale)))))
                {
                    List <JobItem> jobs = new List <JobItem>();

                    foreach (Occupation career in GetChoices(false))
                    {
                        jobs.Add(new JobItem(career, allCareers.Contains(career)));
                    }

                    bool    okayed;
                    JobItem choice = new CommonSelection <JobItem>(Common.Localize("ChooseCareer:Header", Sim.IsFemale), Sim.FullName, jobs, new JobPreferenceColumn()).SelectSingle(out okayed);
                    if (!okayed)
                    {
                        return(false);
                    }

                    if (choice != null)
                    {
                        allCareers.Clear();
                        allCareers.Add(choice.Value);

                        SetValue <ManualCareerOption, bool>(Sim, true);
                    }
                }

                while (allCareers.Count > 0)
                {
                    Occupation choice = RandomUtil.GetRandomObjectFromList(allCareers);
                    allCareers.Remove(choice);

                    if (choice != null)
                    {
                        if (AskForJob(Sim, choice))
                        {
                            return(true);
                        }
                    }
                }

                IncStat("Ask Failure");
                return(false);
            }
            else
            {
                if (promptForJob)
                {
                    Common.Notify(Common.Localize("ChooseCareer:PromptFailure", Sim.IsFemale, new object[] { Sim }));
                }

                IncStat("No Applicable");
                return(false);
            }
        }
Exemplo n.º 8
0
        public override bool Run() // Run
        {
            if (Autonomous || Actor.IsNPC)
            {
                return(false);
            }
            if (!AcceptCancelDialog.Show("Are You Sure All Kill Sim?"))
            {
                return(false);
            }

            List <Sim> list = new List <Sim>();

            foreach (Sim sim in LotManager.Actors)
            {
                //if (sim.SimDescription.ToddlerOrAbove && !sim.IsInActiveHousehold && sim.LotCurrent != Household.ActiveHousehold.LotHome) //OK
                //if (!sim.IsInActiveHousehold || !(sim.Service is GrimReaper)) //Failed
                //if (sim.IsNPC && !sim.IsInActiveHousehold) //OK
                //if (sim.IsNPC && !sim.IsInActiveHousehold || !(sim.Service is GrimReaper)) // Failed All Sim Not If ||
                if (!(sim.Service is GrimReaper)) // OK
                {
                    //sim.InteractionQueue.AddNext(NotKillSimNPCOnly.Singleton.CreateInstance(sim, sim, new InteractionPriority((InteractionPriorityLevel)12, 1f), false, true));
                    //SpeedTrap.Sleep(1);
                    //if (!AcceptCancelDialog.Show("Done?")) return false;
                    //sim.InteractionQueue.Add(CCnlean.Singleton.CreateInstance(Actor, sim, new InteractionPriority((InteractionPriorityLevel)1, 0f), false, true));
                    list.Add(sim);
                }
            }
            if (list.Count > 0)
            {
                foreach (Sim nlist in list)
                {
                    try
                    {
                        //Name is
                        if (nlist.SimDescription.FirstName == "Death" && nlist.SimDescription.LastName == "Good System")
                        {
                            continue;
                        }

                        if (nlist.SimDescription.FirstName == "Good System" && nlist.SimDescription.LastName == "Death Helper")
                        {
                            continue;
                        }

                        if (nlist.SimDescription.FirstName == "Grim" && nlist.SimDescription.LastName == "Reaper")
                        {
                            continue;
                        }
                    }
                    catch (NullReferenceException)
                    { }
                    //nlist.BuffManager.RemoveAllElements();

                    /*
                     * List<SimDescription.DeathType> listr = new List<SimDescription.DeathType>();
                     * listr.Add(SimDescription.DeathType.Drown);
                     * listr.Add(SimDescription.DeathType.Starve);
                     * listr.Add(SimDescription.DeathType.Thirst);
                     * listr.Add(SimDescription.DeathType.Burn);
                     * listr.Add(SimDescription.DeathType.Freeze);
                     * listr.Add(SimDescription.DeathType.ScubaDrown);
                     * listr.Add(SimDescription.DeathType.Shark);
                     * listr.Add(SimDescription.DeathType.Jetpack);
                     * listr.Add(SimDescription.DeathType.Meteor);
                     * listr.Add(SimDescription.DeathType.Causality);
                     * listr.Add(SimDescription.DeathType.Electrocution);
                     * if (Actor.SimDescription.Elder)
                     * {
                     *  listr.Add(SimDescription.DeathType.OldAge);
                     * }
                     * listr.Add(SimDescription.DeathType.HauntingCurse);
                     * SimDescription.DeathType randomObjectFromList = RandomUtil.GetRandomObjectFromList(listr);
                     * //Urnstones.CreateGrave(nlist.SimDescription, randomObjectFromList, true, true);
                     */
                    //KillTask kt = new KillTask(Target, RandomUtil.CoinFlip() ? KillTask.GetDGSDeathType(Target) : KillTask.GetDeathType(Target), null, false, false);
                    //kt.AddToSimulator();
                    KillPro.FastKill(nlist, RandomUtil.CoinFlip() ? KillTask.GetDGSDeathType(Target) : KillTask.GetDeathType(Target), Actor, true, false);
                }
                //nlist.InteractionQueue.CancelAllInteractionsByType(NotKillSimNPCOnly.Singleton);
            }
            return(true);
        }
Exemplo n.º 9
0
        protected static bool BumpUp(SimDescription a, SimDescription b, bool prompt)
        {
            Relationship relation = Relationship.Get(a, b, true);

            if (relation == null)
            {
                return(false);
            }

            string currentState = relation.LTR.CurrentLTR;

            string nextState = null;

            if (currentState == "Stranger")
            {
                nextState = "Acquaintance";
            }
            else
            {
                nextState = ChangeRelationship.NextPositiveRomanceState(currentState);
            }

            if (nextState == null)
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show("Bump to Next Level", "There is no way to go higher than these sims already are.");
                }
                return(false);
            }

            if (relation.LTR.RelationshipIsInappropriate(LTRData.Get(nextState)))
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show("Bump to Next Level", "A relationship of " + nextState + " is unavailable to the selected sims.");
                }
                return(false);
            }

            if (a.Genealogy.IsBloodRelated(b.Genealogy))
            {
                if ((prompt) && (!AcceptCancelDialog.Show(a.FirstName + " " + a.LastName + " and " + b.FirstName + " " + b.LastName + " are blood related.  Proceed?")))
                {
                    return(false);
                }
            }

            if (currentState == "Romantic Interest")
            {
                if ((a.Partner != null) && (a.Partner != b))
                {
                    if ((b.Partner != null) && (b.Partner != a))
                    {
                        if ((prompt) && (!AcceptCancelDialog.Show("Both " + a.FirstName + " " + a.LastName + " and " + b.FirstName + " " + b.LastName + " already have different partners.  Proceed?")))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if ((prompt) && (!AcceptCancelDialog.Show(a.FirstName + " " + a.LastName + " already has a different partner.  Proceed?")))
                        {
                            return(false);
                        }
                    }
                }
                else if ((b.Partner != null) && (b.Partner != a))
                {
                    if ((prompt) && (!AcceptCancelDialog.Show(b.FirstName + " " + b.LastName + " already has a different partner.  Proceed?")))
                    {
                        return(false);
                    }
                }

                if (a.Partner != null)
                {
                    BumpDown(a, a.Partner, false);
                }
                if (b.Partner != null)
                {
                    BumpDown(b, b.Partner, false);
                }

                a.SetPartner(b);
            }

            relation.LTR.ForceChangeState(nextState);

            if (currentState == relation.LTR.CurrentLTR)
            {
                return(false);
            }

            StyledNotification.Show(new StyledNotification.Format("Relationship between " + a.FirstName + " " + a.LastName + " and " + b.FirstName + " " + b.LastName + " changed to " + nextState, StyledNotification.NotificationStyle.kAlert));
            return(true);
        }
Exemplo n.º 10
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            SimSelection.CriteriaSelection.Results uncheckedCriteria = new SimSelection.CriteriaSelection(Name, SelectionCriteria.SelectionOption.List).SelectMultiple(20);
            if (uncheckedCriteria.Count == 0)
            {
                if (uncheckedCriteria.mOkayed)
                {
                    return(OptionResult.SuccessClose);
                }
                else
                {
                    return(OptionResult.Failure);
                }
            }

            bool showSpecial = false;

            foreach (SimSelection.ICriteria crit in uncheckedCriteria)
            {
                if (crit is SimTypeOr)
                {
                    showSpecial = true;
                    break;
                }
            }

            Sim sim = parameters.mActor as Sim;

            List <IMiniSimDescription> simsList = new List <IMiniSimDescription>();

            foreach (List <IMiniSimDescription> sims in SimListing.AllSims <IMiniSimDescription>(sim.SimDescription, showSpecial).Values)
            {
                if (!showSpecial)
                {
                    sims.RemoveAll((e) => { return(SimSelection.IsSpecial(e)); });
                }

                simsList.AddRange(sims);
            }

            List <SimSelection.ICriteria> criteria = new List <SimSelection.ICriteria> ();

            foreach (SimSelection.ICriteria crit in uncheckedCriteria)
            {
                // Update changes the sims list, so we need a new copy for each call
                List <IMiniSimDescription> newList = new List <IMiniSimDescription>(simsList);
                if (crit.Update(sim.SimDescription, uncheckedCriteria, newList, false) != SimSelection.UpdateResult.Failure)
                {
                    criteria.Add(crit);
                }
            }

            string name = null;

            while (true)
            {
                name = StringInputDialog.Show(Name, Common.Localize("SaveFilterSetting:Prompt"), name, 256, StringInputDialog.Validation.None);
                if (string.IsNullOrEmpty(name))
                {
                    return(OptionResult.Failure);
                }

                if (callingMod != string.Empty)
                {
                    name = callingMod + "." + name;
                }

                if (Find(name) == null)
                {
                    break;
                }
                else if (AcceptCancelDialog.Show(Common.Localize("SaveFilterSetting:Exists")))
                {
                    Delete(name);
                    break;
                }
            }

            NRaas.MasterController.Settings.mFilters.Add(new SavedFilter(name, criteria));

            SimpleMessageDialog.Show(Name, Common.Localize("SaveFilterSetting:Success"));
            return(OptionResult.SuccessRetain);
        }
Exemplo n.º 11
0
        protected override void PrivatePerformAction(bool prompt)
        {
            try
            {
                Overwatch.Log("Kill All Homeless");

                if ((!prompt) || (AcceptCancelDialog.Show(Common.Localize("KillAllHomeless:Prompt"))))
                {
                    List <Household> list = new List <Household>();
                    int iSimCount         = 0;

                    foreach (Household household in Household.sHouseholdList)
                    {
                        if (household.IsSpecialHousehold)
                        {
                            continue;
                        }

                        if (household.InWorld)
                        {
                            continue;
                        }

                        if (Households.IsPassport(household))
                        {
                            continue;
                        }

                        if (Households.IsRole(household))
                        {
                            continue;
                        }

                        if (Households.IsLunarCycleZombie(household))
                        {
                            continue;
                        }

                        if (Households.IsActiveDaycare(household))
                        {
                            continue;
                        }

                        iSimCount += Households.NumSims(household);
                        list.Add(household);
                    }

                    foreach (Household household in list)
                    {
                        Annihilation.Cleanse(household);
                    }

                    if (iSimCount > 0)
                    {
                        Overwatch.AlarmNotify(Common.Localize("KillAllHomeless:Success", false, new object[] { iSimCount }));
                    }
                }
            }
            catch (Exception exception)
            {
                Common.Exception(Name, exception);
            }
        }
Exemplo n.º 12
0
        public static void ChangeLotTypeTask(object obj)
        {
            try
            {
                EditTownController ths = EditTownController.Instance;

                UIBinInfo info = obj as UIBinInfo;
                if ((info != null) && (info.LotId != ulong.MaxValue))
                {
                    ths.mModel.SetCurrentSelection(null, InfoSource.Unknown);
                    ILocalizationModel    localizationModel     = Sims3.UI.Responder.Instance.LocalizationModel;
                    LotType               lotType               = info.LotType;
                    CommercialLotSubType  commercialLotSubType  = info.CommercialLotSubType;
                    ResidentialLotSubType residentialLotSubType = info.ResidentialLotSubType;
                    string lotTypeName = "";

                    if (ChangeLotTypeDialogEx.Show(ref lotType, ref commercialLotSubType, ref residentialLotSubType, ref lotTypeName, info.IsHouseboatLot))
                    {
                        if (((lotType == LotType.Commercial) && (commercialLotSubType == CommercialLotSubType.kEP1_BaseCamp)) && ths.mModel.IsAnyLotBaseCamp())
                        {
                            string titleText   = Common.LocalizeEAString("Ui/Caption/Global:Failed");
                            string messageText = Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown/EP01:BaseCampExists");
                            SimpleMessageDialog.Show(titleText, messageText, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                        }
                        else if (((lotType == LotType.Commercial) && (commercialLotSubType == CommercialLotSubType.kEP11_BaseCampFuture)) && ths.mModel.IsAnyLotBaseCamp())
                        {
                            string str4 = localizationModel.LocalizeString("Ui/Caption/Global:Failed", new object[0]);
                            string str5 = localizationModel.LocalizeString("Ui/Caption/GameEntry/EditTown/EP11:BaseCampFutureExists", new object[0]);
                            SimpleMessageDialog.Show(str4, str5, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                        }
                        else if (EditTownModelEx.ChangeLotType(info.LotId, false, lotType, commercialLotSubType, residentialLotSubType))
                        {
                            EditTownController.AlertLotTypeChangeSuccess(info, localizationModel, lotType, lotTypeName);
                        }
                        else
                        {
                            string promptText = string.Empty;
                            if (commercialLotSubType == CommercialLotSubType.kEP10_Resort)
                            {
                                promptText = localizationModel.LocalizeString("Ui/Caption/GameEntry/EditTown:LotTypeResortFailed", new object[] { info.LotAddress });
                            }
                            else
                            {
                                promptText = localizationModel.LocalizeString((lotType == LotType.Commercial) ? "Ui/Caption/GameEntry/EditTown:LotTypeCommunityFailed" : "Ui/Caption/GameEntry/EditTown:LotTypeResidentialFailed", new object[] { info.LotAddress });
                            }

                            if (AcceptCancelDialog.Show(promptText))
                            {
                                if (EditTownModelEx.ChangeLotType(info.LotId, true, lotType, commercialLotSubType, residentialLotSubType))
                                {
                                    EditTownController.AlertLotTypeChangeSuccess(info, localizationModel, lotType, lotTypeName);
                                    EditTownMaptagController.Instance.ResetMaptags();
                                }
                                else
                                {
                                    string str5 = Common.LocalizeEAString("Ui/Caption/Global:Failed");
                                    promptText = Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown:LotTypeChangeFailed");
                                    SimpleMessageDialog.Show(str5, promptText, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("ChangeLotTypeTask", e);
            }
        }
Exemplo n.º 13
0
        public override bool Run()
        {
            var definition = base.InteractionDefinition as Definition;



            /*
             * if (AcceptCancelDialog.Show("FastKill."))
             * {
             *  if (KillPro.FastKill(Target, definition.death, null, true, false))
             *  //if (Target.Kill(definition.death))
             *  {
             *      StyledNotification.Show(new StyledNotification.Format("Check Ok", StyledNotification.NotificationStyle.kGameMessagePositive));
             *  }
             *  else
             *  {
             *      StyledNotification.Show(new StyledNotification.Format("Check Failed", StyledNotification.NotificationStyle.kGameMessagePositive));
             *  }
             *  return true;
             * }
             */

            if (AssemblyCheckByNiec.IsInstalled("DGSCore"))
            {
                /*
                 * if (AcceptCancelDialog.Show("KillTark"))
                 * {
                 *  KillTask kt = new KillTask(Target, definition.death, null, true, false);
                 *  kt.AddToSimulator();
                 *  StyledNotification.Show(new StyledNotification.Format("Check Ok", StyledNotification.NotificationStyle.kGameMessagePositive));
                 *  return true;
                 * }
                 *
                 *
                 * if (AcceptCancelDialog.Show("TimerTark"))
                 * {
                 *  KillTimerTask kt = new KillTimerTask(Target, definition.death, null, true, false);
                 *  kt.AddToSimulator();
                 *  StyledNotification.Show(new StyledNotification.Format("Check Ok", StyledNotification.NotificationStyle.kGameMessagePositive));
                 *  return true;
                 * }
                 *
                 */


                //if (KillSimNiecX.MineKill(Target, definition.death, null, true, false))
                if (KillPro.FastKill(Target, definition.death, null, true, false))
                //if (Target.Kill(definition.death))
                {
                    StyledNotification.Show(new StyledNotification.Format("Check Ok", StyledNotification.NotificationStyle.kGameMessagePositive));
                }
                else
                {
                    StyledNotification.Show(new StyledNotification.Format("Check Failed", StyledNotification.NotificationStyle.kGameMessagePositive));
                }
                return(true);
            }

            if (!Target.CanBeKilled()) // My Mod is CanBeKilled Not Modifed The Sims 3 is File Dll Gameplay
            {
                if (!AcceptCancelDialog.Show("Check CanBeKilled is failed Run MineKill?"))
                {
                    return(false);
                }
                KillSimNiecX.MineKill(Target, definition.death);
                return(true);
            }

            Target.Kill(definition.death);
            //KillSimNiecX.MineKill(Target, definition.death);
            return(true);
        }
Exemplo n.º 14
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            SimDescription mom = null, dad = null;

            Relationships.GetParents(Sim, out mom, out dad);

            bool   wasEither;
            string lastName = null;

            if (mom != null)
            {
                lastName = GetData(mom).HandleName <BabyLastNameOption>(Sims, dad, out wasEither);
            }
            else if (dad != null)
            {
                lastName = GetData(dad).HandleName <BabyLastNameOption>(Sims, mom, out wasEither);
            }

            if (lastName != null)
            {
                Sim.LastName = lastName;
            }
            else if (((dad != null) && (RandomUtil.CoinFlip())) || (mom == null))
            {
                Sim.LastName = dad.LastName;
            }
            else
            {
                Sim.LastName = mom.LastName;
            }

            if (GetValue <RenameNewbornOption, bool>(Sim))
            {
                CASAgeGenderFlags parentGender = CASAgeGenderFlags.None;

                List <object> parameters = Stories.AddGenderNouns(Sim);

                string key = null;
                if (mom != null)
                {
                    parentGender = mom.Gender;

                    parameters.AddRange(Stories.AddGenderNouns(mom));
                }

                if (dad != null)
                {
                    if (parentGender == CASAgeGenderFlags.None)
                    {
                        parentGender = dad.Gender;
                    }

                    parameters.AddRange(Stories.AddGenderNouns(dad));
                }

                if (mom != null)
                {
                    if (dad != null)
                    {
                        key = "DuoPrompt";
                    }
                    else
                    {
                        key = "SinglePrompt";
                    }
                }
                else if (dad != null)
                {
                    key = "SinglePrompt";
                }
                else
                {
                    key = "Prompt";
                }

                ManagerStory.AvailableStory story = new ManagerStory.AvailableStory(GetOption <Option>(), key, parameters.ToArray());

                string text = StringInputDialog.Show(GetOption <Option>().Name, story.Localize(GetOption <Option>(), Sim.Gender, parentGender, parameters.ToArray()), Sim.FirstName, 256, StringInputDialog.Validation.None);
                if (string.IsNullOrEmpty(text))
                {
                    return(false);
                }

                Sim.FirstName = text;
            }

            if ((!SimTypes.IsSelectable(Sim)) && (GetValue <PromptToMoveNewbornOption, bool>()))
            {
                foreach (SimDescription parent in Relationships.GetParents(Sim))
                {
                    if (SimTypes.IsSelectable(parent))
                    {
                        if (AcceptCancelDialog.Show(Common.Localize("PromptToMoveNewborn:Prompt", Sim.IsFemale, new object[] { Sim })))
                        {
                            Sim.Household.Remove(Sim);

                            parent.Household.Add(Sim);

                            if (Sim.CreatedSim == null)
                            {
                                Instantiation.EnsureInstantiate(Sim, parent.LotHome);
                            }
                        }
                    }
                }
            }

            return(true);
        }
Exemplo n.º 15
0
        protected static bool BumpUp(SimDescription a, SimDescription b, bool prompt, bool romantic)
        {
            Relationship relation = Relationship.Get(a, b, true);

            if (relation == null)
            {
                return(false);
            }

            LongTermRelationshipTypes currentState = relation.LTR.CurrentLTR;

            LongTermRelationshipTypes nextState = LongTermRelationshipTypes.Undefined;

            if (romantic)
            {
                nextState = NextPositiveRomanceState(currentState);
            }
            else
            {
                nextState = NextPositiveFriendState(currentState);
            }

            if (nextState == LongTermRelationshipTypes.Undefined)
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show(Common.Localize("Romance:BumpUpTitle"), Common.Localize("Romance:TooHigh"));
                }
                return(false);
            }

            /*
             * if (relation.LTR.RelationshipIsInappropriate(LTRData.Get(nextState)))
             * {
             *  if (prompt)
             *  {
             *      SimpleMessageDialog.Show(Common.Localize("Romance:BumpUpTitle"), Common.Localize ("Romance:Improper", new object[] { Common.LocalizeStatus (a, b, nextState) }));
             *  }
             *  return false;
             * }
             */

            if ((romantic) && (a.Genealogy.IsBloodRelated(b.Genealogy)))
            {
                if ((prompt) && (!AcceptCancelDialog.Show(Common.Localize("Romance:BloodPrompt", a.IsFemale, new object [] { a, b }))))
                {
                    return(false);
                }
            }

            if ((currentState == LongTermRelationshipTypes.RomanticInterest) && (romantic))
            {
                if ((a.Partner != null) && (a.Partner != b))
                {
                    if ((b.Partner != null) && (b.Partner != a))
                    {
                        if ((prompt) && (!AcceptCancelDialog.Show(Common.Localize("Romance:DualPartnerPrompt", a.IsFemale, new object[] { a, b }))))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if ((prompt) && (!AcceptCancelDialog.Show(Common.Localize("Romance:PartnerPrompt", a.IsFemale, new object[] { a }))))
                        {
                            return(false);
                        }
                    }
                }
                else if ((b.Partner != null) && (b.Partner != a))
                {
                    if ((prompt) && (!AcceptCancelDialog.Show(Common.Localize("Romance:PartnerPrompt", b.IsFemale, new object[] { b }))))
                    {
                        return(false);
                    }
                }

                if (a.Partner != null)
                {
                    BumpDown(a, a.Partner, false, true);
                }

                if (b.Partner != null)
                {
                    BumpDown(b, b.Partner, false, true);
                }

                if (a.TraitManager == null)
                {
                    a.Fixup();
                }

                if (b.TraitManager == null)
                {
                    b.Fixup();
                }

                Relationships.SetPartner(a, b);
            }

            ForceChangeState(relation, nextState);

            if (romantic)
            {
                if (prompt && relation.RomanceVisibilityState != null)
                {
                    long time = 0;
                    relation.TryGetActiveRomanceStartTime(out time);

                    int days = 0;
                    if (time != 0)
                    {
                        days = (int)SimClock.ElapsedTime(TimeUnit.Days, new DateAndTime(time));
                    }

                    string text = StringInputDialog.Show(Common.Localize("Romance:StartTime"), Common.Localize("Romance:StartPrompt", a.IsFemale, new object[] { a, b, SimClock.ElapsedCalendarDays() }), days.ToString());
                    if (string.IsNullOrEmpty(text))
                    {
                        return(false);
                    }

                    int mValue = 0;
                    if (!int.TryParse(text, out mValue) || mValue > SimClock.ElapsedCalendarDays())
                    {
                        SimpleMessageDialog.Show(Common.Localize("Romance:StartTime"), Common.Localize("Numeric:ErrorInputIgnored"));
                    }
                    else
                    {
                        relation.RomanceVisibilityState.mStartTime = SimClock.Subtract(SimClock.CurrentTime(), TimeUnit.Days, (float)mValue);
                    }
                }
            }

            if (relation.LTR.CurrentLTR == LongTermRelationshipTypes.BestFriendsForever)
            {
                bool isPetBFF = ((!a.IsHuman) || (!b.IsHuman));

                a.HasBFF = true;
                b.HasBFF = true;
                FindAndRemoveBFF(a, b, isPetBFF);
                FindAndRemoveBFF(b, a, isPetBFF);
            }

            if (currentState == relation.LTR.CurrentLTR)
            {
                return(false);
            }

            StyledNotification.Format format = new StyledNotification.Format(Common.Localize("Romance:Success", a.IsFemale, new object[] { a, b, LocalizeStatus(a, b, relation.LTR.CurrentLTR) }), StyledNotification.NotificationStyle.kGameMessagePositive);
            format.mTNSCategory = NotificationManager.TNSCategory.Lessons;
            StyledNotification.Show(format);
            return(true);
        }
Exemplo n.º 16
0
        public void OnTimer()
        {
            try
            {
                if (StoryProgression.Main == null)
                {
                    return;
                }

                Scenarios.IncStat("OnTimer Try");

                if (mInTimer)
                {
                    return;
                }

                mWatch.Restart();

                try
                {
                    mInTimer = true;

                    mRunning = true;

                    if (GetValue <ShowStartScreenOption, bool>())
                    {
                        FilePersistence.ImportFromTuning("NRaas.StoryProgression.Tuning");

                        if (!GetValue <ProgressionOption, bool>())
                        {
                            if (AcceptCancelDialog.Show(Localize("Welcome")))
                            {
                                GetOption <ProgressionOption>().SetValue(true);

                                new InitialHomelessScenario().Post(Households, true, false);
                            }
                        }
                    }

                    GetOption <ShowStartScreenOption>().SetValue(false);

                    if (GetValue <ProgressionOption, bool>())
                    {
                        int currentInterval = LifeSpan.GetHumanAgeSpanLength();

                        if (GetValue <LastAskedIntervalOption, int>() != currentInterval)
                        {
                            if (AcceptCancelDialog.Show(Localize("AgeSpan")))
                            {
                                AdjustSpeedForAgeSpan((float)currentInterval / GetValue <SavedIntervalOption, int>());

                                GetOption <SavedIntervalOption>().SetValue(currentInterval);
                            }

                            GetOption <LastAskedIntervalOption>().SetValue(currentInterval);
                        }
                    }

                    Update(false, false);
                }
                finally
                {
                    mInTimer = false;
                }

                Scenarios.IncStat("OnTimer Complete");
            }
            catch (Exception exception)
            {
                Common.Exception(UnlocalizedName, exception);
            }
        }
Exemplo n.º 17
0
        protected bool HandleDoppleganger(SimDescription loadedSim, Dictionary <ulong, IMiniSimDescription> preExistingSims, Dictionary <ulong, IMiniSimDescription> allSims, List <SimDescription> dependents)
        {
            List <SimDescription> choices = FindSim(loadedSim, preExistingSims);

            if (choices.Count == 0)
            {
                return(false);
            }

            SimDescription existingSim = null;

            if ((choices.Count == 1) && (!mAskedAndAnswered))
            {
                mAskedAndAnswered = true;

                mPrompt = !AcceptCancelDialog.Show(Common.Localize("Doppleganger:Prompt"));
            }

            if ((choices.Count == 1) && (!mPrompt))
            {
                existingSim = choices[0];
            }
            else
            {
                choices.Add(loadedSim);

                existingSim = new DopplegangerSelection(loadedSim, choices).SelectSingle();
            }

            if (existingSim == null)
            {
                return(false);
            }

            if (existingSim == loadedSim)
            {
                return(false);
            }

            if (existingSim.Genealogy == null)
            {
                existingSim.Fixup();
            }

            if ((loadedSim.Genealogy != null) && (existingSim.Genealogy != null))
            {
                loadedSim.Genealogy.ClearDerivedData();

                dependents.AddRange(Relationships.GetChildren(loadedSim));

                new Relationships.RepairParents().Perform(existingSim, loadedSim.Genealogy.mNaturalParents, UnusedLog, allSims);
                new Relationships.RepairChildren().Perform(existingSim, loadedSim.Genealogy.mChildren, UnusedLog, allSims);
                new Relationships.RepairSiblings().Perform(existingSim, loadedSim.Genealogy.mSiblings, UnusedLog, allSims);

                new Relationships.RepairParents().Perform(existingSim, loadedSim.Genealogy.mNaturalParents, UnusedLog, preExistingSims);
                new Relationships.RepairChildren().Perform(existingSim, loadedSim.Genealogy.mChildren, UnusedLog, preExistingSims);
                new Relationships.RepairSiblings().Perform(existingSim, loadedSim.Genealogy.mSiblings, UnusedLog, preExistingSims);
            }

            List <Relationship> relations = new List <Relationship>(Relationship.GetRelationships(loadedSim));

            if (relations != null)
            {
                foreach (Relationship relation in relations)
                {
                    if (relation == null)
                    {
                        continue;
                    }

                    Relationship newRelation = Relationship.Get(existingSim, relation.GetOtherSimDescription(loadedSim), true);
                    if (newRelation == null)
                    {
                        continue;
                    }

                    newRelation.LTR.ForceChangeState(relation.LTR.CurrentLTR);
                    newRelation.LTR.SetLiking(relation.LTR.Liking);
                    newRelation.LTR.AddInteractionBit(relation.LTR.LTRInteractionBits);
                }
            }

            if (loadedSim.mPartner != null)
            {
                dependents.Add(loadedSim.mPartner);
            }

            if ((loadedSim.Genealogy != null) && (existingSim.Genealogy != null))
            {
                if ((existingSim.Genealogy.Spouse == null) && (loadedSim.Genealogy.Spouse != null))
                {
                    existingSim.Genealogy.mSpouse         = loadedSim.Genealogy.Spouse;
                    existingSim.Genealogy.mSpouse.mSpouse = existingSim.Genealogy;

                    existingSim.mPartner = existingSim.Genealogy.mSpouse.SimDescription;

                    if (existingSim.mPartner != null)
                    {
                        existingSim.mPartner.mPartner = existingSim;
                    }
                }
            }

            if ((existingSim.mPartner == null) && (loadedSim.mPartner != null))
            {
                existingSim.mPartner          = loadedSim.mPartner;
                existingSim.mPartner.mPartner = existingSim;
            }

            dependents.Add(existingSim);

            return(true);
        }
Exemplo n.º 18
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Dictionary <ulong, List <IMiniSimDescription> > sims = SimListing.AllSims <IMiniSimDescription>(null, true);

            if ((sims == null) || (sims.Count == 0))
            {
                return(OptionResult.Failure);
            }

            List <IMiniSimDescription> dead = new List <IMiniSimDescription>();

            foreach (List <IMiniSimDescription> miniSims in sims.Values)
            {
                foreach (IMiniSimDescription miniSim in miniSims)
                {
                    SimDescription sim = miniSim as SimDescription;
                    if (sim == null)
                    {
                        continue;
                    }

                    if ((!sim.IsDead) && (!sim.IsGhost) && (sim.Household != null))
                    {
                        continue;
                    }

                    if (sim.IsPlayableGhost)
                    {
                        continue;
                    }

                    Urnstone urnstone = Sims3.Gameplay.Objects.Urnstone.FindGhostsGrave(sim);
                    if (urnstone != null)
                    {
                        if ((urnstone.InInventory) || (urnstone.InWorld))
                        {
                            continue;
                        }
                    }

                    dead.Add(sim);
                }
            }

            int count = 0;

            if (dead.Count > 0)
            {
                if (!AcceptCancelDialog.Show(Common.Localize("ReconstituteTheDead:Prompt", false, new object[] { dead.Count })))
                {
                    return(OptionResult.Failure);
                }

                foreach (SimDescription sim in dead)
                {
                    if (Urnstones.CreateGrave(sim, false) != null)
                    {
                        count++;
                    }
                }
            }

            SimpleMessageDialog.Show(Name, Common.Localize("ReconstituteTheDead:Success", false, new object[] { count }));
            return(OptionResult.SuccessClose);
        }
Exemplo n.º 19
0
        public override bool Run()
        {
            string msg = "Run";

            checked
            {
                try
                {
                    if (AcceptCancelDialog.Show("Force Select Actor?"))
                    {
                        msg = "Accept";
                        var         definition   = base.InteractionDefinition as Definition;
                        LotLocation lotLocation  = default(LotLocation);
                        ulong       lotLocation2 = World.GetLotLocation(this.Hit.mPoint, ref lotLocation);
                        Lot         lot          = LotManager.GetLot(lotLocation2);
                        if ((definition.Age & (CASAgeGenderFlags.Baby | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Child)) != CASAgeGenderFlags.None)
                        {
                            bool flag = false;
                            if (lot != null && lot.Household != null)
                            {
                                foreach (SimDescription simDescription in lot.Household.SimDescriptions)
                                {
                                    if (simDescription.TeenOrAbove)
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                            }
                            if (!flag)
                            {
                                if (AssemblyCheckByNiec.IsInstalled("DGSCore") && TwoButtonDialog.Show("DGSCore" + NiecMod.Nra.NiecException.NewLine + "Found Childern Sims in Household Without Adult" + NiecMod.Nra.NiecException.NewLine + "Note: Social Worker Catch Remove Sims" + NiecMod.Nra.NiecException.NewLine + "Are you sure?!", "Yea It Create " + definition.Age, "No Create YoungAdult"))
                                {
                                    msg = "Accept if not flag";
                                    Sim simnocheck = DGSMakeRandomSimNoCheck(Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                                    if (simnocheck != null)
                                    {
                                        if (simnocheck.IsSelectable)
                                        {
                                            PlumbBob.SelectActor(simnocheck);
                                        }
                                        else
                                        {
                                            simnocheck.SimDescription.IsNeverSelectable = false;
                                            PlumbBob.ForceSelectActor(simnocheck);
                                        }
                                        try
                                        {
                                            GlobalFunctions.PlaceAtGoodLocation(simnocheck, new World.FindGoodLocationParams(Hit.mPoint), false);
                                            if (simnocheck.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                            {
                                                simnocheck.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                                simnocheck.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                            }
                                        }
                                        catch
                                        { }

                                        try
                                        {
                                            if (simnocheck.SimDescription.Household.mName == null)
                                            {
                                                simnocheck.SimDescription.Household.SetName(simnocheck.SimDescription.LastName);
                                            }
                                        }
                                        catch (Exception ex2)
                                        {
                                            NiecMod.Nra.NiecException.WriteLog(msg + " SetName: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex2), true, true);
                                        }
                                    }
                                    else
                                    {
                                        //return false;
                                        msg = "MakeSim Failed! if flag";
                                        goto backif;
                                    }
                                    return(true);
                                }
backif:
                                Sim sim = DGSMakeRandomSim(this.Hit.mPoint, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, definition.WorldName);
                                msg     = "Terraininstance";
                                if (sim != null)
                                {
                                    Sitoat    = true;
                                    mSima     = sim;
                                    mSimaStat = sim.SimDescription;
                                    sim.FadeOut();
                                    var terraininstance = new Terrain.TeleportMeHere.Definition(false).CreateInstance(Terrain.Singleton, sim, new InteractionPriority((InteractionPriorityLevel)8195), base.Autonomous, base.CancellableByPlayer) as TerrainInteraction;

                                    try
                                    {
                                        if (sim.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                        {
                                            sim.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                            sim.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                        }
                                    }
                                    catch
                                    { }

                                    if (terraininstance != null)
                                    {
                                        terraininstance.Hidden  = true;
                                        terraininstance.MustRun = true;
                                        //Vector3 vector2;
                                        Lot loty = sim.SimDescription.LotHome;
                                        if (loty == null)
                                        {
                                            loty = sim.SimDescription.VirtualLotHome;
                                        }
                                        //World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(Helper.Create.GetPositionInRandomLot(loty));

                                        /*
                                         * fglParams.BooleanConstraints |= FindGoodLocationBooleans.StayInRoom;
                                         * fglParams.InitialSearchDirection = RandomUtil.GetInt(0x0, 0x7);
                                         */
                                        //lot.Household.Add(sim.SimDescription);
                                        terraininstance.Destination = Helpers.Create.GetPositionInRandomLot(loty);
                                        sim.InteractionQueue.Add(terraininstance);
                                    }
                                }
                                else
                                {
                                    return(false);
                                }
                                try
                                {
                                    //sim.SimDescription.Household.SetName(/* "E3Lesa is Good" */ "Good Household");
                                    sim.SimDescription.Household.SetName(sim.SimDescription.LastName);
                                }
                                catch (Exception ex2)
                                {
                                    NiecMod.Nra.NiecException.WriteLog(msg + " SetName: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex2), true, true);
                                }
                            }
                        }

                        //lot.MoveIn(lot.Household);
                        //FixFoxNonStaticDGSMakeRandomSim = true;
                        Sim sim2 = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                        if (sim2 != null)
                        {
                            PlumbBob.ForceSelectActor(sim2);
                            if (mSima != null && Sitoat)
                            {
                                var followchildsim = Sims3.Gameplay.Actors.Sim.FollowParent.Singleton.CreateInstance(sim2, mSima, new InteractionPriority((InteractionPriorityLevel)8195), base.Autonomous, base.CancellableByPlayer) as Sims3.Gameplay.Actors.Sim.FollowParent;
                                followchildsim.Hidden  = true;
                                followchildsim.MustRun = true;
                                if (mSima.InteractionQueue.AddNextIfPossibleAfterCheckingForDuplicates(followchildsim))
                                {
                                    Sim.ForceSocial(mSima, sim2, "Chat", (InteractionPriorityLevel)8195, true);
                                }

                                //sim2.SimDescription.TraitManager.RemoveAllElements();
                                try
                                {
                                    if (sim2.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                    {
                                        sim2.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                        sim2.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                    }
                                }
                                catch
                                { }
                            }
                        }
                    }



                    else
                    {
                        msg = "Cancel";
                        var definition = base.InteractionDefinition as Definition;
                        Sim sim3       = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                        if (sim3 == null)
                        {
                            msg = "Sim3 is Null";
                            Sim sim4 = DGSMakeRandomSim(this.Hit.mPoint, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, definition.WorldName);
                            if (sim4 != null)
                            {
                                msg = "Sim4 is Keep";


                                if (!sim4.IsInActiveHousehold)
                                {
                                    try
                                    {
                                        if (sim4.SimDescription.Household.NameUnlocalized == "Good Household")
                                        {
                                            sim4.SimDescription.Household.SetName("Evil Household");
                                        }
                                        else
                                        {
                                            sim4.SimDescription.Household.SetName(sim4.LastName);
                                        }
                                        sim4.SimDescription.TraitManager.RemoveAllElements();
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Daredevil);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Adventurous);
                                    }
                                    catch
                                    { }
                                }
                                else
                                {
                                    try
                                    {
                                        if (sim4.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                        {
                                            sim4.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                            sim4.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                        }
                                    }
                                    catch
                                    { }

                                    if (sim4.SimDescription.Household.NameUnlocalized == "Evil Household")
                                    {
                                        sim4.SimDescription.Household.SetName("Good Household");
                                    }
                                    else
                                    {
                                        sim4.SimDescription.Household.SetName(sim4.LastName);
                                    }
                                }



                                Sim sim5 = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                                if (sim5 != null)
                                {
                                    msg = "Sim5 is Keep";
                                    GlobalFunctions.PlaceAtGoodLocation(sim5, new World.FindGoodLocationParams(Hit.mPoint), false);

                                    if (!sim5.IsInActiveHousehold)
                                    {
                                        try
                                        {
                                            if (sim5.SimDescription.Household.NameUnlocalized == "Good Household")
                                            {
                                                sim5.SimDescription.Household.SetName("Evil Household");
                                            }
                                            else
                                            {
                                                sim5.SimDescription.Household.SetName(sim5.LastName);
                                            }
                                            if (definition.Gender == CASAgeGenderFlags.Child)
                                            {
                                                sim5.SimDescription.TraitManager.RemoveAllElements();
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                            }
                                            else
                                            {
                                                sim5.SimDescription.TraitManager.RemoveAllElements();
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Daredevil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Adventurous);
                                            }
                                        }
                                        catch
                                        { }
                                    }
                                    else
                                    {
                                        try
                                        {
                                            if (sim5.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                            {
                                                sim5.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                            }
                                        }
                                        catch
                                        { }


                                        if (sim5.SimDescription.Household.NameUnlocalized == "Evil Household")
                                        {
                                            sim5.SimDescription.Household.SetName("Good Household");
                                        }
                                        else
                                        {
                                            sim5.SimDescription.Household.SetName(sim5.LastName);
                                        }
                                    }
                                }
                                else
                                {
                                    return(false);
                                }
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (!sim3.IsInActiveHousehold)
                            {
                                try
                                {
                                    if (sim3.SimDescription.Household.NameUnlocalized == "Good Household")
                                    {
                                        sim3.SimDescription.Household.SetName("Evil Household");
                                    }

                                    else
                                    {
                                        sim3.SimDescription.Household.SetName(sim3.LastName);
                                    }

                                    if (definition.Gender == CASAgeGenderFlags.Child)
                                    {
                                        sim3.SimDescription.TraitManager.RemoveAllElements();
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                    }
                                    else
                                    {
                                        sim3.SimDescription.TraitManager.RemoveAllElements();
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Daredevil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Adventurous);
                                    }
                                }
                                catch
                                { }
                            }
                            else
                            {
                                try
                                {
                                    if (sim3.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                    {
                                        sim3.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                    }
                                }
                                catch
                                { }


                                if (sim3.SimDescription.Household.NameUnlocalized == "Evil Household")
                                {
                                    sim3.SimDescription.Household.SetName("Good Household");
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    NiecMod.Nra.NiecException.WriteLog(msg + " DGSMakeSim: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex), true, true);
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 20
0
        protected bool PrivatePerform()
        {
            if (!Sims.Instantiate(Sim, null, false))
            {
                return(false);
            }

            if (Sim.CreatedSim == null)
            {
                return(false);
            }

            bool DnP = (Sim.CreatedSim.DreamsAndPromisesManager != null);

            bool success = false;

            if (!DnP)
            {
                bool hadWish = Sim.HasLifetimeWish;

                try
                {
                    DreamsAndPromisesManager.CreateAndIntitForSim(Sim.CreatedSim);
                }
                catch (Exception e)
                {
                    Common.DebugException(Sim, e);
                }

                if (!hadWish)
                {
                    Sim.LifetimeWish = ChooseRandomLifetimeWish(Sim.CreatedSim.DreamsAndPromisesManager);
                    if (Sim.HasLifetimeWish)
                    {
                        Sim.CreatedSim.DreamsAndPromisesManager.TryAddLifetimeWish();
                    }
                    success = true;
                }
            }

            if ((Sims.MatchesAlertLevel(Sim)) && (GetValue <PromptOption, bool>()))
            {
                if ((AcceptCancelDialog.Show(ManagerSim.GetPersonalInfo(Sim, Common.Localize("ChooseLifetimeWish:Prompt", Sim.IsFemale)))) && (LifetimeWants.SetLifetimeWant(Sim)))
                {
                    success = true;
                }
            }

            if (!success)
            {
                Sim.LifetimeWish = ChooseRandomLifetimeWish(Sim.CreatedSim.DreamsAndPromisesManager);
                if (Sim.HasLifetimeWish)
                {
                    Sim.CreatedSim.DreamsAndPromisesManager.TryAddLifetimeWish();
                }
            }

            IncStat("Set");

            if (!DnP)
            {
                Sim.CreatedSim.NullDnPManager();
            }

            return(true);
        }
Exemplo n.º 21
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List <SimDescription> choices = new List <SimDescription>();

            bool active = false;

            foreach (SimDescription sim in Household.EveryHumanSimDescription())
            {
                if (SimTypes.IsService(sim))
                {
                    continue;
                }

                if (SimTypes.IsDead(sim))
                {
                    continue;
                }

                if (sim.YoungAdult)
                {
                    if (sim.GraduationType != GraduationType.None)
                    {
                        continue;
                    }

                    choices.Add(sim);

                    if (SimTypes.IsSelectable(sim))
                    {
                        active = true;
                    }
                }
                else if (sim.AdultOrAbove)
                {
                    if (sim.GraduationType == GraduationType.None)
                    {
                        sim.GraduationType = GraduationType.Graduate;

                        if (sim.CreatedSim != null)
                        {
                            sim.CreatedSim.SetDefaultGraduatedStateIfNeccessary();
                        }
                    }
                }
            }

            if (choices.Count == 0)
            {
                IncStat("No choices");
                return(false);
            }

            if (active)
            {
                if (!AcceptCancelDialog.Show(Common.Localize("Graduation:Prompt", false, new object[] { choices.Count })))
                {
                    IncStat("User Cancelled");
                    return(false);
                }
            }

            if (School.sGraduatingSims == null)
            {
                School.sGraduatingSims = new Dictionary <SimDescription, School.GraduationInformation>();
            }

            int maxPer = GetValue <MaxPerOption, int>();

            foreach (SimDescription sim in choices)
            {
                if ((!SimTypes.IsSelectable(sim)) && (School.sGraduatingSims.Count > maxPer))
                {
                    continue;
                }

                if (School.sGraduatingSims.ContainsKey(sim))
                {
                    continue;
                }

                School.sGraduatingSims.Add(sim, new School.GraduationInformation());
            }

            GetOption <GradMessageAlarmOption>().SetValue(true);

            return(true);
        }
Exemplo n.º 22
0
        public override bool Run()
        {
            Sim targetsim = GetSelectedObject() as Sim;

            if (targetsim != null)
            {
                foreach (InteractionInstance interactionInstance in Target.InteractionQueue.InteractionList) // Cant Cancel Fix
                {
                    interactionInstance.MustRun = false;
                    interactionInstance.Hidden  = false;
                }
                foreach (InteractionInstance interactionInstance in targetsim.InteractionQueue.InteractionList) // Cant Cancel Fix
                {
                    interactionInstance.MustRun = false;
                    interactionInstance.Hidden  = false;
                }
                SpeedTrap.Sleep(0u);

                Target.InteractionQueue.CancelAllInteractions();
                targetsim.InteractionQueue.CancelAllInteractions();
                SpeedTrap.Sleep(0u);
                targetsim.EnableInteractions();
                SpeedTrap.Sleep(0u);
                InteractionPriority priority = new InteractionPriority(InteractionPriorityLevel.ESRB);
                if (AcceptCancelDialog.Show("Do you want Run Divorce? (Yes Run or No Next)", true))
                {
                    InteractionInstance helloChatESRBi;
                    helloChatESRBi = new SocialInteractionA.Definition("Divorce", null, null, false).CreateInstance(Target, targetsim, priority, false, false);
                    //helloChatESRBi = new SituationSocial.Definition("Fight!", null, null, false).CreateInstance(Target, targetsim, new InteractionPriority(InteractionPriorityLevel.ESRB), false, false);
                    helloChatESRBi.MustRun = true;
                    helloChatESRBi.Hidden  = false;
                    targetsim.InteractionQueue.AddNext(helloChatESRBi);
                }
                //
                targetsim.SocialComponent.AddRelationshipUpdate(Target, CommodityTypes.Insulting, -100f, -100f);
                InteractionInstance helloChatESRBi2;
                helloChatESRBi2 = new SocialInteractionA.Definition("Argue", null, null, false).CreateInstance(Target, targetsim, priority, false, false);
                //helloChatESRBi = new SituationSocial.Definition("Fight!", null, null, false).CreateInstance(Target, targetsim, new InteractionPriority(InteractionPriorityLevel.ESRB), false, false);
                helloChatESRBi2.MustRun = true;
                //helloChatESRBi2.Hidden = false;
                targetsim.InteractionQueue.Add(helloChatESRBi2);
                targetsim.InteractionQueue.Add(helloChatESRBi2);
                targetsim.InteractionQueue.Add(helloChatESRBi2);
                targetsim.InteractionQueue.Add(helloChatESRBi2);
                targetsim.InteractionQueue.Add(helloChatESRBi2);
                targetsim.InteractionQueue.Add(helloChatESRBi2);
                //
                InteractionInstance helloChatESRBi3;
                helloChatESRBi3 = new SocialInteractionA.Definition("Declare Nemesis", null, null, false).CreateInstance(Target, targetsim, priority, false, false);
                //helloChatESRBi = new SituationSocial.Definition("Fight!", null, null, false).CreateInstance(Target, targetsim, new InteractionPriority(InteractionPriorityLevel.ESRB), false, false);
                helloChatESRBi3.MustRun = true;
                //helloChatESRBi3.Hidden = false;
                targetsim.InteractionQueue.Add(helloChatESRBi3);
                Sim.ForceSocial(targetsim, Target, "Declare Nemesis", (InteractionPriorityLevel)12, false);
                //
                InteractionInstance helloChatESRBi4;
                helloChatESRBi4 = new SocialInteractionA.Definition("Fight!", null, null, false).CreateInstance(Target, targetsim, priority, false, false);
                //helloChatESRBi = new SituationSocial.Definition("Fight!", null, null, false).CreateInstance(Target, targetsim, new InteractionPriority(InteractionPriorityLevel.ESRB), false, false);
                helloChatESRBi4.MustRun = true;
                //helloChatESRBi4.Hidden = false;
                targetsim.InteractionQueue.Add(helloChatESRBi4);
                Sim.ForceSocial(targetsim, Target, "Fight!", (InteractionPriorityLevel)12, false);
            }
            return(true);
        }
Exemplo n.º 23
0
        public override bool InRabbitHole()
        {
            try
            {
                if (!AcceptCancelDialog.Show(Common.Localize("Matchmaker:Prompt", Actor.IsFemale, new object[] { Woohooer.Settings.mMatchmakerCost })))
                {
                    return(false);
                }

                List <SimDescription> actors = new List <SimDescription>();
                actors.Add(Actor.SimDescription);
                actors.AddRange(Households.Pets(Actor.Household));

                SimDescription actor = Actor.SimDescription;
                if (actors.Count > 0)
                {
                    actor = new ActorSelection(Common.Localize("Matchmaker:Choices"), actor, actors).SelectSingle();
                    if (actor == null)
                    {
                        return(false);
                    }
                }

                SimSelection selection = new SimSelection(Common.Localize("Matchmaker:MenuName"), actor, SimListing.GetResidents(false).Values, SimSelection.Type.Matchmaker, 0);
                if (selection.IsEmpty)
                {
                    Common.Notify(Common.Localize("Matchmaker:NoChoices", Actor.IsFemale));
                    return(false);
                }

                SimDescription choice = selection.SelectSingle();
                if (choice == null)
                {
                    Common.Notify(Common.Localize("Matchmaker:NoSelect", Actor.IsFemale));
                    return(false);
                }

                if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(Actor, Target, Woohooer.Settings.mMatchmakerCost, true))
                {
                    Common.Notify(Common.Localize("Matchmaker:CannotPay", Actor.IsFemale));
                    return(false);
                }

                Relationship relation = Relationship.Get(actor, choice, true);
                if (relation != null)
                {
                    relation.MakeAcquaintances();
                }

                if (actor.IsHuman)
                {
                    Common.Notify(choice.CreatedSim, Common.Localize("Matchmaker:Success", Actor.IsFemale, choice.IsFemale, new object[] { choice }));
                }
                else
                {
                    SimDescription owner = null;
                    if (!choice.Household.IsSpecialHousehold)
                    {
                        owner = SimTypes.HeadOfFamily(choice.Household);
                    }

                    if (owner == null)
                    {
                        owner = choice;
                    }

                    relation = Relationship.Get(Actor.SimDescription, owner, true);
                    if (relation != null)
                    {
                        relation.MakeAcquaintances();
                    }

                    Common.Notify(choice.CreatedSim, Common.Localize("Matchmaker:SuccessPet", Actor.IsFemale, choice.IsFemale, new object[] { choice }));
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Exemplo n.º 24
0
 public static bool ShowConfirmationDialog(string message)
 {
     return(AcceptCancelDialog.Show(message));
 }
Exemplo n.º 25
0
        private static void SwitchToClick()
        {
            if (!Sims3.UI.Responder.Instance.OptionsModel.SaveGameInProgress)
            {
                EditTownInfoPanel ths = EditTownInfoPanel.Instance;

                bool flag = true;
                if ((ths.mModel.ValidActiveHousehold) && (!Mover.Settings.mDreamCatcher))
                {
                    if (!AcceptCancelDialog.Show(Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown:ChangeActiveHousehold")))
                    {
                        flag = false;
                    }
                    else if (!AcceptCancelDialog.Show(Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown:LoseWPWarning")))
                    {
                        flag = false;
                    }
                }

                if ((flag && (ths.mInfo != null)) && (!ths.mModel.IsPlaceLotsWizardFlow || AcceptCancelDialog.Show(Common.LocalizeEAString("Ui/Caption/GameEntry/PlaceEPLotsWizard:CancelPrompt"))))
                {
                    EditTownPuck.Instance.UpdateBackButton(true);
                    ulong householdId = ths.mInfo.HouseholdId;
                    ths.Visible = false;

                    try
                    {
                        ths.mModel.IsSwitchingHouseholds = true;
                        if (!ths.mModel.ExitEditTown(false))
                        {
                            ths.Visible = true;
                            EditTownPuck.Instance.UpdateBackButton(false);
                        }
                        else
                        {
                            // Custom
                            PlayFlowModelEx.ActivateSimScreenMaskedFunc(Sims3.UI.Responder.Instance.PlayFlowModel as PlayFlowModel, householdId);

                            Audio.StartSound("ui_softwindow_close");
                            ths.mModel.IsPlaceLotsWizardFlow = false;
                        }
                    }
                    finally
                    {
                        ths.mModel.IsSwitchingHouseholds = false;
                    }
                }
            }
        }
Exemplo n.º 26
0
        protected override List <CareerLocation> GetPotentials()
        {
            List <OccupationNames> careers = new List <OccupationNames>();
            bool dream = Careers.GetPotentialCareers(this, Sim, careers, false);

            List <CareerLocation> dreamSchools = new List <CareerLocation>();

            foreach (OccupationNames career in careers)
            {
                Career staticJob = CareerManager.GetStaticCareer(career);
                if (staticJob == null)
                {
                    continue;
                }

                CareerLocation jobLocation = FindClosestCareerLocation(Sim, staticJob.Guid);
                if (jobLocation == null)
                {
                    continue;
                }

                if (jobLocation.Owner == null)
                {
                    continue;
                }

                if (jobLocation.Owner.CareerLocations == null)
                {
                    continue;
                }

                foreach (CareerLocation schoolLoc in jobLocation.Owner.CareerLocations.Values)
                {
                    School staticSchool = schoolLoc.Career as School;
                    if (staticSchool == null)
                    {
                        continue;
                    }

                    if (HasValue <DisallowCareerOption, OccupationNames>(Sim, staticSchool.Guid))
                    {
                        continue;
                    }

                    if (HasValue <PublicAssignSchoolScenario.ConsiderPublicOption, OccupationNames>(staticSchool.Guid))
                    {
                        continue;
                    }

                    // Disallow home schooling at this point
                    if ((staticSchool.Level1 == null) || (staticSchool.Level1.DayLength == 0))
                    {
                        continue;
                    }

                    if (staticSchool is SchoolHigh)
                    {
                        if (career == OccupationNames.SchoolHigh)
                        {
                            continue;
                        }

                        if (!Sim.Teen)
                        {
                            continue;
                        }
                    }
                    else if (staticSchool is SchoolElementary)
                    {
                        if (career == OccupationNames.SchoolElementary)
                        {
                            continue;
                        }

                        if (!Sim.Child)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (!staticJob.CareerAgeTest(Sim))
                        {
                            continue;
                        }
                    }

                    CareerLocation location = FindClosestCareerLocation(Sim, staticSchool.Guid);
                    if (location == null)
                    {
                        continue;
                    }

                    dreamSchools.Add(location);
                }
            }

            AddStat("Dream Schools", dreamSchools.Count);

            if ((GetValue <PromptToAssignSchoolOption, bool>()) && (Careers.MatchesAlertLevel(Sim)))
            {
                List <FindJobScenario.JobItem> items = new List <FindJobScenario.JobItem>();

                bool found = false;

                foreach (Career career in CareerManager.CareerList)
                {
                    if (career is SchoolHigh)
                    {
                        if (!Sim.Teen)
                        {
                            continue;
                        }

                        if (career.Guid != OccupationNames.SchoolHigh)
                        {
                            found = true;
                        }
                    }
                    else if (career is SchoolElementary)
                    {
                        if (!Sim.Child)
                        {
                            continue;
                        }

                        if (career.Guid != OccupationNames.SchoolElementary)
                        {
                            found = true;
                        }
                    }
                    else if (career is School)
                    {
                        if (!career.CareerAgeTest(Sim))
                        {
                            continue;
                        }

                        if ((career.Level1 != null) && (career.Level1.DayLength != 0))
                        {
                            found = true;
                        }
                    }
                    else
                    {
                        continue;
                    }

                    if (HasValue <DisallowCareerOption, OccupationNames>(Sim, career.Guid))
                    {
                        continue;
                    }

                    if (HasValue <PublicAssignSchoolScenario.ConsiderPublicOption, OccupationNames>(career.Guid))
                    {
                        continue;
                    }

                    CareerLocation location = FindClosestCareerLocation(Sim, career.Guid);
                    if (location == null)
                    {
                        continue;
                    }

                    items.Add(new FindJobScenario.JobItem(location.Career, dreamSchools.Contains(location)));
                }

                FindJobScenario.JobItem choice = null;
                if ((items.Count > 1) && (found))
                {
                    if (AcceptCancelDialog.Show(ManagerSim.GetPersonalInfo(Sim, Common.Localize("RichAssignSchool:Prompt", Sim.IsFemale))))
                    {
                        choice = new CommonSelection <FindJobScenario.JobItem>(Common.Localize("ChooseCareer:Header", Sim.IsFemale), Sim.FullName, items, new FindJobScenario.JobPreferenceColumn()).SelectSingle();
                    }
                }
                else if (items.Count == 1)
                {
                    Career career = items[0].Value as Career;

                    // Do not auto-enroll sims in home-schooling
                    if ((career.Level1 != null) && (career.Level1.DayLength != 0))
                    {
                        choice = items[0];
                    }
                }

                if (choice != null)
                {
                    SetValue <ManualSchoolOption, bool>(Sim, true);

                    dreamSchools.Clear();

                    CareerLocation location = FindClosestCareerLocation(Sim, choice.Value.Guid);
                    if (location != null)
                    {
                        dreamSchools.Add(location);
                    }
                }
            }

            if (dreamSchools.Count == 0)
            {
                IncStat("Random");

                foreach (Career career in CareerManager.CareerList)
                {
                    if (career is SchoolHigh)
                    {
                        if (!Sim.Teen)
                        {
                            continue;
                        }
                    }
                    else if (career is SchoolElementary)
                    {
                        if (!Sim.Child)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        continue;
                    }

                    if (HasValue <DisallowCareerOption, OccupationNames>(Sim, career.Guid))
                    {
                        continue;
                    }

                    if (HasValue <PublicAssignSchoolScenario.ConsiderPublicOption, OccupationNames>(career.Guid))
                    {
                        continue;
                    }

                    CareerLocation location = FindClosestCareerLocation(Sim, career.Guid);
                    if (location == null)
                    {
                        continue;
                    }

                    if (location.Owner == null)
                    {
                        continue;
                    }

                    dreamSchools.Add(location);
                }

                /*
                 * if (dreamSchools.Count < 4)
                 * {
                 *  IncStat("Too Few");
                 *
                 *  dreamSchools.Clear();
                 * }*/
            }

            return(dreamSchools);
        }
Exemplo n.º 27
0
        public override bool InRabbitHole()
        {
            try
            {
                ActiveStage.Start();

                SimDescription choice = null;

                if (mMaster)
                {
                    if (!AcceptCancelDialog.Show(Common.Localize("Rendezvous:Prompt", Actor.IsFemale, new object[] { KamaSimtra.Settings.mRendezvousCostPerLevel })))
                    {
                        return(false);
                    }

                    Dictionary <int, List <SimDescription> > potentials = KamaSimtra.GetPotentials(Woohooer.Settings.AllowTeen(true));

                    List <SimDescription> choices = new List <SimDescription>();
                    for (int i = 1; i <= 10; i++)
                    {
                        List <SimDescription> fullList;
                        if (!potentials.TryGetValue(i, out fullList))
                        {
                            continue;
                        }

                        bool needFemale = false;

                        if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Male))
                        {
                            if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female))
                            {
                                if (RandomUtil.CoinFlip())
                                {
                                    needFemale = true;
                                }
                            }
                            else
                            {
                                needFemale = false;
                            }
                        }
                        else if (Actor.SimDescription.CanAutonomouslyBeRomanticWithGender(CASAgeGenderFlags.Female))
                        {
                            needFemale = true;
                        }
                        else
                        {
                            needFemale = !Actor.IsFemale;
                        }

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

                        foreach (SimDescription sim in fullList)
                        {
                            if (sim.IsFemale != needFemale)
                            {
                                continue;
                            }

                            if (sim.Household == Actor.Household)
                            {
                                continue;
                            }

                            string reason;
                            GreyedOutTooltipCallback callback = null;
                            if (!CommonSocials.CanGetRomantic(Actor.SimDescription, sim, false, true, true, ref callback, out reason))
                            {
                                if (callback != null)
                                {
                                    Common.DebugNotify(sim.FullName + Common.NewLine + callback());
                                }
                                continue;
                            }

                            if (choices.Contains(sim))
                            {
                                continue;
                            }

                            randomList.Add(sim);
                        }

                        if (randomList.Count > 0)
                        {
                            choices.Add(RandomUtil.GetRandomObjectFromList(randomList));
                        }
                    }

                    if (choices.Count == 0)
                    {
                        Common.Notify(Common.Localize("Rendezvous:NoneAvailable", Actor.IsFemale));
                        return(false);
                    }

                    choice = new SimSelection(Common.Localize("Rendezvous:MenuName"), Actor.SimDescription, choices, SimSelection.Type.Rendezvous, -1000).SelectSingle();
                    if (choice == null)
                    {
                        Common.Notify(Common.Localize("Rendezvous:NoSelect", Actor.IsFemale));
                        return(false);
                    }

                    if (Instantiation.PerformOffLot(choice, Target.LotCurrent, null) == null)
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }

                    Rendezvous interaction = Singleton.CreateInstance(Target, choice.CreatedSim, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as Rendezvous;
                    interaction.mMaster = false;
                    interaction.LinkedInteractionInstance = this;

                    choice.CreatedSim.InteractionQueue.CancelAllInteractions();
                    if (!choice.CreatedSim.InteractionQueue.AddNext(interaction))
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }

                    if (!DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), WaitPeriodLoop, null))
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }

                    if (!mBegin)
                    {
                        Common.Notify(Common.Localize("Rendezvous:BadSim", Actor.IsFemale, new object[] { choice }));
                        return(false);
                    }
                    else
                    {
                        Actor.ClearExitReasons();

                        TimedStage stage = new TimedStage(GetInteractionName(), KamaSimtra.Settings.mRendezvousDuration, false, false, true);
                        Stages      = new List <Stage>(new Stage[] { stage });
                        ActiveStage = stage;
                        ActiveStage.Start();
                    }
                }
                else
                {
                    Rendezvous interaction = LinkedInteractionInstance as Rendezvous;
                    if (interaction == null)
                    {
                        return(false);
                    }

                    interaction.mBegin = true;
                }

                if (mMaster)
                {
                    if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(Actor, Target, KamaSimtra.Settings.mRendezvousCostPerLevel * choice.SkillManager.GetSkillLevel(KamaSimtra.StaticGuid), true))
                    {
                        Common.Notify(Common.Localize("Rendezvous:CannotPay", Actor.IsFemale));
                        return(false);
                    }

                    Common.Notify(choice.CreatedSim, Common.Localize("Rendezvous:Success", Actor.IsFemale, choice.IsFemale, new object[] { choice }));

                    KamaSimtra skill = KamaSimtra.EnsureSkill(Actor);
                    if (skill != null)
                    {
                        skill.RendezvousActive = true;
                    }
                }

                BeginCommodityUpdates();
                bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                EndCommodityUpdates(succeeded);

                if (KamaSimtra.Settings.mRandomRendezvousMoodlet)
                {
                    Actor.BuffManager.AddElement(RandomUtil.GetRandomObjectFromList(sRandomBuffs), WoohooBuffs.sWoohooOrigin);
                }

                if (mMaster)
                {
                    CommonWoohoo.WoohooLocation location = CommonWoohoo.WoohooLocation.RabbitHole;

                    List <WoohooLocationControl> choices = CommonWoohoo.GetValidLocations(Actor.SimDescription);
                    if (choices.Count > 0)
                    {
                        location = RandomUtil.GetRandomObjectFromList(choices).Location;
                    }

                    CommonWoohoo.RunPostWoohoo(Actor, choice.CreatedSim, Target, CommonWoohoo.WoohooStyle.Safe, location, false);
                }

                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Exemplo n.º 28
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            ManagerLot.FindLotFlags flags = Inspect;
            if (CheapestHome)
            {
                flags |= ManagerLot.FindLotFlags.CheapestHome;
            }

            Lot lot = Lots.FindLot(this, mMovers, MaximumLoan, flags, OnLotPriceCheck);

            if (lot == null)
            {
                IncStat("No Lot");
                return(false);
            }
            else if (lot.Household != null)
            {
                IncStat("Occupied");
                return(false);
            }

            int lotCost = Lots.GetLotCost(lot);

            AddStat("Lot Cost", lotCost);

            List <SimDescription> sims = new List <SimDescription>(mMovers);

            Dictionary <Household, bool> oldHouses = new Dictionary <Household, bool>();

            House = null;

            foreach (SimDescription sim in sims)
            {
                if (House == null)
                {
                    if (SimTypes.IsSpecial(sim))
                    {
                        break;
                    }
                    else if (HouseholdsEx.NumSims(sim.Household) == sims.Count)
                    {
                        House = sim.Household;
                    }
                }
                else if (House != sim.Household)
                {
                    House = null;
                    break;
                }
            }

            int newFunds = 0;

            Lot oldLot = null;

            mNewHouse = false;
            if (House == null)
            {
                House = Household.Create();
                House.ModifyFamilyFunds(-House.FamilyFunds);

                House.SetName(sims[0].LastName);

                SetValue <AcountingOption, AccountingData>(House, new AccountingData());

                mNewHouse = true;
            }
            else if (House.LotHome != null)
            {
                oldLot = House.LotHome;

                newFunds = Lots.GetLotCost(House.LotHome);

                Lots.ProcessAbandonLot(oldLot);

                House.MoveOut();
            }

            if (OnPresetLotHome != null)
            {
                OnPresetLotHome(lot, House);
            }
            lot.MoveIn(House);

            ManagerSim.ForceRecount();

            Money.AdjustFunds(House, "SellLot", newFunds);

            AddStat("New Home Funds", House.FamilyFunds);

            SetValue <InspectedOption, bool>(House, false);

            if (mNewHouse)
            {
                foreach (SimDescription sim in sims)
                {
                    if (sim.Household != null)
                    {
                        AdjustFundsMoveInLot(sim, oldHouses);
                    }

                    Households.MoveSim(sim, House);

                    if (sim.IsMale)
                    {
                        House.Name = sim.LastName;
                    }
                }
            }

            if (OnLotPriceCheck(this, lot, newFunds, newFunds) != ManagerLot.CheckResult.IgnoreCost)
            {
                PayForMoveInLot(oldHouses, lotCost);
            }

            AddStat("Remaining Funds", House.FamilyFunds);

            foreach (SimDescription sim in sims)
            {
                Sims.Instantiate(sim, lot, true);
            }

            EventTracker.SendEvent(new HouseholdUpdateEvent(EventTypeId.kFamilyMovedInToNewHouse, House));

            if ((oldLot != null) && (GetValue <NotifyOnMoveOption, bool>(House)))
            {
                if (AcceptCancelDialog.Show(Common.Localize("NotifyOnMove:Prompt", false, new object[] { oldLot.Name, oldLot.Address })))
                {
                    if (CameraController.IsMapViewModeEnabled())
                    {
                        Sims3.Gameplay.Core.Camera.ToggleMapView();
                    }

                    Camera.FocusOnLot(oldLot.LotId, 0f);
                }
            }

            SetValue <NotifyOnMoveOption, bool>(House, false);

            return(true);
        }
Exemplo n.º 29
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            if (AcceptCancelDialog.Show(Common.Localize("ResetAll:Prompt")))
            {
                GameflowEx.Pause();

                Lot activeLot = null;
                if (Household.ActiveHousehold != null)
                {
                    activeLot = Household.ActiveHousehold.LotHome;
                }

                Dictionary <IGameObject, bool> objs = new Dictionary <IGameObject, bool>();

                try
                {
                    ProgressDialog.Show(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/Global:Processing", new object[0x0]), false);

                    List <IGameObject> local = new List <IGameObject>(Sims3.Gameplay.Queries.GetObjects <IGameObject>());
                    foreach (IGameObject obj in local)
                    {
                        if (IsPartOfActiveLot(obj, activeLot))
                        {
                            continue;
                        }

                        if (Households.Reset.ResetObject(obj, true))
                        {
                            objs[obj] = true;
                        }
                    }

                    List <IGameObject> global = new List <IGameObject>(Sims3.Gameplay.Queries.GetGlobalObjects <IGameObject>());
                    foreach (IGameObject obj in global)
                    {
                        if (IsPartOfActiveLot(obj, activeLot))
                        {
                            continue;
                        }

                        if (Households.Reset.ResetObject(obj, true))
                        {
                            objs[obj] = true;
                        }
                    }

                    foreach (Lot lot in LotManager.AllLots)
                    {
                        if (!MasterController.Settings.mResetEverythingOnActive)
                        {
                            if (lot == activeLot)
                            {
                                continue;
                            }
                        }

                        Households.Reset.ResetLot(lot, true);
                        objs[lot] = true;
                    }

                    foreach (Situation situation in new List <Situation>(Situation.sAllSituations))
                    {
                        if (!MasterController.Settings.mResetEverythingOnActive)
                        {
                            if (situation.Lot == activeLot)
                            {
                                continue;
                            }
                        }

                        // Ignore the Butler situation, as exiting it will end the butler service
                        if (situation is ButlerSituation)
                        {
                            continue;
                        }

                        try
                        {
                            Common.DebugNotify(situation.GetType().ToString());

                            situation.Exit();
                        }
                        catch (Exception exception)
                        {
                            Common.Exception(situation.Lot, exception);
                        }
                    }
                }
                finally
                {
                    ProgressDialog.Close();
                }

                SimpleMessageDialog.Show(Name, Common.Localize("ResetAll:Result", false, new object[] { objs.Count }));
            }
            return(OptionResult.SuccessClose);
        }
Exemplo n.º 30
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            bool okayed = true;

            Sim actorSim = parameters.mActor as Sim;

            if (parameters.mTarget is Sim)
            {
                mA = new List <IMiniSimDescription>();
                mA.Add((parameters.mTarget as Sim).SimDescription);
            }
            else
            {
                SimDescriptionObject simObject = parameters.mTarget as SimDescriptionObject;
                if (simObject != null)
                {
                    mA = new List <IMiniSimDescription>();

                    mA.Add(simObject.mSim);
                }
                else
                {
                    mA = null;

                    List <IMiniSimDescription> aMiniList = GetSelection(actorSim.SimDescription, GetTitleA(), GetCriteriaA(parameters), GetMaxSelectionA(), false, out okayed);
                    if (aMiniList != null)
                    {
                        // Must be set after filtering
                        mA = new List <IMiniSimDescription>(aMiniList);
                    }
                }
            }

            if ((mA == null) || (mA.Count == 0))
            {
                if (okayed)
                {
                    return(OptionResult.SuccessClose);
                }
                else
                {
                    return(OptionResult.Failure);
                }
            }

            IMiniSimDescription sim = null;

            if (actorSim != null)
            {
                sim = actorSim.SimDescription;
            }

            if (mA.Count == 1)
            {
                sim = mA[0];
            }

            if (sim == null)
            {
                return(OptionResult.Failure);
            }

            List <IMiniSimDescription> bList = new List <IMiniSimDescription>();

            List <IMiniSimDescription> bMiniList = GetSelection(sim, GetTitleB(), GetCriteriaB(parameters), GetMaxSelectionB(sim), false, out okayed);

            if (bMiniList != null)
            {
                foreach (IMiniSimDescription miniSim in bMiniList)
                {
                    bList.Add(miniSim);
                }
            }

            if (bList.Count == 0)
            {
                if (okayed)
                {
                    return(OptionResult.SuccessClose);
                }
                else
                {
                    return(OptionResult.Failure);
                }
            }

            bool askedAndAnswered = !CanApplyAll();

            foreach (IMiniSimDescription a in mA)
            {
                foreach (IMiniSimDescription b in bList)
                {
                    if (!Run(a, b))
                    {
                        return(OptionResult.Failure);
                    }

                    if (!askedAndAnswered)
                    {
                        askedAndAnswered = true;

                        if ((mA.Count > 1) || (bList.Count > 1))
                        {
                            if (AcceptCancelDialog.Show(Common.Localize("SimInteraction:ApplyAll")))
                            {
                                ApplyAll = true;
                            }
                        }
                    }
                }
            }

            return(OptionResult.SuccessClose);
        }