Example #1
0
            public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    if (a.SimDescription.IsEnrolledInBoardingSchool())
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("Boarding School");
                        return(false);
                    }

                    if (GameUtils.GetCurrentWorldType() == WorldType.Vacation)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("On Vacation");
                        return(false);
                    }

                    if (a.SimDescription.ToddlerOrBelow)
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("ToddlerOrBelow");
                        return(false);
                    }

                    if (mLocation == null)
                    {
                        return(true);
                    }
                    else if (mLocation.Career is SchoolElementary)
                    {
                        if (!a.SimDescription.Child)
                        {
                            greyedOutTooltipCallback = Common.DebugTooltip("Elementary Not Child");
                            return(false);
                        }
                    }
                    else if (mLocation.Career is SchoolHigh)
                    {
                        if (!a.SimDescription.Teen)
                        {
                            greyedOutTooltipCallback = Common.DebugTooltip("High Not Teen");
                            return(false);
                        }
                    }
                    else if (mLocation.Career is School)
                    {
                        if ((!a.SimDescription.Child) && (!a.SimDescription.Teen))
                        {
                            greyedOutTooltipCallback = Common.DebugTooltip("School Not Child Or Teen");
                            return(false);
                        }
                    }
                    else if (a.School != null)
                    {
                        if (a.SimDescription.Teen && AfterschoolActivity.DoesJobConflictWithActivities(a, mLocation.Career))
                        {
                            greyedOutTooltipCallback = Common.DebugTooltip("DoesJobConflictWithActivities");
                            return(false);
                        }
                    }

                    if (!mLocation.Career.CareerAgeTest(a.SimDescription))
                    {
                        greyedOutTooltipCallback = Common.DebugTooltip("CareerAgeTest");
                        return(false);
                    }

                    Career occupationAsCareer = a.OccupationAsCareer;
                    if ((occupationAsCareer != null) && (occupationAsCareer.Guid == mLocation.Career.Guid))
                    {
                        if (occupationAsCareer.CareerLoc == mLocation)
                        {
                            greyedOutTooltipCallback = Common.DebugTooltip("Already Working There");
                            return(false);
                        }
                    }
                    else if (!mLocation.Career.CanAcceptCareer(a.ObjectId, ref greyedOutTooltipCallback))
                    {
                        return(false);
                    }

                    return(true);
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return(false);
                }
            }