protected override Scenario Handle(Event e, ref ListenerAction result) { PromotedScenario scenario = base.Handle(e, ref result) as PromotedScenario; if (scenario != null) { scenario.UpdateText(); scenario.mSuppressed.AddRange(sSuppressed); sSuppressed.Clear(); } return(scenario); }
protected static string GetText(Occupation occupation) { if (occupation is Retired) { return(null); } Career career = occupation as Career; if (career != null) { if (career.CurLevel == null) { return(null); } if (occupation.CareerLoc == null) { return(null); } if (occupation.CareerLoc.Owner == null) { return(null); } DaysOfTheWeek nextWorkDay = career.CurLevel.GetNextWorkDay(SimClock.CurrentDayOfWeek); string entryKey = (occupation is School) ? "Gameplay/Careers/Career:FirstSchoolDayDetails" : "Gameplay/Careers/Career:FirstDayDetails"; string text = Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, entryKey, new object[] { occupation.OwnerDescription, occupation.CareerLoc.Owner.CatalogName, SimClockUtils.GetText(career.CurLevel.StartTime), SimClockUtils.GetDayAsText(nextWorkDay) }); if (occupation.Boss != null) { text += Common.NewLine + Common.NewLine + Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, "Gameplay/Careers:MetBoss", new object[] { occupation.OwnerDescription, occupation.Boss }); } return(text); } else { XpBasedCareer xpCareer = occupation as XpBasedCareer; if (xpCareer != null) { return(PromotedScenario.GenerateXPBasedLevelUp(xpCareer)); } } return(null); }
public static void OnPerform(Scenario scenario, ScenarioFrame frame) { PromotedScenario promoted = scenario as PromotedScenario; if (promoted != null) { if (promoted.IsSuppressed()) { return; } } SimScenario s = scenario as SimScenario; if (s == null) { return; } scenario.Add(frame, new CareerBranchScenario(s.Sim), ScenarioResult.Start); }
protected override bool PrivateUpdate(ScenarioFrame frame) { mRetiredAtMax = false; PromotedScenario.PerformRetireAtMax(this, frame); if (mRetiredAtMax) { IncStat("RetireAtMax Denied"); return(false); } if (Sim.Occupation.Guid != OccupationNames.Firefighter) { if (AddScoring("Retirement", GetValue <ChanceofRetirementOption, int>(Sim), ScoringLookup.OptionType.Chance, Sim) <= 0) { IncStat("Scoring Fail"); return(false); } } Sim.Occupation.RetireNoConfirmation(); return(true); }
protected PromotedScenario(PromotedScenario scenario) : base(scenario) { mText = scenario.mText; mSuppressed = new List <ulong>(mSuppressed); }
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); }