コード例 #1
0
        public static string GetName(SimDescription sim)
        {
            DreamNodeInstance instance = null;

            DreamsAndPromisesManager.sMajorWishes.TryGetValue(sim.LifetimeWish, out instance);

            string name = null;

            if (instance != null)
            {
                string sKey = instance.MaleNameKey;
                if (sim.IsFemale)
                {
                    sKey = instance.FemaleNameKey;
                }

                if (!Localization.GetLocalizedString(sKey, out name))
                {
                    name = instance.GetMajorWishName(sim);
                }

                if ((sim.CreatedSim != null) && (sim.CreatedSim.DreamsAndPromisesManager != null))
                {
                    ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode;
                    if (node != null)
                    {
                        name = node.Name;
                    }
                }
            }

            return(name);
        }
コード例 #2
0
        protected override bool Allow(SimDescription sim)
        {
            if (sim.LotHome == null)
            {
                IncStat("Not Resident");
                return(false);
            }
            else if (!sim.TeenOrAbove)
            {
                IncStat("Too Young");
                return(false);
            }
            else if ((sim.Teen) && (!GetValue <AllowTeenOption, bool>()))
            {
                IncStat("Teen Denied");
                return(false);
            }
            else
            {
                DreamNodeInstance instance = null;
                DreamsAndPromisesManager.sMajorWishes.TryGetValue(sim.LifetimeWish, out instance);
                if (instance != null)
                {
                    IncStat("Has LTW");
                    return(false);
                }
            }

            return(base.Allow(sim));
        }
コード例 #3
0
            public override void SetValue(uint value, uint storeType)
            {
                mValue = value;

                if (value == 0)
                {
                    mName = Common.Localize("Criteria.LifetimeWish:None");
                }
                else
                {
                    DreamNodeInstance wish = DreamsAndPromisesManager.GetMajorDream(value) as DreamNodeInstance;
                    if (wish != null)
                    {
                        mName = wish.GetMajorWishName(Sim.ActiveActor.SimDescription);
                        SetThumbnail(wish.PrimaryIconKey);
                    }
                }
            }
コード例 #4
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            LifetimeWant lifetimeWant = (LifetimeWant)Sim.LifetimeWish;

            bool prompt = (GetValue <PromptOption, bool>()) && (Careers.MatchesAlertLevel(Sim));

            DreamNodeInstance instance = null;

            DreamsAndPromisesManager.sMajorWishes.TryGetValue(Sim.LifetimeWish, out instance);
            if (instance == null)
            {
                if (!prompt)
                {
                    IncStat("No LTW");
                    return(false);
                }
            }
            else if (instance.InputSubject == null)
            {
                IncStat("No InputSubject");
                return(false);
            }

            Career career = Sim.Occupation as Career;

            CareerLevel prior = career.CurLevel.LastLevel;

            if (prior == null)
            {
                IncStat("No Prior");
                return(false);
            }

            if (prior.NextLevels.Count != 2)
            {
                IncStat("Not Branch");
                return(false);
            }

            CareerLevel newLevel = null;

            if (prompt)
            {
                bool flag = TwoButtonDialog.Show(
                    ManagerSim.GetPersonalInfo(Sim, Common.LocalizeEAString(Sim.IsFemale, career.SharedData.Text_BranchOffer, new object[] { Sim })),
                    Common.LocalizeEAString(Sim.IsFemale, career.SharedData.Text_Branch1, new object[0]),
                    Common.LocalizeEAString(Sim.IsFemale, career.SharedData.Text_Branch2, new object[0])
                    );

                if (flag)
                {
                    if (prior.NextLevels[0] == career.CurLevel)
                    {
                        return(false);
                    }
                    newLevel = prior.NextLevels[0];
                }
                else
                {
                    if (prior.NextLevels[1] == career.CurLevel)
                    {
                        return(false);
                    }
                    newLevel = prior.NextLevels[1];
                }
            }
            else if (instance.InputSubject != null)
            {
                if (instance.InputSubject.mType != DreamNodePrimitive.InputSubjectType.Career)
                {
                    IncStat("Not Career LTW");
                    return(false);
                }

                switch (career.Guid)
                {
                case OccupationNames.Music:
                    if (lifetimeWant == LifetimeWant.RockStar)
                    {
                        if (career.CurLevelBranchName == "ElectricRock")
                        {
                            IncStat("ElectricRock");
                            return(false);
                        }
                    }
                    else
                    {
                        if (career.CurLevelBranchName != "ElectricRock")
                        {
                            IncStat("Not ElectricRock");
                            return(false);
                        }
                    }
                    break;

                case OccupationNames.Criminal:
                    if (lifetimeWant == LifetimeWant.TheEmperorOfEvil)
                    {
                        if (career.CurLevelBranchName == "Evil")
                        {
                            IncStat("Evil");
                            return(false);
                        }
                    }
                    else
                    {
                        if (career.CurLevelBranchName != "Evil")
                        {
                            IncStat("Not Evil");
                            return(false);
                        }
                    }
                    break;

                case OccupationNames.LawEnforcement:
                    if (lifetimeWant == LifetimeWant.ForensicSpecialistDynamicDNAProfiler)
                    {
                        if (career.CurLevelBranchName == "ForensicAnalyst")
                        {
                            IncStat("Forensic");
                            return(false);
                        }
                    }
                    else
                    {
                        if (career.CurLevelBranchName != "ForensicAnalyst")
                        {
                            IncStat("Not Forensic");
                            return(false);
                        }
                    }
                    break;

                case OccupationNames.Film:
                    if (lifetimeWant == LifetimeWant.FileActor)
                    {
                        if (career.CurLevelBranchName == "Acting")
                        {
                            IncStat("Acting");
                            return(false);
                        }
                    }
                    else
                    {
                        if (career.CurLevelBranchName != "Acting")
                        {
                            IncStat("Not Acting");
                            return(false);
                        }
                    }
                    break;

                default:
                    return(false);
                }

                foreach (CareerLevel level in prior.NextLevels)
                {
                    if (career.CurLevel == level)
                    {
                        continue;
                    }

                    newLevel = level;
                    break;
                }
            }

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

            CareerLevel curLevel = career.CurLevel.LastLevel;

            career.GivePromotionRewardObjectsIfShould(newLevel);
            career.SetLevel(newLevel);

            try
            {
                PromotedScenario.AddSuppressed(Sim);

                career.OnPromoteDemote(curLevel, newLevel);
            }
            finally
            {
                PromotedScenario.RemoveSuppressed(Sim);
            }

            if (Sim.CreatedSim != null)
            {
                career.SetTones(Sim.CreatedSim.CurrentInteraction);
            }

            return(true);
        }