public static bool PreInRabbitholeLoop(GoToSchoolInRabbitHole ths, bool allowedToWork)
        {
            try
            {
                LotManager.SetAutoGameSpeed();

                //CancellableByPlayer = false;

                ths.BeginCommodityUpdates();

                if (!allowedToWork)
                {
                    ths.EndCommodityUpdates(false);
                    return(false);
                }

                ths.Actor.School.StartWorking();
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(ths.Actor, ths.Target, e);
                return(false);
            }
        }
Beispiel #2
0
        public override bool InRabbitHole()
        {
            try
            {
                LotManager.SetAutoGameSpeed();
                bool succeeded = false;
                BeginCommodityUpdates();

                // Custom
                if (IsAllowedToWork(mCareer) || mCareer.ShouldBeAtWork())
                {
                    DateAndTime previousDateAndTime = SimClock.CurrentTime();
                    float       num2 = SimClock.HoursUntil(mCareer.CurLevel.FinishTime()) + mCareer.OvertimeHours;
                    while (!Actor.WaitForExitReason(1f, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)) && !mCareer.IsSpecialWorkTime)
                    {
                        if (mCareer.IsRegularWorkTime())
                        {
                            break;
                        }
                    }

                    if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                    {
                        EndCommodityUpdates(false);
                        return(false);
                    }

                    mCareer.StartWorking();
                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(LoopDelegate), null);
                    mCareer.FinishWorking();
                    if (!succeeded)
                    {
                        EventTracker.SendEvent(EventTypeId.kWorkCanceled, Actor);
                    }

                    float num3 = SimClock.ElapsedTime(TimeUnit.Hours, previousDateAndTime);
                    if ((num3 > num2) || (Math.Abs((float)(num3 - num2)) <= kStayLateThreshold))
                    {
                        EventTracker.SendEvent(EventTypeId.kCareerOpportunity_StayedLate, Actor);
                    }
                }
                EndCommodityUpdates(succeeded);

                ActiveTopic.AddToSim(Actor, "After Work");
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Beispiel #3
0
        public override bool InRabbitHole()
        {
            try
            {
                LotManager.SetAutoGameSpeed();
                StartStages();

                EventTracker.SendEvent(new DisgracefulActionEvent(EventTypeId.kSimCommittedDisgracefulAction, Actor, DisgracefulActionType.Arrested));

                DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new Interaction <Sim, PoliceStation> .InsideLoopFunction(LoopDel), null);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }