public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { GreyedOutTooltipCallback callback = null; if (!(a.Occupation is OmniCareer)) { return(false); } ProSports job = OmniCareer.Career <ProSports>(a.Occupation); RabbitHole hole = target; if (job != null) { CareerLocation location; if (!hole.CareerLocations.TryGetValue((ulong)job.Guid, out location) || (job.CareerLoc != location)) { return(false); } bool flag = job.IsAllowedToWorkThisTime(ProSports.kGameStartTime, ProSports.kGameLength); if (!job.SpecialWorkDay || !job.HasWinLossRecordMetric()) { return(false); } if (flag && !job.IsDayOff) { return(true); } if (callback == null) { callback = delegate { int num = ProSports.DaysUntilNextGame(); if (num == 0) { return(PlayGame.LocalizeString(a.SimDescription, "GameGreyedTooltip", new object[] { SimClockUtils.GetText(ProSports.kGameStartTime) })); } return(PlayGame.LocalizeString(a.SimDescription, "GameGreyedTooltipFuture", new object[] { SimClockUtils.GetText(ProSports.kGameStartTime), num })); }; } greyedOutTooltipCallback = callback; } return(false); }
public static Sim FamilyMemberOfSportsPlayer(Sim a, bool mustBeOmniCareer) { foreach (Sim sim in a.Household.Sims) { if (!(sim.Occupation is OmniCareer)) { if (mustBeOmniCareer) { continue; } } ProSports job = OmniCareer.Career <ProSports>(sim.Occupation); if ((job != null) && (job.HasWinLossRecordMetric())) { return(sim); } } return(null); }
public override bool Test(Sim a, Stadium target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (!(a.Occupation is OmniCareer)) { if (FamilyMemberOfSportsPlayer(a, true) == null) { return(false); } } GreyedOutTooltipCallback callback = null; if ((!isAutonomous || !a.IsSelectable) || (AutonomyRestrictions.GetLevel() >= AutonomyLevel.Max)) { ProSports job = OmniCareer.Career <ProSports>(a.Occupation); if (((job != null) && job.HasWinLossRecordMetric()) && !job.IsDayOff) { return(false); } bool hasMoney = FamilyMemberOfSportsPlayer(a, false) != null; if (!hasMoney) { hasMoney = a.FamilyFunds >= Stadium.AttendGame.kCostToAttendGame; } if (target.mGameForced) { return(true); } Journalism journalism = OmniCareer.Career <Journalism>(a.Occupation); if ((ProSports.IsTodayGameDay() && SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, ProSports.GameStartTime - Stadium.AttendGame.kDoorsOpenTime, ProSports.GameStartTime + Stadium.AttendGame.kDoorsCloseTime)) && (hasMoney && ((journalism == null) || !journalism.BadReviewWrittenOnRabbitHole(target)))) { return(true); } if (callback == null) { callback = delegate { if ((journalism != null) && journalism.BadReviewWrittenOnRabbitHole(target)) { return(LocalizeString(a.SimDescription, "NotWelcomeFromBadReview", new object[0x0])); } if (!ProSports.IsTodayGameDay() || !SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, ProSports.GameStartTime, ProSports.GameEndTime)) { int num = ProSports.DaysUntilNextGame(); if (num == 0x0) { return(LocalizeString(a.SimDescription, "DoorsOpenTodayTooltip", new object[] { SimClockUtils.GetText(ProSports.GameStartTime) })); } return(LocalizeString(a.SimDescription, "DoorsOpenLaterTooltip", new object[] { num, SimClockUtils.GetText(ProSports.GameStartTime) })); } if (!hasMoney) { return(LocalizeString(a.SimDescription, "NeedMoneyTooltip", new object[0x0])); } return(LocalizeString(a.SimDescription, "DoorsClosedTooltip", new object[0x0])); }; } greyedOutTooltipCallback = callback; } return(false); }