示例#1
0
        public static void OnMinuteChanged()
        {
            try
            {
                string timeString = SimClockUtils.GetTextDayOfWeekAbrev() + " " + SimClockUtils.GetDisplayText();

                sThs.mClockDisplay.Caption     = timeString;// sThs.mHudModel.TimeString;
                sThs.mClockDisplay.TooltipText = TimeTooltipString();
            }
            catch (Exception e)
            {
                Common.Exception("OnMinuteChanged", e);
            }
        }
示例#2
0
        public bool RelieveSelf(BuffInstance element)
        {
            if (element != null)
            {
                element.mTimeoutPaused = false;
            }
            bool   flag   = false;
            Motive motive = Actor.Motives.GetMotive(CommodityKind.Bladder);

            if (motive != null && (element != null || Actor.BuffManager.HasAnyElement(new BuffNames[] { BuffNames.HasToPee, BuffNames.ReallyHasToPee })))
            {
                motive.PotionBladderDecayOverride = false;
                Actor.Motives.SetValue(CommodityKind.Bladder, motive.GetIdealMotiveValue());
                Target.ToiletVolume++;
                flag = true;
            }
            if (!isSitting || flag)
            {
                SimClockUtils.SleepForNSimMinutes(Toilet.kMaxLengthUseToilet);
            }
            return(flag);
        }
示例#3
0
        protected static string GetText(Occupation occupation)
        {
            Career career = occupation as Career;

            if (career != null)
            {
                if (occupation.OwnerDescription.CreatedSim != null)
                {
                    return(career.GeneratePromotionText(0));
                }
                else
                {
                    // This is a copy of the GeneratePromotionText() sans the use of CreatedSim
                    string entryKey  = "Gameplay/Careers/Career:PromotedTextNoBonus";
                    string str2      = Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, entryKey, new object[] { occupation.OwnerDescription, career.CurLevel.GetLocalizedName(occupation.OwnerDescription), 0 }) + Common.NewLine + Common.NewLine + Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, career.CurLevel.Text_Promotion, new object[] { occupation.OwnerDescription, career.CurLevel.GetLocalizedName(occupation.OwnerDescription) });
                    string startTime = SimClockUtils.GetText(career.CurLevel.StartTime);
                    string str4      = SimClockUtils.GetText(career.CurLevel.StartTime + career.CurLevel.DayLength);
                    if (!occupation.ShowRockStarUI)
                    {
                        return(str2 + Common.NewLine + Common.NewLine + Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, "Gameplay/Careers/Career:PromotedWageUpdate", new object[] { occupation.OwnerDescription, career.PayPerHourOrStipend, startTime, str4 }));
                    }
                    else
                    {
                        return(str2 + Common.NewLine + Common.NewLine + Common.LocalizeEAString(occupation.OwnerDescription.IsFemale, "Gameplay/Careers/Career:RockStarPromotedUpdate", new object[] { occupation.OwnerDescription }));
                    }
                }
            }
            else
            {
                XpBasedCareer xpCareer = occupation as XpBasedCareer;
                if (xpCareer != null)
                {
                    return(GenerateXPBasedLevelUp(xpCareer));
                }
            }

            return(null);
        }
示例#4
0
        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);
        }
示例#5
0
            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);
            }
示例#6
0
            public override bool Test(Sim a, ShowVenue target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                bool success = false;

                SkillBasedCareer career = SkillBasedCareerBooter.GetSkillBasedCareer(a, SkillNames.Guitar);

                if (career != null)
                {
                    success = true;

                    if (career.CareerLevel < NRaas.Careers.Settings.mBuskerLevelToGetPaidForConcerts)
                    {
                        greyedOutTooltipCallback = delegate
                        {
                            return(Common.Localize("Busker:ConcertLevelTooLow", a.IsFemale, new object[] { Music.LevelToGetPaidForConcerts - 3 }));
                        };
                        return(false);
                    }
                }
                else
                {
                    success = OmniCareer.HasMetric <MetricConcertsPerformed>(a.Occupation);
                }

                if (success)
                {
                    if (!target.PerformConcertAllowed(ref greyedOutTooltipCallback))
                    {
                        return(false);
                    }
                    if ((SimClock.Hours24 >= ShowVenue.kPerformConcertAvailableStartingAtHour) && (SimClock.Hours24 < ShowVenue.kPerformConcertAvailableEndingAtHour))
                    {
                        return(true);
                    }

                    greyedOutTooltipCallback = delegate
                    {
                        return(PerformConcert.LocalizeString(a.SimDescription, "CannotPerformConcert", new object[] { SimClockUtils.GetText(ShowVenue.kPerformConcertAvailableStartingAtHour), SimClockUtils.GetText(ShowVenue.kPerformConcertAvailableEndingAtHour) }));
                    };
                }
                return(false);
            }
示例#7
0
        public static void OnAlarm()
        {
            if (sFirstAlarm)
            {
                sFirstAlarm = false;
                StyledNotification.Show(new StyledNotification.Format("Work Pusher Activated", ObjectGuid.InvalidObjectGuid, ObjectGuid.InvalidObjectGuid, StyledNotification.NotificationStyle.kSystemMessage));
            }

            int iJobSync = 0, iSchoolSync = 0;
            int iJobTwoHourPush = 0, iSchoolTwoHourPush = 0;

            string sJobNames = null, sSchoolNames = null;

            DateAndTime NowTime     = SimClock.CurrentTime();
            DateAndTime TwoHourTime = SimClock.CurrentTime();

            TwoHourTime.Ticks += SimClock.ConvertToTicks(2f, TimeUnit.Hours);

            List <Sim> sims = new List <Sim>(Sims3.Gameplay.Queries.GetObjects <Sim>());

            foreach (Sim sim in sims)
            {
                if (sim.CareerManager == null)
                {
                    continue;
                }

                if (sim.Household == null)
                {
                    continue;
                }

                if (sim.Household.IsServiceNpcHousehold)
                {
                    continue;
                }

                {
                    Career job = sim.Job;
                    if (job != null)
                    {
                        float fPrevValue = job.HoursUntilWork;

                        job.SetHoursUntilWork();

                        if (fPrevValue > job.HoursUntilWork + 1f)
                        {
                            iJobSync++;
                        }

                        if (job.ShouldBeAtWork(NowTime))
                        {
                            sCarPoolers.Remove(sim);

                            InteractionInstance instance = job.CreateWorkInteractionInstance();
                            if (instance != null)
                            {
                                if ((((AutonomyRestrictions.GetLevel() >= AutonomyLevel.Two) && kPushActive) || sim.IsNPC) &&
                                    (!sim.InteractionQueue.HasInteractionOfType(instance.InteractionDefinition)))
                                {
                                    VisitSituation.AnnounceTimeToGoToWork(sim);

                                    sim.InteractionQueue.CancelAllInteractions();

                                    sim.InteractionQueue.Add(instance);

                                    sJobNames += "\n" + sim.Name;
                                }
                            }
                        }
                        else
                        {
                            if ((!sCarPoolers.ContainsKey(sim)) &&
                                (job.CurLevel != null) &&
                                (job.ShouldBeAtWork(TwoHourTime)))
                            {
                                // Check to see if the timer is already running, and if so, don't bother
                                if ((job.mRegularWorkDayGoToWorkHandle == AlarmHandle.kInvalidHandle) ||
                                    (AlarmManager.Global.GetTimeLeft(job.mRegularWorkDayGoToWorkHandle, TimeUnit.Minutes) <= 0))
                                {
                                    iJobTwoHourPush++;

                                    if (job.mRegularWorkDayTwoHoursBeforeStartHandle != AlarmHandle.kInvalidHandle)
                                    {
                                        AlarmManager.Global.RemoveAlarm(job.mRegularWorkDayTwoHoursBeforeStartHandle);
                                        job.mRegularWorkDayTwoHoursBeforeStartHandle = AlarmHandle.kInvalidHandle;
                                    }

                                    if ((!sim.IsSelectable || !job.CarpoolEnabled) || !job.CurLevel.HasCarpool)
                                    {
                                        InteractionInstance instance = job.CreateWorkInteractionInstance();
                                        if ((instance != null) &&
                                            (!sim.InteractionQueue.HasInteractionOfType(instance.InteractionDefinition)))
                                        {
                                            sim.InteractionQueue.CancelAllInteractions();
                                        }

                                        float num  = ((job.CurLevel.StartTime - NowTime.Hour) + 24f) % 24f;
                                        float time = num - job.AverageTimeToReachWork;
                                        if (time < 0f)
                                        {
                                            time = 0f;
                                        }
                                        job.mRegularWorkDayGoToWorkHandle = AlarmManager.Global.AddAlarm(time, TimeUnit.Hours, new AlarmTimerCallback(job.RegularWorkDayGoToWorkHandle), "Career: time to push go to work", AlarmType.AlwaysPersisted, job.OwnerDescription);
                                    }
                                    else
                                    {
                                        sCarPoolers.Add(sim, true);

                                        StyledNotification.Format format = new StyledNotification.Format(Localization.LocalizeString("Gameplay/Objects/Vehicles/CarpoolManager:CarpoolComing", new object[] { sim }), ObjectGuid.InvalidObjectGuid, sim.ObjectId, StyledNotification.NotificationStyle.kGameMessagePositive);
                                        StyledNotification.Show(format, job.CareerIconColored);
                                    }
                                }
                            }
                        }
                    }
                }

                {
                    School school = sim.CareerManager.School;
                    if (school != null)
                    {
                        float fPrevValue = school.HoursUntilWork;

                        school.SetHoursUntilWork();

                        if (fPrevValue > school.HoursUntilWork + 1f)
                        {
                            iSchoolSync++;
                        }

                        if (school.ShouldBeAtWork(NowTime))
                        {
                            sBusPoolers.Remove(sim);

                            InteractionInstance instance = school.CreateWorkInteractionInstance();
                            if (instance != null)
                            {
                                if ((((AutonomyRestrictions.GetLevel() >= AutonomyLevel.Two) && kPushActive) || sim.IsNPC) &&
                                    (!sim.InteractionQueue.HasInteractionOfType(instance.InteractionDefinition)))
                                {
                                    VisitSituation.AnnounceTimeToGoToWork(sim);

                                    sim.InteractionQueue.CancelAllInteractions();

                                    sim.InteractionQueue.Add(instance);

                                    sSchoolNames += "\n" + sim.Name;
                                }
                            }
                        }
                        else
                        {
                            if ((!sBusPoolers.ContainsKey(sim)) &&
                                (school.ShouldBeAtWork(TwoHourTime)))
                            {
                                // Check to see if the timer is already running, and if so, don't bother
                                if ((school.mRegularWorkDayGoToWorkHandle == AlarmHandle.kInvalidHandle) ||
                                    (AlarmManager.Global.GetTimeLeft(school.mRegularWorkDayGoToWorkHandle, TimeUnit.Minutes) <= 0))
                                {
                                    iSchoolTwoHourPush++;

                                    if (school.mRegularWorkDayTwoHoursBeforeStartHandle != AlarmHandle.kInvalidHandle)
                                    {
                                        AlarmManager.Global.RemoveAlarm(school.mRegularWorkDayTwoHoursBeforeStartHandle);
                                        school.mRegularWorkDayTwoHoursBeforeStartHandle = AlarmHandle.kInvalidHandle;
                                    }

                                    if (school.PickUpCarpool != null)
                                    {
                                        sBusPoolers.Add(sim, true);

                                        school.PickUpCarpool.TryShowTNS(sim, Localization.LocalizeString("Gameplay/Objects/Vehicles/CarpoolManager:SchoolBusComing", new object[] { sim }), Localization.LocalizeString("Ui/Tooltip/Hud/School:SchoolBusArrives", new object[] { SimClockUtils.GetText((int)(school.CurLevel.StartTime - 1f), 0) }));
                                    }
                                    else
                                    {
                                        InteractionInstance instance = school.CreateWorkInteractionInstance();
                                        if ((instance != null) &&
                                            (!sim.InteractionQueue.HasInteractionOfType(instance.InteractionDefinition)))
                                        {
                                            sim.InteractionQueue.CancelAllInteractions();
                                        }

                                        float num  = ((school.CurLevel.StartTime - NowTime.Hour) + 24f) % 24f;
                                        float time = num - school.AverageTimeToReachWork;
                                        if (time < 0f)
                                        {
                                            time = 0f;
                                        }
                                        school.mRegularWorkDayGoToWorkHandle = AlarmManager.Global.AddAlarm(time, TimeUnit.Hours, new AlarmTimerCallback(school.RegularWorkDayGoToWorkHandle), "Career: time to push go to work", AlarmType.AlwaysPersisted, school.OwnerDescription);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            bool bShow = false;

            string msg = "Work Pusher:";

            if (iJobSync > 0)
            {
                msg  += "\nWork Alarms Resync'd: " + iJobSync.ToString();
                bShow = true;
            }
            if (iJobTwoHourPush > 0)
            {
                msg  += "\nWork Two Hour Alarms: " + iJobTwoHourPush.ToString();
                bShow = true;
            }
            if (sJobNames != null)
            {
                msg  += "\nPushed to Work: " + sJobNames;
                bShow = true;
            }
            if (iSchoolSync > 0)
            {
                msg  += "\nSchool Alarms Resync'd: " + iSchoolSync.ToString();
                bShow = true;
            }
            if (iSchoolTwoHourPush > 0)
            {
                msg  += "\nSchool Two Hour Alarms: " + iSchoolTwoHourPush.ToString();
                bShow = true;
            }
            if (sSchoolNames != null)
            {
                msg  += "\nPushed to School: " + sSchoolNames;// iSchoolCount.ToString();
                bShow = true;
            }

            if ((bShow) && (sVerbose))
            {
                StyledNotification.Show(new StyledNotification.Format(msg, ObjectGuid.InvalidObjectGuid, ObjectGuid.InvalidObjectGuid, StyledNotification.NotificationStyle.kSystemMessage));
            }
        }
示例#8
0
文件: PlayGame.cs 项目: yakoder/NRaas
            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);
            }
示例#9
0
        protected override ManagerStory.Story PrintFormattedStory(StoryProgressionObject manager, string text, string summaryKey, object[] parameters, string[] extended, ManagerStory.StoryLogging logging)
        {
            Writing skill = Sim.SkillManager.GetSkill <Writing>(SkillNames.Writing);

            WrittenBookData writing = skill.LastCompletedWriting;

            List <BookGeneralData> randomList           = new List <BookGeneralData>(BookData.BookGeneralDataList.Values);
            BookGeneralData        randomObjectFromList = RandomUtil.GetRandomObjectFromList(randomList);

            int genre   = RandomUtil.GetInt(1, Writing.kDialogsPerGenre);
            int quality = RandomUtil.GetInt(1, Writing.kDialogsPerQuality);

            text = Writing.LocalizeString(Sim.IsFemale, "Finished" + writing.Genre.ToString() + genre, new object[] { Sim, writing.NumPages, writing.Title, randomObjectFromList.Title });
            if (writing.Quality != Writing.WrittenBookQuality.Normal)
            {
                string str2 = Writing.LocalizeString(Sim.IsFemale, "Finished" + writing.Quality.ToString() + quality, new object[] { Sim, writing.NumPages, writing.Title });
                text = text + " " + str2;
            }

            string str3 = Writing.LocalizeString(Sim.IsFemale, "RoyaltyDetails", new object[] { Sim, Writing.kRoyaltyLength, writing.Royalty, SimClockUtils.GetText(Writing.kRoyaltyPayHour) });

            text = text + Common.NewLine + Common.NewLine + str3;

            if (extended == null)
            {
                extended = new string[] { writing.Title, EAText.GetNumberString(writing.Royalty) };
            }

            return(base.PrintFormattedStory(manager, text, summaryKey, parameters, extended, logging));
        }
示例#10
0
 public override bool Test(Sim a, CityHall target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
 {
     if (!GameUtils.IsInstalled(ProductVersion.EP11))
     {
         return(false);
     }
     if (a.FamilyFunds < CityHall.ScheduleFireworkShow.kCostOfFireworkShow)
     {
         greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(LocalizationHelper.InsufficientFunds);
         return(false);
     }
     if (target.mFireworkShowScheduled)
     {
         greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/RabbitHoles/FutureCityHall/ScheduleFireworkShow:AlreadyScheduled", new object[] { target.mFireworkSchedulerName, SimClockUtils.GetText(target.mFireworkScheduledTime) }));
         return(false);
     }
     return(true);
 }
示例#11
0
            public override void AddInteractions(InteractionObjectPair iop, Sim actor, CityHall target, List <InteractionObjectPair> results)
            {
                string parent = Localization.LocalizeString(actor.IsFemale, "Gameplay/Objects/RabbitHoles/FutureCityHall/ScheduleFireworkShow:InteractionName", new object[] { CityHall.ScheduleFireworkShow.kCostOfFireworkShow }) + Localization.Ellipsis;
                float  hour   = SimClock.CurrentTime().Hour;

                for (int i = 0; i < CityHall.ScheduleFireworkShow.kTimeOptionsForFireworkShow.Length; i++)
                {
                    if ((CityHall.ScheduleFireworkShow.kTimeOptionsForFireworkShow[i] - 1f) > hour)
                    {
                        results.Add(new InteractionObjectPair(new ScheduleFireworkDefinition(parent, Localization.LocalizeString(actor.IsFemale, "Gameplay/Objects/RabbitHoles/FutureCityHall/ScheduleFireworkShow:Time", new object[] { SimClockUtils.GetText(CityHall.ScheduleFireworkShow.kTimeOptionsForFireworkShow[i]) }), CityHall.ScheduleFireworkShow.kTimeOptionsForFireworkShow[i]), iop.Target));
                    }
                }
            }