protected override bool PrivateUpdate(ScenarioFrame frame) { base.PrivateUpdate(frame); Careers.VerifyTone(Sim); return(mNewCoworkers.Count > 0); }
protected override bool PrivateUpdate(ScenarioFrame frame) { Sim sim = Sim.CreatedSim; if (sim == null) { Sims.Instantiate(Sim, null, false); sim = Sim.CreatedSim; } if (sim == null) { IncStat("Hibernating"); return(false); } Career job = Occupation as Career; Careers.VerifyTone(job); if (!ManagerCareer.ValidCareer(job)) { IncStat("Career Invalidated"); return(false); } InteractionInstance instance = GetWorkInteraction(job); if (instance == null) { IncStat("No Interaction"); return(false); } else if (!Test(sim, instance.InteractionDefinition)) { return(false); } else { if (sim.InteractionQueue.Add(instance)) { if (GetValue <AllowGoHomePushOption, bool>(Sim)) { Manager.AddAlarm(new GoHomePushScenario(Sim)); } } else { IncStat("Failure"); } mReport = PostSlackerWarning(); return(true); } }
protected override Scenario Handle(Event e, ref ListenerAction result) { WentToWorkScenario scenario = base.Handle(e, ref result) as WentToWorkScenario; if (scenario != null) { // Do this now, rather than waiting the 10 sim-minute Scenario manager delay Careers.VerifyTone(scenario.Sim); } return(scenario); }
protected override bool PrivateUpdate(ScenarioFrame frame) { Career job = Sim.Occupation as Career; Corrections.RemoveInvalidCoworkers(job); job.CareerLoc.CheckWorkers(); if ((job.Boss != null) && (!IsValidBoss(job, job.Boss))) { if ((job.Boss == Sim) || (!SimTypes.IsSelectable(Sim))) { job.SetBoss(null); IncStat("Dropped: Invalid"); } } if ((NeedsBoss(job, false)) && (ChooseBoss(job, IncreasePressure))) { return(true); } Careers.VerifyTone(Sim); return(false); }
protected override bool PrivateUpdate(ScenarioFrame frame) { Career job = Career; LawEnforcement lawCareer = job as LawEnforcement; if (lawCareer != null) { SimDescription partner = lawCareer.Partner; if (partner != null) { if (IsValidPartner(lawCareer, partner, false)) { try { job.AddCoworker(partner); } catch (Exception e) { Common.Exception(Career.OwnerDescription, partner, e); } } } } base.PrivateUpdate(frame); if (lawCareer != null) { if (!IsValidPartner(lawCareer, lawCareer.Partner, false)) { lawCareer.Partner = null; if (job.Coworkers != null) { foreach (SimDescription coworker in job.Coworkers) { if (HandlePartner(lawCareer, coworker, SimTypes.IsSelectable(Sim))) { break; } } } if (lawCareer.Partner == null) { HandlePartner(lawCareer, lawCareer.Boss, SimTypes.IsSelectable(Sim)); } } if (lawCareer.Partner != null) { if (Relationship.AreStrangers(Sim, lawCareer.Partner)) { Relationship.Get(Sim, lawCareer.Partner, true).MakeAcquaintances(); } } } Careers.VerifyTone(Sim); return(mNewCoworkers.Count > 0); }
protected override bool PrivateUpdate(ScenarioFrame frame) { Career job = Job; if (Sim.CreatedSim == null) { Sims.Instantiate(Sim, null, false); } if (Sim.CreatedSim == null) { IncStat("Hibernating"); return(false); } if ((job.mCalledInSick) || (job.mIsFakeSickDay)) { IncStat("Sick Day"); return(false); } Careers.VerifyTone(job); bool selfCommute = false; if ((!GetValue <AllowCarpoolOption, bool>(Sim)) || (!CarpoolEnabled(job)) || (!job.CurLevel.HasCarpool) || (!SimTypes.IsSelectable(Sim))) { if (!SimTypes.IsSelectable(Sim)) { try { // Don't queue stomp on their birthday if ((Sim.YearsSinceLastAgeTransition != 0) && (Sim.CreatedSim.InteractionQueue != null)) { Sim.CreatedSim.InteractionQueue.CancelAllInteractions(); } } catch (Exception e) { Common.DebugException(Sim, e); } } if (SimTypes.IsSelectable(Sim)) { IncStat("Active Alarm"); } else { IncStat("Inactive Alarm"); } selfCommute = true; } else { IncStat("Carpool"); } if ((SimTypes.IsSelectable(Sim)) && (GetValue <ShowCarpoolMessageOption, bool>()) && job.mHoursUntilWork <= 2) { string msg = GetCarpoolMessage(selfCommute); if (msg != null) { StyledNotification.Format format = new StyledNotification.Format(msg, ObjectGuid.InvalidObjectGuid, Sim.CreatedSim.ObjectId, StyledNotification.NotificationStyle.kGameMessagePositive); StyledNotification.Show(format, job.CareerIconColored); } } Manager.AddAlarm(GetCommuteScenario(selfCommute)); return(selfCommute); }
protected bool ChooseBoss(Career job, bool increasePressure) { if (IsValidBoss(job, job.Boss)) { return(false); } if (IsValidBoss(job, job.FormerBoss)) { job.SetBoss(job.FormerBoss); return(false); } else if (job.CareerLoc != null) { Dictionary <SimDescription, bool> candidateBosses = new Dictionary <SimDescription, bool>(); foreach (SimDescription boss in job.CareerLoc.Workers) { if (IsValidBoss(job, boss)) { if (!candidateBosses.ContainsKey(boss)) { candidateBosses.Add(boss, true); } } } if (candidateBosses.Count == 0) { foreach (SimDescription owner in Money.GetDeedOwner(job.CareerLoc.Owner)) { if (IsValidBoss(job, owner)) { if (!candidateBosses.ContainsKey(owner)) { candidateBosses.Add(owner, true); } } } } if (candidateBosses.Count == 0) { foreach (CareerLocation location in job.Locations) { if (location != job.CareerLoc) { location.CheckWorkers(); foreach (SimDescription boss in location.Workers) { if (IsValidBoss(job, boss)) { if (!candidateBosses.ContainsKey(boss)) { candidateBosses.Add(boss, true); } } } } } } if (candidateBosses.Count > 0) { List <SimDescription> randomList = new List <SimDescription>(candidateBosses.Keys); SetBoss(job, RandomUtil.GetRandomObjectFromList(randomList)); if (job.Coworkers != null) { job.Coworkers.Remove(job.Boss); } Careers.VerifyTone(job.OwnerDescription); return(true); } else { if ((increasePressure) && (NeedsBoss(job, true))) { IncStat("Pressure: Boss Needed"); Lots.IncreaseImmigrationPressure(Careers, ImmigrationPressure); } return(false); } } else { return(false); } }