Exemple #1
0
        protected static void DoInteraction(Sim ths)
        {
            string msg = ths.FullName;

            if (AutonomyRestrictions.IsAnyAutonomyEnabled(ths))
            {
                msg += Common.NewLine + "IsAnyAutonomyEnabled";

                if (!ths.Autonomy.InAutonomyManagerQueue)
                {
                    msg += Common.NewLine + "Not InAutonomyManagerQueue";

                    if (ths.CanRunAutonomyImmediately())
                    {
                        msg += Common.NewLine + "CanRunAutonomyImmediately";

                        AutonomyManager.Add(ths.Autonomy);
                    }
                    else
                    {
                        float autonomyDelayDuringSocializing;
                        float timeSinceInteractionQueueBecameEmpty = ths.Autonomy.TimeSinceInteractionQueueBecameEmpty;
                        if ((ths.Conversation != null) && (ths.IsActiveSim || ((ths.Conversation.WhoTalkedLast != null) && ths.Conversation.WhoTalkedLast.IsActiveSim)))
                        {
                            msg += Common.NewLine + "Section A";

                            autonomyDelayDuringSocializing = Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayDuringSocializing;
                        }
                        else if (ths.mExitReason == ExitReason.UserCanceled)
                        {
                            msg += Common.NewLine + "Section B";

                            autonomyDelayDuringSocializing = Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayAfterUserCancellation;
                        }
                        else
                        {
                            msg += Common.NewLine + "Section C";

                            autonomyDelayDuringSocializing = Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayNormal;
                        }

                        msg += Common.NewLine + "timeSinceInteractionQueueBecameEmpty=" + timeSinceInteractionQueueBecameEmpty;
                        msg += Common.NewLine + "autonomyDelayDuringSocializing=" + autonomyDelayDuringSocializing;

                        if (((timeSinceInteractionQueueBecameEmpty < 0f) || (timeSinceInteractionQueueBecameEmpty >= autonomyDelayDuringSocializing)) || ((ths.Service != null) || ths.SimDescription.HasActiveRole))
                        {
                            AutonomyManager.Add(ths.Autonomy);
                        }
                    }
                }
            }

            Common.Notify(msg);
        }
Exemple #2
0
            public override bool Test(Sim a, ShowVenue target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (!(a.Occupation is OmniCareer))
                {
                    return(false);
                }

                if ((!isAutonomous || !a.IsSelectable) || (AutonomyRestrictions.GetLevel() >= AutonomyLevel.Max))
                {
                    if (a.IsInGroupingSituation())
                    {
                        return(false);
                    }

                    Journalism journalism = OmniCareer.Career <Journalism>(a.Occupation);

                    int num = CalculateShowPriceEx(a, target);
                    if (((target.ShowType != ShowVenue.ShowTypes.kNoShow) && target.DoorsOpen) && ((a.FamilyFunds >= num) && ((journalism == null) || !journalism.BadReviewWrittenOnRabbitHole(target))))
                    {
                        return(true);
                    }

                    greyedOutTooltipCallback = delegate
                    {
                        if ((journalism != null) && journalism.BadReviewWrittenOnRabbitHole(target))
                        {
                            return(LocalizeString("NotWelcomeFromBadReview", new object[0x0]));
                        }

                        if (target.ShowType != ShowVenue.ShowTypes.kNoShow)
                        {
                            if (target.DoorsOpen)
                            {
                                return(LocalizeString("InsufficientFunds", new object[0x0]));
                            }
                            if (target.ShowInProgress)
                            {
                                return(LocalizeString("DoorsClosed", new object[0x0]));
                            }
                        }
                        return(ShowVenue.AttendShow.LocalizeString(target.NoShowTooltip, new object[0]));
                    };
                }
                return(false);
            }
