public override float FindMetricValue(Career career) { LawEnforcement enforcement = OmniCareer.Career <LawEnforcement> (career); SimDescription partner = null; if (enforcement != null) { partner = enforcement.Partner; } if (partner == null) { if (career.Coworkers.Count > 0) { partner = career.Coworkers[0]; } } if (partner == null) { return(0f); } Relationship relationship = enforcement.OwnerDescription.GetRelationship(partner, false); if (relationship == null) { return(0f); } return(relationship.GetCareerRating()); }
protected override bool PrivateUpdate(ScenarioFrame frame) { Computer computer = ManagerLot.GetUsableComputer(Sim); if (computer == null) { IncStat("No Computer"); return(false); } Career occupation = Sim.Occupation as Career; if (!occupation.CanWriteReport()) { if (Sim.Occupation is LawEnforcement) { LawEnforcement career = Sim.Occupation as LawEnforcement; if (!career.CanInterview()) { IncStat("Police Level Fail"); return(false); } foreach (SimDescription sim in Sims.Adults) { if (career.HasSimBeenInterviewed(sim)) { continue; } career.SimInterviewed(sim); break; } } else if (Sim.Occupation is Journalism) { Journalism career = Sim.Occupation as Journalism; if (!career.CanInterview()) { IncStat("Journalism Level Fail"); return(false); } foreach (SimDescription sim in Sims.Adults) { if (career.HasSimBeenInterviewed(sim)) { continue; } career.SimInterviewed(sim); break; } } } return(Situations.PushInteraction <Computer>(this, Sim, computer, Computer.WriteReport.Singleton)); }
protected new void LawEnforcementRummage(Sim rummager, IOutdoorAcceptsGarbage can) { LawEnforcement job = OmniCareer.Career <LawEnforcement>(rummager.Occupation); Common.DebugNotify("RummageEx:LawEnforcementRummage"); List <SimDescription> choices = new List <SimDescription>(); foreach (SimDescription sim in Households.Humans(can.LotCurrent.Household)) { if (sim.YoungAdultOrAbove && !job.SimsInterviewed.Contains(sim)) { choices.Add(sim); } } if (choices.Count != 0x0) { SimDescription choice = RandomUtil.GetRandomObjectFromList(choices); Common.DebugNotify("LawEnforcementRummage: " + choice.FullName); job.SimsInterviewed.Add(choice); rummager.ShowTNSIfSelectable(Common.LocalizeEAString(rummager.IsFemale, "Gameplay/Objects/Miscellaneous/TrashcanOutside:RummageForInfo" + RandomUtil.GetInt(0x1, 0x3), new object[] { rummager, choice }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, rummager.ObjectId); } }
// Methods public override string GetInteractionName(Sim actor, Computer target, InteractionObjectPair iop) { LawEnforcement job = OmniCareer.Career <LawEnforcement>(actor.Occupation); if ((job != null) && (!job.IsCurrentlyRunningforensicAnalysis)) { return(RunForensicAnalysis.LocalizeString(actor.SimDescription, "InteractionName", new object[0x0])); } return(RunForensicAnalysis.LocalizeString(actor.SimDescription, "ContinueAnalysis", new object[0x0])); }
// Methods public bool HasPartner(Career career, out SimDescription partner) { partner = null; LawEnforcement enforcement = OmniCareer.Career <LawEnforcement> (career); if (enforcement != null) { partner = enforcement.Partner; } return(partner != null); }
protected bool HandlePartner(LawEnforcement lawCareer, SimDescription coworker, bool force) { if (coworker == null) { return(false); } SimDescription sim = lawCareer.OwnerDescription; LawEnforcement coworkerCareer = coworker.Occupation as LawEnforcement; if (coworkerCareer == null) { IncStat("Law: Not Police"); return(false); } else if (!IsValidPartner(lawCareer, coworker, force)) { IncStat("Law: Not Valid 1"); return(false); } else if (!IsValidPartner(coworkerCareer, sim, force)) { IncStat("Law: Not Valid 2"); return(false); } else { lawCareer.Partner = coworker; if (lawCareer.Boss == coworker) { lawCareer.SetBoss(null); lawCareer.AddCoworker(coworker); IncStat("Law: Boss Used"); } coworkerCareer.Partner = sim; if (coworkerCareer.Boss == sim) { coworkerCareer.SetBoss(null); coworkerCareer.AddCoworker(sim); IncStat("Law: Boss Used"); } mNewCoworkers.Add(coworker); IncStat("Law: Success"); return(true); } }
// Methods public override void ConfigureInteraction() { LawEnforcement job = OmniCareer.Career <LawEnforcement>(base.Actor.Occupation); if (job == null) { return; } TimedStage stage = new TimedStage(this.GetInteractionName(), Computer.RunForensicAnalysis.kInteractionStageLength - job.MinutesSpentDoingForensicAnalysis, false, true, true); base.Stages = new List <Stage>(new Stage[] { stage }); }
public override bool Run() { try { StandardEntry(); if (!Target.StartComputing(this, SurfaceHeight.Table, true)) { StandardExit(); return(false); } DateAndTime firstDate = SimClock.CurrentTime(); Target.StartVideo(Computer.VideoType.WordProcessor); StartStages(); BeginCommodityUpdates(); bool succeeded = false; try { AnimateSim("WorkTyping"); succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); } finally { EndCommodityUpdates(succeeded); } LawEnforcement job = OmniCareer.Career <LawEnforcement>(Actor.Occupation); float minutes = SimClock.ElapsedTime(TimeUnit.Minutes, firstDate, SimClock.CurrentTime()); job.UpdateTimeSpentOnForensicAnalysis(minutes); Target.StopComputing(this, Computer.StopComputingAction.TurnOff, false); if (job.IsForensicAnalysisComplete(Computer.RunForensicAnalysis.kTotalTimeToFinishAnalysis)) { job.ResetForensicAnalysisStatistics(); Actor.ModifyFunds(Computer.RunForensicAnalysis.kRewardOnFinishingAnalysis); Actor.ShowTNSIfSelectable(LocalizeString(Actor.SimDescription, "AnalysisComplete", new object[] { Actor, Computer.RunForensicAnalysis.kRewardOnFinishingAnalysis }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, Actor.ObjectId); } StandardExit(); return(true); } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
public override float FindMetricValue(Career career) { LawEnforcement enforcement = OmniCareer.Career <LawEnforcement>(career); int num = 0x0; if (enforcement != null) { for (int i = 0x0; i < LawEnforcement.kWindowForRememberingReports; i++) { num += enforcement.mReportsWrittenPastNDays[i]; } num += enforcement.ReportsCompltetedToday; } return((float)num); }
public override bool Test(Sim a, Computer target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (!target.IsComputerUsable(a, true, false, isAutonomous)) { return(false); } if (!(a.Occupation is OmniCareer)) { return(false); } LawEnforcement job = OmniCareer.Career <LawEnforcement>(a.Occupation); return((job != null) && (job.CurLevel.PromotionRewardData == "UnlockComputerInteraction")); }
protected bool IsValidPartner(LawEnforcement lawCareer, SimDescription sim, bool force) { if (lawCareer == null) { return(false); } if (sim == null) { return(false); } if (!IsValid(lawCareer, sim, false)) { IncStat("Not Valid Partner"); return(false); } LawEnforcement simJob = sim.Occupation as LawEnforcement; if (simJob == null) { return(false); } if ((simJob.Partner != null) && (simJob.Partner != lawCareer.OwnerDescription)) { if (!force) { IncStat("Already Partnered"); return(false); } else if (SimTypes.IsSelectable(simJob.Partner)) { IncStat("Partner Active"); return(false); } } return(true); }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, Computer target, List <InteractionObjectPair> results) { Journalism journalism = OmniCareer.Career <Journalism>(actor.Occupation); LawEnforcement enforcement = OmniCareer.Career <LawEnforcement>(actor.Occupation); if (journalism != null) { if (journalism.StorySubject != null) { results.Add(new InteractionObjectPair(new Definition(Computer.LocalizeString("ContinueStory", new object[] { journalism.StorySubject }), Computer.LocalizeString("Writing", new object[0x0]), true, true, false), iop.Target)); results.Add(new InteractionObjectPair(new Definition(Computer.LocalizeString("ScrapStory", new object[] { journalism.StorySubject }), Computer.LocalizeString("Writing", new object[0x0]), true, false, true), iop.Target)); } else { if (journalism.ValidNegativeReportSubjects().Count > 0x0) { results.Add(new InteractionObjectPair(new Definition(Computer.LocalizeString("NegativeNewsStory", new object[0x0]), Computer.LocalizeString("Writing", new object[0x0]), true, false, false), iop.Target)); } if (journalism.ValidPositiveReportSubjects().Count > 0x0) { results.Add(new InteractionObjectPair(new Definition(Computer.LocalizeString("PositiveNewsStory", new object[0x0]), Computer.LocalizeString("Writing", new object[0x0]), false, false, false), iop.Target)); } } } if ((enforcement != null) && (enforcement.ValidPositiveReportSubjects().Count > 0x0)) { if (enforcement.ReportSubject != null) { results.Add(new InteractionObjectPair(new Definition(Computer.LocalizeString("ContinueReport", new object[] { enforcement.ReportSubject }), Computer.LocalizeString("Writing", new object[0x0]), true, true, false), iop.Target)); results.Add(new InteractionObjectPair(new Definition(Computer.LocalizeString("ScrapReport", new object[] { enforcement.ReportSubject }), Computer.LocalizeString("Writing", new object[0x0]), true, false, true), iop.Target)); } else { results.Add(new InteractionObjectPair(new Definition(Computer.LocalizeString("LawEnforcementReport", new object[0x0]), Computer.LocalizeString("Writing", new object[0x0]), false, false, false), iop.Target)); } } }
public new void LoopDel(StateMachineClient smc, Interaction <Sim, IOutdoorAcceptsGarbage> .LoopData loopData) { int mLifeTime = (int)loopData.mLifeTime; if (Autonomous) { if (mLifeTime >= (TrashcanOutside.kRevealItemEveryXMinutes * TrashcanOutside.kRummageMaxItems)) { Actor.AddExitReason(ExitReason.Finished); } } else if ((mLifeTime % base.Target.RevealItemEveryXMinutes) == 0) { Target.GiveObject(mNetWorth, Actor); mNumItemsFound++; if (mNumItemsFound >= TrashcanOutside.kRummageMaxItems) { Actor.AddExitReason(ExitReason.Finished); if ((Target.LotCurrent != Actor.LotHome) && (Target.LotCurrent.Household != null)) { Journalism journalism = OmniCareer.Career <Journalism>(Actor.Occupation); LawEnforcement law = OmniCareer.Career <LawEnforcement>(Actor.Occupation); Common.DebugNotify("RummageEx:LoopDel"); if ((journalism != null) && Actor.Occupation.CanInterview()) { JournalismRummage(Actor, Target); } else if ((law != null) && Actor.Occupation.CanInterview()) { LawEnforcementRummage(Actor, Target); } } } } }
// Methods public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (!(a.Occupation is OmniCareer)) { return(false); } GreyedOutTooltipCallback callback = null; LawEnforcement job = OmniCareer.Career <LawEnforcement>(a.Occupation); if ((job != null) && job.CanRaidCriminalWarehouses) { Hideout hideout = target as Hideout; if (hideout != null) { DateAndTime time; if (!hideout.mSimToLastRaidTimestamp.TryGetValue(a, out time)) { return(true); } if (SimClock.ElapsedTime(TimeUnit.Hours, time, SimClock.CurrentTime()) >= Hideout.kMinimumDurationBetweenCriminalRaids) { return(true); } if (callback == null) { callback = delegate { return(Hideout.RaidCriminals.LocalizeString("CannotUseHideout", new object[] { a })); }; } greyedOutTooltipCallback = callback; return(false); } } return(false); }
public override bool ShouldAddTone(Career career) { try { if (!GameUtils.IsInstalled(mVersion)) { return(false); } if (!base.ShouldAddTone(career)) { return(false); } if (!string.IsNullOrEmpty(mBranch)) { if (career.CurLevelBranchName != mBranch) { return(false); } } if (mMinLevel > career.CareerLevel) { return(false); } if (mMaxLevel < career.CareerLevel) { return(false); } if (career.OwnerDescription == null) { return(false); } if (career.OwnerDescription.SkillManager == null) { return(false); } if (mMetrics.Count > 0) { foreach (MetricRate rate in mMetrics) { switch (rate.mMetric) { case MetricRate.MetricType.Reports: LawEnforcement law = OmniCareer.Career <LawEnforcement>(career); if (law != null) { if (!OmniCareer.HasMetric <LawEnforcement.MetricReportsWritten>(career)) { return(false); } } break; case MetricRate.MetricType.StoriesAndReviews: Journalism journalism = OmniCareer.Career <Journalism>(career); if (journalism != null) { if (!OmniCareer.HasMetric <Journalism.MetricStoriesAndReviews>(career)) { return(false); } } break; } } } if (mSkills.Count > 0) { bool needed = false; foreach (SkillRate skill in mSkills) { if (mMustHaveVisibleSkill) { if (!career.OwnerDescription.SkillManager.IsPlayerVisible(skill.mSkill)) { return(false); } } if (skill.mSkill == SkillNames.Athletic) { if ((career.OwnerDescription.CreatedSim != null) && (career.OwnerDescription.CreatedSim.BuffManager != null) && (career.OwnerDescription.CreatedSim.BuffManager.HasElement(BuffNames.Fatigued))) { return(false); } } if (mOnlyMetric) { bool found = false; foreach (PerfMetric metric in career.CurLevel.Metrics) { MetricSkillX skillMetric = metric as MetricSkillX; if (skillMetric == null) { continue; } if (skillMetric.SkillGuid == skill.mSkill) { found = true; break; } } if (!found) { return(false); } } Skill simSkill = career.OwnerDescription.SkillManager.GetSkill <Skill>(skill.mSkill); if ((simSkill == null) || (simSkill.SkillLevel < simSkill.MaxSkillLevel)) { needed = true; } } if ((!needed) && (mOnlySkill)) { return(false); } } return(true); } catch (Exception exception) { Common.Exception(career.OwnerDescription, exception); } return(false); }
public override void OnTimePassed(InteractionInstance interactionInstance, float totalTime, float deltaTime) { try { foreach (MetricRate rate in mMetrics) { float hoursElapsed = SimClock.ElapsedTime(TimeUnit.Hours) - rate.mStartTime; if (hoursElapsed < rate.mHoursUntilChange) { continue; } rate.mStartTime = SimClock.ElapsedTime(TimeUnit.Hours); switch (rate.mMetric) { case MetricRate.MetricType.ConcertsPerformed: Music music = OmniCareer.Career <Music>(Career); if (music != null) { music.ConcertsPerformed += rate.mRate; } break; case MetricRate.MetricType.Journals: OmniCareer journals = Career as OmniCareer; if (journals != null) { journals.FinishedJournal(); } break; case MetricRate.MetricType.Recruitment: OmniCareer recruit = Career as OmniCareer; if (recruit != null) { recruit.AddToRecruits(); } break; case MetricRate.MetricType.Reports: LawEnforcement law = OmniCareer.Career <LawEnforcement>(Career); if (law != null) { law.ReportsCompltetedToday += rate.mRate; } break; case MetricRate.MetricType.StoriesAndReviews: Journalism journalism = OmniCareer.Career <Journalism>(Career); if (journalism != null) { journalism.StoriesWrittenToday += rate.mRate; } break; case MetricRate.MetricType.WinLossRecord: ProSports proSports = OmniCareer.Career <ProSports>(Career); if (proSports != null) { if (rate.mRate > 0) { proSports.mWinRecord += rate.mRate; proSports.mTotalWins += rate.mRate; } else { proSports.mLossRecord -= rate.mRate; proSports.mTotalLoss -= rate.mRate; } } break; case MetricRate.MetricType.MeetingsHeld: Business business = OmniCareer.Career <Business>(Career); if (business != null) { business.MeetingsHeldToday += rate.mRate; } break; } } } catch (Exception e) { Common.Exception(Career.OwnerDescription, e); } }
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); }