Exemplo n.º 1
0
 public Delegate(SimDescription sim)
 {
     mLTW = (LifetimeWant)sim.LifetimeWish;
 }
Exemplo n.º 2
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);
        }