Exemple #3
0
        public static string GetStatus(SimDescription sim)
        {
            string str = sim.FullName;

            bool serviceOrRole = false;

            if (sim.AssignedRole != null)
            {
                serviceOrRole = true;
                ShoppingRegister register = sim.AssignedRole.RoleGivingObject as ShoppingRegister;
                if (register != null)
                {
                    str += ", " + register.RegisterRoleName(sim.IsFemale);
                }
                else
                {
                    string roleName;
                    if (Localization.GetLocalizedString(sim.AssignedRole.CareerTitleKey, out roleName))
                    {
                        str += ", " + roleName;
                    }
                }

                string hours = GetRoleHours(sim);
                if (!string.IsNullOrEmpty(hours))
                {
                    str += Common.NewLine + hours;
                }
            }
            else if (SimTypes.InServicePool(sim))
            {
                serviceOrRole = true;

                string serviceName;
                if (Localization.GetLocalizedString("Ui/Caption/Services/Service:" + sim.CreatedByService.ServiceType.ToString(), out serviceName))
                {
                    str += ", " + serviceName;
                }
            }

            if ((serviceOrRole) || (Tagger.Settings.mTagDataSettings[TagDataType.Orientation] && Tagger.Settings.mTagDataSettings[TagDataType.LifeStage] && (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || (Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage] && sim.AgingEnabled))))
            {
                str += Common.NewLine;
            }
            else
            {
                str += " - ";
            }

            if (sim.TeenOrAbove && !sim.IsPet && Tagger.Settings.mTagDataSettings[TagDataType.Orientation])
            {
                str += Common.Localize("SimType:" + TagDataHelper.GetOrientation(sim).ToString());
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.LifeStage])
            {
                if (Tagger.Settings.mTagDataSettings[TagDataType.Orientation])
                {
                    str += " ";
                }

                str += sim.AgeLocalizedText;
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage])
            {
                str += " (";
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays])
            {
                str += Common.Localize("TagData:Age", sim.IsFemale, new object[] { Math.Round(Aging.GetCurrentAgeInDays(sim as IMiniSimDescription)) });
            }

            if (sim.AgingEnabled)
            {
                if (Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage])
                {
                    str += ", " + Common.Localize("TagData:Birthday", sim.IsFemale, new object[] { (int)(AgingManager.Singleton.AgingYearsToSimDays(AgingManager.GetMaximumAgingStageLength(sim)) - AgingManager.Singleton.AgingYearsToSimDays(sim.AgingYearsSinceLastAgeTransition)) });
                }
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage])
            {
                str += ")";
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.Occult] && sim.OccultManager != null)
            {
                List <OccultTypes> types = OccultTypeHelper.CreateList(sim, false);

                if (types.Count > 0)
                {
                    str += Common.NewLine;

                    string occultString = "";
                    foreach (OccultTypes type in types)
                    {
                        occultString += ", " + OccultTypeHelper.GetLocalizedName(type);
                    }

                    str += Common.Localize("TagData:OccultTag", sim.IsFemale, new object[] { occultString.Remove(0, 2) });
                }
            }

            Sim createdSim = sim.CreatedSim;

            if (Tagger.Settings.Debugging)
            {
                if (createdSim != null)
                {
                    str += Common.NewLine + "Autonomy: ";
                    if (createdSim.Autonomy == null)
                    {
                        str += "None";
                    }
                    else
                    {
                        if (createdSim.Autonomy.AutonomyDisabled)
                        {
                            str += "Disabled";
                        }
                        else if (!AutonomyRestrictions.IsAnyAutonomyEnabled(createdSim))
                        {
                            str += "User Disabled";
                        }
                        else if (createdSim.Autonomy.IsRunningHighLODSimulation)
                        {
                            str += "High";
                        }
                        else
                        {
                            str += "Low";
                        }

                        if (createdSim.Autonomy.ShouldRunLocalAutonomy)
                        {
                            str += " Local";
                        }

                        if (createdSim.CanRunAutonomyImmediately())
                        {
                            str += " Ready";
                        }
                        else if (!createdSim.mLastInteractionWasAutonomous)
                        {
                            str += " Push";
                        }
                        else if (!createdSim.mLastInteractionSucceeded)
                        {
                            str += " Fail";
                        }

                        if (createdSim.Autonomy.InAutonomyManagerQueue)
                        {
                            str += " Queued";
                        }
                    }
                }
            }

            if (createdSim != null)
            {
                if (Tagger.Settings.mTagDataSettings[TagDataType.Mood])
                {
                    str += Common.NewLine;
                    int flavour = (int)createdSim.MoodManager.MoodFlavor;

                    str += Common.Localize("TagData:MoodTag", sim.IsFemale, new object[] { Common.LocalizeEAString(false, "Ui/Tooltip/HUD/SimDisplay:MoodFlavor" + flavour.ToString()) }) + " ";
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.MotiveInfo])
                {
                    if (!Tagger.Settings.mTagDataSettings[TagDataType.Mood])
                    {
                        str += Common.NewLine;
                    }

                    string motives = ", ";
                    int    num     = 0;
                    foreach (CommodityKind kind in (Sims3.UI.Responder.Instance.HudModel as HudModel).GetMotives(sim.CreatedSim))
                    {
                        if (sim.CreatedSim.Motives.HasMotive(kind))
                        {
                            if (num >= 6)
                            {
                                break;
                            }

                            motives += FetchMotiveLocalization(sim.Species, kind) + ": " + "(" + sim.CreatedSim.Motives.GetValue(kind).ToString("0.") + ") ";
                        }

                        num++;
                    }

                    str += Common.Localize("TagData:Motives", sim.IsFemale, new object[] { motives.Remove(0, 2) });
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.CurrentInteraction] && createdSim.CurrentInteraction != null)
                {
                    str += Common.NewLine;

                    try
                    {
                        str += createdSim.CurrentInteraction.ToString();
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(createdSim, e);

                        str += createdSim.CurrentInteraction.GetType();
                    }

                    Tone tone = createdSim.CurrentInteraction.CurrentTone;
                    if (tone != null)
                    {
                        str += Common.NewLine + tone.ToString();
                    }

                    SocialInteractionBase social = createdSim.CurrentInteraction as SocialInteractionBase;
                    if ((social != null) && (social.Target != null))
                    {
                        str += " " + Common.Localize("TagData:With", sim.IsFemale, new object[] { social.Target.Name });
                    }

                    if (createdSim.CurrentInteraction is Terrain.GoHereWith)
                    {
                        InviteToLotSituation situtation = InviteToLotSituation.FindInviteToLotSituationInvolving(createdSim);
                        if (situtation != null)
                        {
                            if (situtation.SimA != createdSim)
                            {
                                str += " " + situtation.SimA.Name;
                            }
                            else if (situtation.SimB != createdSim)
                            {
                                str += situtation.SimB.Name;
                            }
                        }
                    }
                }
            }

            if (!SimTypes.IsSpecial(sim))
            {
                str += Common.NewLine + Common.Localize("TagData:CashTag", sim.IsFemale, new object[] { sim.FamilyFunds });

                if ((Tagger.Settings.mTagDataSettings[TagDataType.Debt] || Tagger.Settings.mTagDataSettings[TagDataType.NetWorth]) && sGetDebtAndNetworth.Valid)
                {
                    int bit = 0;
                    if (Tagger.Settings.mTagDataSettings[TagDataType.Debt])
                    {
                        bit = bit + 1;
                    }
                    if (Tagger.Settings.mTagDataSettings[TagDataType.NetWorth])
                    {
                        bit = bit + 4;
                    }

                    str += sGetDebtAndNetworth.Invoke <string>(new object[] { sim, bit });
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.Job])
                {
                    if (sim.Occupation != null)
                    {
                        str += Common.NewLine;
                        if (sim.Occupation.OfficeLocation != null)
                        {
                            str += Common.Localize("TagData:JobAt", sim.IsFemale, new object[] { sim.Occupation.CurLevelJobTitle, sim.Occupation.OfficeLocation.GetLocalizedName() });
                        }
                        else
                        {
                            str += Common.Localize("TagData:JobTag", sim.IsFemale, new object[] { sim.Occupation.CurLevelJobTitle });
                        }
                    }
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.PartnerInfo])
                {
                    if (sim.Partner != null)
                    {
                        Relationship rel    = sim.GetRelationship(sim.Partner, false);
                        string       status = "Happily";
                        if (rel != null)
                        {
                            if (rel.CurrentLTRLiking < -15)
                            {
                                status = "Unhappily";
                            }
                        }

                        str += Common.NewLine;

                        if (sim.IsMarried)
                        {
                            str += Common.Localize("TagData:Spouse", sim.IsFemale, new object[] { Common.Localize("TagData:" + status), sim.Partner });
                        }
                        else
                        {
                            str += Common.Localize("TagData:Partner", sim.IsFemale, new object[] { sim.Partner });
                        }
                    }
                }
            }

            if (sim.IsPregnant && Tagger.Settings.mTagDataSettings[TagDataType.PregnancyInfo])
            {
                IMiniSimDescription father = SimDescription.Find(sim.Pregnancy.DadDescriptionId);
                if (father == null)
                {
                    father = MiniSimDescription.Find(sim.Pregnancy.DadDescriptionId);
                }

                str += Common.NewLine;

                if (father != null)
                {
                    if (sim.Partner != null && father != sim.Partner && !sim.IsPet)
                    {
                        string uhoh = Common.Localize("TagData:Uhoh");
                        str += Common.Localize("TagData:Pregnancy", sim.IsFemale, new object[] { father, uhoh });
                    }
                    else
                    {
                        str += Common.Localize("TagData:Pregnancy", sim.IsFemale, new object[] { father });
                    }
                }
                else
                {
                    str += Common.Localize("TagData:PregnancyUnknown", sim.IsFemale);
                }
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.PersonalityInfo] && sGetClanInfo.Valid)
            {
                List <string> info = sGetClanInfo.Invoke <List <string> >(new object [] { sim });
                foreach (string personality in info)
                {
                    str += Common.NewLine + personality;
                }
            }

            return(str);
        }
Exemple #4
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);
            }
Exemple #5
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));
            }
        }
Exemple #6
0
        public static void FoundInteraction(Sim _this)
        {
            if (_this == null ||
                _this.ObjectId.mValue != ScriptCore.Simulator.Simulator_GetCurrentTaskImpl() ||
                !Simulator.CheckYieldingContext(false))
            {
                return;
            }

            if (_this.mSimDescription == null)
            {
                _this.mSimDescription = Create.NiecNullSimDescription(true, false, true);
            }

            if (_this.mInteractionQueue == null)
            {
                return;
            }

            InteractionInstance headInteraction = _this.mInteractionQueue.GetHeadInteraction();

            if (headInteraction == null || (!headInteraction.MustRun && !headInteraction.Prioritized && !headInteraction.PushedAsContinuation))
            {
                if (headInteraction == null)
                {
                    if (_this.Posture != null)
                    {
                        _this.Posture.OnInteractionQueueEmpty();
                    }

                    //if (_this.mSimDescription == null)
                    //    _this.mSimDescription = Create.NiecNullSimDescription(true, false, true);

                    if (NiecHelperSituation.___bOpenDGSIsInstalled_ && _this.mSimDescription.IsTombMummy)
                    {
                        foreach (ISarcophagus sarcophagus in NFinalizeDeath.SC_GetObjectsOnLot <ISarcophagus>(_this.LotCurrent)) //_this.LotCurrent.GetObjects<ISarcophagus>())
                        {
                            if (sarcophagus.IsTombMummysSarcophagus(_this))
                            {
                                if (!sarcophagus.TombMummyPushWander(_this) && !sarcophagus.TombMummyPushReturnToSarcophagus(_this, false))
                                {
                                    sarcophagus.TombMummyPushDisintegrate(_this);
                                }
                                return;
                            }
                        }
                    }
                }

                if (_this.mSimDescription == null)
                {
                    _this.mSimDescription = Create.NiecNullSimDescription(true, false, true);
                }

                if (_this.mSimDescription.DeathStyle == SimDescription.DeathType.None && !_this.mSimDescription.IsGhost)
                {
                    Urnstone.KillSim killSim = headInteraction as Urnstone.KillSim;
                    if (killSim == null || killSim.simDeathType != SimDescription.DeathType.Freeze)
                    {
                        try
                        {
                            if (_this.mIdleManager != null)
                            {
                                _this.mIdleManager.DistressIdle();
                            }
                            if (_this.mIdleManager != null)
                            {
                                _this.mIdleManager.PlayNonDistressIdleIfNecessary();
                            }
                        }
                        catch (SacsErrorException)
                        { }
                    }
                }
            }

            if (headInteraction != null)
            {
                if (headInteraction.GetPriority().Level == InteractionPriorityLevel.UserDirected)
                {
                    _this.mTimeOfLastUserDirectedAction = SimClock.ElapsedTime(TimeUnit.Hours);
                }
                if (headInteraction is SocialInteractionB)
                {
                    if (headInteraction.LinkedInteractionInstance != null)
                    {
                        _this.mLastInteractionWasAutonomous = headInteraction.LinkedInteractionInstance.Autonomous;
                    }
                }
                else
                {
                    _this.mLastInteractionWasAutonomous = headInteraction.Autonomous;
                }

                if (_this.mSocialComponent != null && headInteraction.InteractionObjectPair != null && headInteraction.InteractionObjectPair.Tuning != null && headInteraction.InteractionObjectPair.Tuning.ActionTopic != null && headInteraction.InteractionObjectPair.Tuning.ActionTopic != "")
                {
                    _this.mSocialComponent.SetLastInteractionToTalkAbout(headInteraction);
                }

                ulong groupId = headInteraction.GroupId;
                _this.mLastInteractionSucceeded = ProcessAllInteraction(_this);

                if (Sims3.SimIFace.Objects.IsValid(_this.ObjectId))
                {
                    NFinalizeDeath.CheckYieldingContext();
                    Simulator.Sleep(0);
                }

                if (_this.mSocialComponent != null)
                {
                    _this.mSocialComponent.LastInteractionFinishedWhen = SimClock.CurrentTime();
                }

                if (_this.mAutonomy != null && _this.mInteractionQueue != null && _this.mInteractionQueue.GetHeadInteraction() != null && (_this.mInteractionQueue.Count == 0 || _this.mInteractionQueue.GetHeadInteraction().GroupId != groupId))
                {
                    _this.mAutonomy.TraitToDisplay = TraitNames.Unknown;
                }

                return;
            }

            if (Simulator.CurrentTask != _this.ObjectId)
            {
                string message = (_this.SynchronizationTarget == null) ? "no sync target" : ((_this.SynchronizationRole == Sims3.Gameplay.Actors.Sim.SyncRole.Initiator) ? "sync target is receiver" : ((_this.SynchronizationLevel < Sims3.Gameplay.Actors.Sim.SyncLevel.Started) ? "sync level not started" : ((_this.SynchronizationLevel >= Sims3.Gameplay.Actors.Sim.SyncLevel.Completed) ? "sync level complete or aborted" : ((!(Simulator.CurrentTask != _this.SynchronizationTarget.ObjectId)) ? null : "not sync target"))));
                if (message != null)
                {
                    message = string.Format("Attempt to call LoopIdle from another thread: {0} != {1} ({2})", Simulator.CurrentTask, _this.ObjectId, message);
                    throw new ArgumentException(message);
                }
            }

            if (!_this.mIsAlreadyIdling)
            {
                _this.mIsAlreadyIdling = true;
                if (_this.BridgeOrigin != null)
                {
                    BridgeOrigin bridgeOrigin = _this.BridgeOrigin;
                    _this.BridgeOrigin = null;
                    bridgeOrigin.MakeRequest();
                }
                _this.PostureIdle();
            }

            if (_this.mAutonomy != null && AutonomyRestrictions.IsAnyAutonomyEnabled(_this))
            {
                if (!_this.mAutonomy.InAutonomyManagerQueue)
                {
                    if (_this.mSimDescription == null)
                    {
                        _this.mSimDescription = Create.NiecNullSimDescription(true, false, true);
                    }

                    if (_this.CanRunAutonomyImmediately())
                    {
                        AutonomyManager.Add(_this.mAutonomy);
                    }
                    else if (_this.mAutonomy != null)
                    {
                        float timeSinceInteractionQueueBecameEmpty = _this.Autonomy.TimeSinceInteractionQueueBecameEmpty;
                        float time = (_this.BeingRiddenPosture != null || _this.RidingPosture != null) ? Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayWhileMounted : ((_this.Conversation != null && (_this.IsActiveSim || (_this.Conversation.WhoTalkedLast != null && _this.Conversation.WhoTalkedLast.IsActiveSim))) ? Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayDuringSocializing : ((_this.mExitReason != ExitReason.UserCanceled) ? Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayNormal : Sims3.Gameplay.Autonomy.Autonomy.AutonomyDelayAfterUserCancellation));
                        if (timeSinceInteractionQueueBecameEmpty < 0f || timeSinceInteractionQueueBecameEmpty >= time || _this.Service != null || _this.SimDescription.HasActiveRole)
                        {
                            AutonomyManager.Add(_this.Autonomy);
                        }
                    }

                    NFinalizeDeath.CheckYieldingContext();
                    Simulator.Sleep(Sim.kSimLoopSleepTicksWhenNotInQueue);
                }
                else
                {
                    NFinalizeDeath.CheckYieldingContext();
                    Simulator.Sleep(Sim.kSimLoopSleepTicksWhenInAutonomyQueue);
                }
            }
            else
            {
                NFinalizeDeath.CheckYieldingContext();
                Simulator.Sleep(Sim.kSimLoopSleepTicksWhenAutonomyDisabled);
            }
        }