Esempio n. 1
0
            public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    if (a.FamilyFunds < CollegeOfBusiness.kCostOfBudgetClass)
                    {
                        return(false);
                    }
                    if (!SimClock.IsTimeBetweenTimes(CollegeOfBusiness.AttendBudgetClass.kStartAvailibilityTime, CollegeOfBusiness.AttendBudgetClass.kEndAvailibilityTime))
                    {
                        return(false);
                    }

                    /*
                     * if (!GameUtils.IsUniversityWorld())
                     * {
                     *  return false;
                     * }
                     */
                    float num = 0f;
                    if (CollegeOfBusiness.AttendBudgetClass.sCooldownDict.TryGetValue(a.SimDescription.SimDescriptionId, out num))
                    {
                        return((SimClock.ElapsedTime(TimeUnit.Hours) - num) > CollegeOfBusiness.AttendBudgetClass.kInteractionCooldown);
                    }
                    return(true);
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return(false);
                }
            }
Esempio n. 2
0
            public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                try
                {
                    if (a.FamilyFunds < CollegeOfBusiness.kCostOfResumeInterviewClass)
                    {
                        return(false);
                    }
                    if (!SimClock.IsTimeBetweenTimes(CollegeOfBusiness.AttendResumeWritingAndInterviewTechniquesClass.kStartAvailibilityTime, CollegeOfBusiness.AttendResumeWritingAndInterviewTechniquesClass.kEndAvailibilityTime))
                    {
                        return(false);
                    }

                    /*
                     * if (!GameUtils.IsUniversityWorld())
                     * {
                     *  return false;
                     * }
                     */
                    return(true);
                }
                catch (Exception e)
                {
                    Common.Exception(a, target, e);
                    return(false);
                }
            }
Esempio n. 3
0
            public Item(Lot lot)
                : base(lot, VenueName(lot.CommercialLotSubType) + ": " + lot.Name, 0, lot.GetThumbnailKey())
            {
                float startTime, endTime;

                Bartending.GetRoleTimes(out startTime, out endTime, lot.GetMetaAutonomyType);

                if (startTime == endTime)
                {
                    mOpen = true;
                }
                else
                {
                    mOpen = SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, startTime, endTime);
                }
            }
Esempio n. 4
0
        public static bool IsStoreOpen(StoreSetRegister register)
        {
            if (register == null)
            {
                return(false);
            }

            if (!register.Info.Open || !SimClock.IsTimeBetweenTimes(register.mOvenHoursStart, register.mOvenHoursEnd))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 5
0
        protected override bool Allow()
        {
            if (!GetValue <Option, bool>())
            {
                return(false);
            }

            Vector2 hours = GetValue <ValidHoursOption, Vector2>();

            if (!SimClock.IsTimeBetweenTimes(hours.x, hours.y))
            {
                IncStat("Not in Hours");
                return(false);
            }

            return(base.Allow());
        }
Esempio n. 6
0
            public bool IsSimAllowedThrough(ulong descId)
            {
                IMiniSimDescription desc = SimDescription.Find(descId);

                if (desc == null)
                {
                    desc = MiniSimDescription.Find(descId) as MiniSimDescription;
                }

                Door door = GameObject.GetObject(mGUID) as Door;

                if (door != null && door.LotCurrent != null && desc != null)
                {
                    SimDescription desc2 = desc as SimDescription;
                    if (desc2 != null && desc2.CreatedSim != null)
                    {
                        if (desc2.Service != null)
                        {
                            List <Sim> sims = desc2.Service.GetSimsAssignedToLot(door.LotCurrent);
                            if (sims.Contains(desc2.CreatedSim) && GoHere.Settings.mServiceSimsIgnoreAllDoorOptions)
                            {
                                return(true);
                            }
                        }

                        if (desc2.HasActiveRole)
                        {
                            if (desc2.AssignedRole != null && desc2.AssignedRole.RoleGivingObject != null)
                            {
                                if (desc2.AssignedRole.RoleGivingObject.InWorld && desc2.AssignedRole.RoleGivingObject.LotCurrent != null)
                                {
                                    if (desc2.AssignedRole.RoleGivingObject.LotCurrent == door.LotCurrent && GoHere.Settings.mRoleSimsIgnoreAllDoorOptions)
                                    {
                                        return(true);
                                    }
                                }
                            }
                        }
                    }

                    if (GoHere.Settings.mGlobalIgnoreAllDoorOptionsFilterOption.Count > 0)
                    {
                        if (FilterHelper.DoesSimMatchFilters(descId, GoHere.Settings.mGlobalIgnoreAllDoorOptionsFilterOption, false))
                        {
                            return(true);
                        }
                    }

                    if (mDoorOpen != -1 && mDoorClose != -1)
                    {
                        bool allowed = true;
                        if (!SimClock.IsTimeBetweenTimes(mDoorOpen, mDoorClose))
                        {
                            allowed = false;

                            if (GoHere.Settings.mGlobalIgnoreDoorTimeLocksFilterOption.Count > 0)
                            {
                                allowed = FilterHelper.DoesSimMatchFilters(descId, GoHere.Settings.mGlobalIgnoreDoorTimeLocksFilterOption, false);
                            }

                            /*
                             * Needs more thought, crashes game due to routing system being confused as to whether sim can route despite it being closed.
                             * if (!allowed && desc2 != null && desc2.CreatedSim != null && desc2.CreatedSim.LotCurrent != null && !desc2.CreatedSim.IsRouting)
                             * {
                             *  if (VenueFlowUtility.IsSimInsideVenue(desc2.CreatedSim, desc2.CreatedSim.LotCurrent))
                             *  {
                             *      if (desc2.CreatedSim.LotCurrent == door.LotCurrent && desc2.CreatedSim.RoomId == door.RoomId)
                             *      {
                             *          //Sims3.Gameplay.Situations.PrivacySituation.RouteToAdjacentRoom(desc2.CreatedSim);
                             *          CommonDoor.tSide side;
                             *          door.GetSideOfDoorInRoom(desc2.CreatedSim.RoomId, out side);
                             *          if (side == CommonDoor.tSide.Front)
                             *          {
                             *              allowed = true;
                             *              door.RouteThroughDoor(desc2.CreatedSim);
                             *          }
                             *      }
                             *  }
                             * Nice to have but need to think about performance implications first
                             *  else
                             *  {
                             *      Sim.MakeSimGoHome(desc2.CreatedSim, false);
                             * }
                             * }
                             */

                            /*
                             * if (PlumbBob.SelectedActor != null && desc.HasSameHomeLot(PlumbBob.SelectedActor.SimDescription))
                             * {
                             *  allowed = true;
                             * }
                             *
                             * if (desc2 != null && desc2.CreatedSim != null)
                             * {
                             *  if (desc2.CareerManager != null)
                             *  {
                             *      if (desc2.CareerManager.OccupationAsActiveCareer != null)
                             *      {
                             *          if (desc2.CareerManager.OccupationAsActiveCareer.HasJobAtLot(door.LotCurrent))
                             *          {
                             *              allowed = true;
                             *          }
                             *      }
                             *
                             *      if (desc2.CreatedSim.CareerLocation != null)
                             *      {
                             *          if (desc2.CreatedSim.CareerLocation.LotCurrent == door.LotCurrent)
                             *          {
                             *              allowed = true;
                             *          }
                             *      }
                             *  }
                             * }
                             */
                        }

                        if (!allowed)
                        {
                            return(allowed);
                        }
                    }

                    if (FiltersEnabled > 0)
                    {
                        if (GoHere.Settings.mGlobalIgnoreDoorFiltersFilterOption.Count > 0)
                        {
                            if (FilterHelper.DoesSimMatchFilters(descId, GoHere.Settings.mGlobalIgnoreDoorFiltersFilterOption, false))
                            {
                                return(true);
                            }
                        }

                        if (mMatchAllFilters)
                        {
                            if (mType == SettingType.Allow)
                            {
                                return(FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, true));
                            }
                            else
                            {
                                return(!FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, true));
                            }
                        }
                        else
                        {
                            if (mType == SettingType.Allow)
                            {
                                return(FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, false));
                            }
                            else
                            {
                                return(!FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, false));
                            }
                        }
                    }
                }

                return(FiltersEnabled == 0);
            }
Esempio n. 7
0
        public static bool UpdateAndGetRolesThatNeedPeople(RoleManager ths, out List <RoleToFill> rolesThatNeedInWorldSim, out List <RoleToFill> rolesThatNeedOtherWorldSim, out List <RoleToFill> rolesThatNeedCustomCreatedSim)
        {
            rolesThatNeedInWorldSim       = new List <RoleToFill>();
            rolesThatNeedOtherWorldSim    = new List <RoleToFill>();
            rolesThatNeedCustomCreatedSim = new List <RoleToFill>();

            if (ths == null)
            {
                return(false);
            }

            Common.StringBuilder msg = new Common.StringBuilder("Role Check:");

            foreach (RoleData data in GetRolesForWorld(true))
            {
                switch (data.Type)
                {
                case Role.RoleType.Paparazzi:
                    if (!Register.Settings.mAllowPaparazzi || Register.Settings.mMaximumPaparazzi <= 0)
                    {
                        continue;
                    }
                    break;

                case Role.RoleType.Explorer:
                    if (!sVacationWorlds.Contains(GameUtils.GetCurrentWorld()))
                    {
                        continue;
                    }
                    break;

                case Role.RoleType.Tourist:
                    if (sVacationWorlds.Contains(GameUtils.GetCurrentWorld()))
                    {
                        continue;
                    }
                    break;
                }

                List <Role> list2;
                bool        globalProperTimeForRole = data.IsValidTimeForRole();
                int         num = 0x0;

                msg += Common.NewLine + data.Type + " " + data.World + " " + data.Number + " " + globalProperTimeForRole + " " + data.FillRoleFrom;

                if (ths.mRoles.TryGetValue(data.Type, out list2))
                {
                    int num2 = 0x0;
                    while (num2 < list2.Count)
                    {
                        bool found = true;

                        bool localProperTimeForObject = globalProperTimeForRole;
                        Role role = list2[num2];
                        IRoleGiverExtended roleGivingObject = role.RoleGivingObject as IRoleGiverExtended;
                        if (roleGivingObject != null)
                        {
                            if ((roleGivingObject.LotCurrent == null) || (roleGivingObject.HasBeenDestroyed))
                            {
                                RoleManagerTaskEx.SafeRemoveSimFromRole("A", role);

                                found = false;
                            }
                            else
                            {
                                float startHour;
                                float endHour;
                                roleGivingObject.GetRoleTimes(out startHour, out endHour);
                                if (!SimClock.IsTimeBetweenTimes(startHour, endHour))
                                {
                                    localProperTimeForObject = false;
                                }
                            }
                        }

                        if (found)
                        {
                            if (!RoleEx.IsSimGood(role))
                            {
                                RoleManagerTaskEx.SafeRemoveSimFromRole("A", role);

                                found = false;
                            }
                            else if (localProperTimeForObject && (!role.IsTryingToStartRole) && (role.SimInRole == null))
                            {
                                bool success = false;

                                if (Household.ActiveHousehold != null)
                                {
                                    try
                                    {
                                        Sim sim = Instantiation.PerformOffLot(role.mSim, Household.ActiveHousehold.LotHome, null);
                                        if (sim != null)
                                        {
                                            success = true;

                                            Common.DebugNotify("Added To Game\n" + role.mSim.FullName, sim);
                                        }
                                    }
                                    catch (ResetException)
                                    {
                                        throw;
                                    }
                                    catch (Exception e)
                                    {
                                        Common.DebugException(role.mSim, e);
                                    }
                                }

                                if ((!success) || (role.SimInRole == null))
                                {
                                    RoleManagerTaskEx.SafeRemoveSimFromRole("B", role);

                                    found = false;
                                }
                            }
                            else if ((role.RoleGivingObject != null) && (!role.RoleGivingObject.InWorld))
                            {
                                RoleManagerTaskEx.SafeRemoveSimFromRole("C", role);

                                found = false;
                            }
                        }

                        if (found)
                        {
                            if (role.RoleGivingObject == null)
                            {
                                num++;
                            }
                            num2++;
                        }
                    }
                }

                if ((num < data.Number) && globalProperTimeForRole)
                {
                    RoleToFill item = new RoleToFill(data.Type, data.Number - num);
                    if ((data.FillRoleFrom == Role.RoleFillFrom.Residents) || (data.FillRoleFrom == Role.RoleFillFrom.Townies))
                    {
                        rolesThatNeedInWorldSim.Add(item);
                    }
                    else if (data.FillRoleFrom == Role.RoleFillFrom.PeopleWhoDontLiveInThisWorld)
                    {
                        rolesThatNeedOtherWorldSim.Add(item);
                    }
                    else if (data.FillRoleFrom == Role.RoleFillFrom.CustomCreatedSim)
                    {
                        bool allow = true;
                        switch (data.Type)
                        {
                        case Role.RoleType.Deer:
                            if (Register.Settings.GetMaximumPoolSize(PetPoolType.NPCDeer) <= 0)
                            {
                                allow = false;
                            }
                            break;

                        case Role.RoleType.Raccoon:
                            if (Register.Settings.GetMaximumPoolSize(PetPoolType.NPCRaccoon) <= 0)
                            {
                                allow = false;
                            }
                            break;
                        }

                        if (allow)
                        {
                            rolesThatNeedCustomCreatedSim.Add(item);
                        }
                    }
                }
            }

            Common.DebugNotify(msg);

            return(true);
        }
Esempio n. 8
0
        public static void Update(IceCreamTruckManager ths)
        {
            bool winter = SeasonsManager.Enabled && (SeasonsManager.CurrentSeason == Season.Winter);
            int[] numArray = (SeasonsManager.Enabled && (SeasonsManager.CurrentSeason == Season.Summer)) ? IceCreamTruckManager.kHoursOfOperationSummer : IceCreamTruckManager.kHoursOfOperation;

            if ((winter || !SimClock.IsTimeBetweenTimes((float)numArray[0], (float)numArray[1])) || ((SimClock.IsNightTime()) && (!Traffic.Settings.mAllowIceCreamAtNight)))
            {
                foreach (IceCreamTruck truck in new List<IceCreamTruck>(ths.mIceCreamTrucks))
                {
                    truck.EndService();
                }

                ths.mIceCreamTrucks.Clear();
            }
            else
            {
                List<IceCreamTruckManager.LotData> data = null;
                if (data == null)
                {
                    data = new List<IceCreamTruckManager.LotData>();
                    PopulateLotList(data);
                }

                if ((data.Count > 0) && (ths.mIceCreamTrucks.Count < Traffic.Settings.mMaxIceCreamTrucks))
                {
                    IceCreamTruckManager.LotData randomObjectFromList = RandomUtil.GetRandomObjectFromList(data);
                    data.Remove(randomObjectFromList);

                    AddTruckIntoWorld(ths, randomObjectFromList.mLot);
                }
                else if ((ths.mIceCreamTrucks.Count > 0) && ((data.Count == 0) || (ths.mIceCreamTrucks.Count > Traffic.Settings.mMaxIceCreamTrucks)))
                {
                    IceCreamTruck truck = RandomUtil.GetRandomObjectFromList(ths.mIceCreamTrucks);

                    ths.mIceCreamTrucks.Remove(truck);

                    truck.FadeOut(false, true);
                }

                //Common.DebugNotify("Ice Cream Trucks " + ths.mIceCreamTrucks.Count);

                foreach (IceCreamTruck truck in ths.mIceCreamTrucks)
                {
                    if ((truck.MoveToNewLot()) || (!IsValidLot(TruckController.GetLot(truck), truck)))
                    {
                        if (data.Count == 0) continue;

                        ths.PopulateLotListDistanceAndScore(truck, data);
                        ths.RouteToNextBestSpot(truck, data);

                        for (int i = 0; i < data.Count; i++)
                        {
                            if (data[i].mLot == truck.mDestinationLot)
                            {
                                data.RemoveAt(i);
                                break;
                            }
                        }

                        Common.DebugNotify("Ice Cream Truck", truck.ObjectId, truck.mDestinationLot.ObjectId);

                        TruckController.AddTruck(truck);
                    }
                }
            }
        }
Esempio n. 9
0
        protected static bool IsValidLot(Lot lot, FoodTruckBase truck)
        {
            if (lot == null)
            {
                return(false);
            }

            FoodTruckBase existing = TruckController.GetTruck(lot);

            if (existing != null)
            {
                if (existing != truck)
                {
                    return(false);
                }
            }

            if (lot.StreetParking == null)
            {
                return(false);
            }

            if (lot.IsWorldLot)
            {
                return(false);
            }

            if (Traffic.Settings.mRequireFoodParkingSpace)
            {
                List <FoodTruckBase> trucks = new List <FoodTruckBase>(lot.GetObjects <FoodTruckBase>());
                trucks.Remove(truck);

                if ((lot.CountObjects <WideParkingSpace>() == 0x0) || (trucks.Count > 0x0))
                {
                    return(false);
                }
            }

            if (lot.IsCommunityLot)
            {
                float openHour    = 0f;
                float closingHour = 0f;
                if ((Bartending.TryGetHoursOfOperation(lot, ref openHour, ref closingHour)) && (!SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, openHour, closingHour)))
                {
                    return(false);
                }
            }
            else
            {
                if (lot.Household == null)
                {
                    return(false);
                }

                if (!Traffic.Settings.mAllowFoodTruckResidential)
                {
                    return(false);
                }

                if (lot.Household.IsActive)
                {
                    if (!Traffic.Settings.mAllowFoodTruckActiveLot)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Esempio n. 10
0
        public static void OnPlayedInstrument(Event e)
        {
            Sim actor = e.Actor as Sim;

            if (actor == null)
            {
                return;
            }

            SkillNames instrumentSkill = SkillNames.None;

            switch (e.Id)
            {
            case EventTypeId.kPlayedDrums:
                instrumentSkill = SkillNames.Drums;
                break;

            case EventTypeId.kPlayedGuitar:
                instrumentSkill = SkillNames.Guitar;
                break;

            case EventTypeId.kPlayedBassGuitar:
                instrumentSkill = SkillNames.BassGuitar;
                break;

            case EventTypeId.kPlayedPiano:
                instrumentSkill = SkillNames.Piano;
                break;

            case EventTypeId.kPlayedLaserHarp:
                instrumentSkill = SkillNames.LaserHarp;
                break;
            }

            float opening = 0, closing = 0;

            if (!Bartending.TryGetHoursOfOperation(actor.LotCurrent, ref opening, ref closing))
            {
                return;
            }

            if (!SimClock.IsTimeBetweenTimes(opening, closing))
            {
                return;
            }

            IncrementalEvent iEvent = e as IncrementalEvent;

            float cash = GetPay(actor, instrumentSkill) * iEvent.mIncrement;

            if (cash == 0)
            {
                return;
            }

            foreach (SkillNames skill in MetricMusicSkill.Skills)
            {
                if (SkillBasedCareerBooter.GetSkillBasedCareer(actor, skill) == null)
                {
                    continue;
                }

                SkillBasedCareerBooter.UpdateExperience(actor, skill, (int)cash);
            }
        }
Esempio n. 11
0
 public static bool TeenCurfewIsInEffect()
 {
     return(!GameUtils.IsOnVacation() && SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, sTeenStartCurfewHour, sTeenEndCurfewHour));
 }
Esempio n. 12
0
 public static bool ChildCurfewIsInEffect()
 {
     return(SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, sChildStartCurfewHour, sChildEndCurfewHour));
 }
Esempio n. 13
0
        protected static bool IsUnderCurfew(ManagerProgressionBase manager, Common.IStatGenerator stats, SimDescription sim, out bool forceCurfew)
        {
            forceCurfew = false;

            if (!sim.IsHuman)
            {
                stats.IncStat("Not Human");
                return(false);
            }
            else if (sim.CreatedSim == null)
            {
                stats.IncStat("Hibernating");
                return(false);
            }
            else if (sim.CreatedSim.RoutingComponent == null)
            {
                stats.IncStat("No Routing Manager");
                return(false);
            }
            else if (sim.CreatedSim.RoutingComponent.RoutingParent != null)
            {
                stats.IncStat("Routing Parent");
                return(false);
            }
            else if (sim.CreatedSim.GetSituationOfType <TrickOrTreatSituation>() != null)
            {
                stats.IncStat("Trick Or Treat");
                return(false);
            }

            Lot currentLot = sim.CreatedSim.LotCurrent;

            if (currentLot == null)
            {
                return(false);
            }

            if (currentLot.CanSimTreatAsHome(sim.CreatedSim))
            {
                stats.IncStat("At Home");
                return(false);
            }

            int startCurfew = manager.GetValue <CurfewStartOption, int>(sim);
            int endCurfew   = manager.GetValue <CurfewEndOption, int>(sim);

            if ((startCurfew < 0) || (endCurfew < 0))
            {
                stats.IncStat("User Curfew Fail");
                return(false);
            }
            else if (startCurfew != endCurfew)
            {
                if (SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, startCurfew, endCurfew))
                {
                    if (manager.GetValue <ForceCurfewOption, bool>(sim))
                    {
                        forceCurfew = true;

                        stats.IncStat("User Defined Curfew");
                        return(true);
                    }
                }
                else
                {
                    stats.IncStat("Not Curfew Time");
                    return(false);
                }
            }

            if (!sim.TeenOrBelow)
            {
                stats.IncStat("Adult Curfew");
                return(false);
            }

            if (startCurfew == endCurfew)
            {
                if (sim.ChildOrBelow)
                {
                    if (!EACurfewRetention.ChildCurfewIsInEffect())
                    {
                        stats.IncStat("Not Child EA Curfew");
                        return(false);
                    }
                }
                else
                {
                    if (!EACurfewRetention.TeenCurfewIsInEffect())
                    {
                        stats.IncStat("Not Teen EA Curfew");
                        return(false);
                    }
                }
            }

            if (IsSupervised(stats, sim.CreatedSim))
            {
                stats.IncStat("Supervised");
                return(false);
            }

            DaysOfTheWeek dayToCheck = SimClock.Yesterday;

            if (SimClock.Hours24 > 12)
            {
                dayToCheck = SimClock.CurrentDayOfWeek;
            }

            if (!manager.HasValue <ValidDaysOption, DaysOfTheWeek>(dayToCheck))
            {
                stats.IncStat("Not Valid Day");
                return(false);
            }

            if (!manager.GetValue <EnforceCurfewForJobOption, bool>())
            {
                stats.IncStat("For Job Disabled");
                return(true);
            }
            else
            {
                Occupation career = sim.Occupation;
                if ((career != null) && (!career.HasOpenHours) && (career.IsFollowingDayInTheWorkDayList(dayToCheck)))
                {
                    stats.IncStat("Work Day");
                    return(true);
                }

                School school = sim.CareerManager.School;
                if ((school != null) && (school.IsFollowingDayInTheWorkDayList(dayToCheck)))
                {
                    stats.IncStat("School Day");
                    return(true);
                }

                stats.IncStat("For Job Allowed");
                return(false);
            }
        }
Esempio n. 14
0
        protected bool UpdatePerformance(Career career)
        {
            if (!ManagerCareer.ValidCareer(career))
            {
                return(false);
            }

            if (SimTypes.IsSelectable(career.OwnerDescription))
            {
                return(false);
            }

            Sim createdSim = career.OwnerDescription.CreatedSim;

            if ((createdSim != null) &&
                (!career.SpecialWorkDay) &&
                (!(createdSim.CurrentInteraction is Pregnancy.GoToHospital)))
            {
                if (HandleForeigners(career as School))
                {
                    IncStat("Foreign Limited");
                    return(false);
                }

                float perfPerHour = 0f;

                DateAndTime time = SimClock.CurrentTime();
                if (career.IsAtWork && (SimClock.IsTimeBetweenTimes(time.Hour, career.CurLevel.StartTime, career.CurLevel.FinishTime() + career.OvertimeHours) || career.IsSpecialWorkTime))
                {
                    if (!career.ShouldBeAtWork() || career.IsSpecialWorkTime)
                    {
                        perfPerHour = Math.Max(perfPerHour, career.OvertimePerfPerHour);
                    }
                    else
                    {
                        float lastMetricAverageCalculated = 0f;
                        foreach (PerfMetric metric in career.CurLevel.Metrics)
                        {
                            lastMetricAverageCalculated += metric.CalcMetric(career);
                        }
                        lastMetricAverageCalculated       /= career.CurLevel.Metrics.Count;
                        career.LastMetricAverageCalculated = lastMetricAverageCalculated;

                        AddScoring("Metric Calc 100s", (int)(lastMetricAverageCalculated * 100));

                        if (lastMetricAverageCalculated > 0f)
                        {
                            perfPerHour = (lastMetricAverageCalculated / 3f) * career.MaxPerfFlowPerHour;
                        }
                        else
                        {
                            perfPerHour = (lastMetricAverageCalculated / -3f) * career.MinPerfFlowPerHour;
                        }
                    }

                    perfPerHour += career.PerformanceBonusPerHour;
                    perfPerHour += career.OwnerDescription.TraitManager.HasElement(TraitNames.MultiTasker) ? TraitTuning.MultiTaskerWorkPerformanceAdd : 0f;
                    perfPerHour += career.mBonusPerformanceFromDegreePerHour;

                    if ((createdSim != null) && (createdSim.BuffManager != null))
                    {
                        if (createdSim.BuffManager.HasElement(BuffNames.MeditativeFocus))
                        {
                            perfPerHour += MartialArts.kMeditativeFocusCareerPerformanceModifier;
                        }
                        if (createdSim.BuffManager.HasElement(BuffNames.Jobtastic))
                        {
                            perfPerHour = career.SharedData.MaxPerfFlowPerHourMaxLevel;
                        }
                        if (createdSim.TraitManager.HasElement(TraitNames.EfficientChip))
                        {
                            perfPerHour = career.MaxPerfFlowPerHour;
                        }
                    }
                }
                else if (career.IsMissingWork())
                {
                    InteractionInstance currentInteraction = createdSim.CurrentInteraction;
                    if (currentInteraction != null)
                    {
                        bool flag;
                        if (career is School)
                        {
                            flag = !(currentInteraction is GoToSchoolInRabbitHole);
                        }
                        else
                        {
                            flag = !(currentInteraction is WorkInRabbitHole);
                            if (flag)
                            {
                                EventTracker.SendEvent(EventTypeId.kNotAtWork, createdSim);
                            }
                        }

                        if (flag)
                        {
                            perfPerHour = career.MissWorkPerfPerHour * (career.OwnerDescription.TraitManager.HasElement(TraitNames.Vacationer) ? TraitTuning.VacationerMissingWorkPerformanceMultiplier : 1f);
                        }
                    }
                }
                else if ((career.PerformanceBonusPerHour != 0f) && !career.IsAllowedToWork())
                {
                    career.PerformanceBonusPerHour = 0f;
                }

                // Interval are 10 sim-minutes long
                perfPerHour *= GetValue <Option, int>();
                perfPerHour /= 6f;

                career.AddPerformance(perfPerHour);

                AddScoring("Perf Change 100s", (int)(perfPerHour * 100));
                return(true);
            }

            return(false);
        }
Esempio n. 15
0
        public static bool Run(RoutineMachine.TeleportBase ths)
        {
            IGameObject obj2;

            if (!ths.Actor.CaregiverCheck())
            {
                return(false);
            }
            else if ((ths.Actor.CarryingChildPosture != null) || (ths.Actor.CarryingPetPosture != null))
            {
                return(false);
            }

            bool flag = ths.PreTeleport(out obj2, out ths.mTargetLot);

            if (!flag)
            {
                return(false);
            }

            ths.OutfitHelper.Start();
            if (ths.Target.Repairable.Broken || ths.Target.Charred)
            {
                if (ths.Actor.RouteToSlotAndCheckInUse(ths.Target, Slot.RoutingSlot_0))
                {
                    ths.StandardEntry();
                    ths.EnterStateMachine("routinemachine_store", "EnterGetReady", "x", "routinemachine");
                    ths.mCurrentStateMachine.SetParameter("tired", SimClock.IsTimeBetweenTimes(RoutineMachine.TeleportBase.kSleepyTimeStart, RoutineMachine.TeleportBase.kSleepyTimeEnd));
                    ths.AnimateSim("GetInMachine");
                    ths.Target.StartPortalTeleportVisualEffects(ths.Actor);
                    ths.AnimateSim("DropThroughPortal");
                    ths.BeginCommodityUpdates();
                    ths.AnimateSim("InsideDreamscape");
                    ths.Target.Repairable.UpdateBreakage(0x64, ths.Actor);
                    if (ths.Actor.SimDescription.IsFrankenstein)
                    {
                        ths.Actor.BuffManager.AddElement(BuffNames.Energized, Origin.FromElectricity);
                    }
                    else if (ths.Actor.BuffManager.HasElement(BuffNames.SingedElectricity) || ths.Actor.TraitManager.HasElement(TraitNames.Unlucky))
                    {
                        ths.Actor.Kill(SimDescription.DeathType.Electrocution, ths.Target);
                    }
                    else
                    {
                        BuffSinged.SingeViaInteraction(ths, Origin.None);
                        ths.Actor.BuffManager.AddElement(BuffNames.SingedElectricity, Origin.None);
                    }

                    FireManager.SimShockedBy(ths.Actor, ths.Target);
                    ths.AnimateSim("ReturnFromDreamscape");
                    ths.AnimateSim("ExitDreamscape");
                    ths.EndCommodityUpdates(false);
                    ths.StandardExit();
                }
                flag = false;
            }

            if (flag && ths.Actor.RouteToSlotAndCheckInUse(ths.Target, Slot.RoutingSlot_0))
            {
                OutfitCategories categories2;
                bool             flag2 = false;

                // Custom
                if (Shooless.Settings.GetPrivacy(ths.Target))
                {
                    ths.mSituation = new RoutineMachine.ShowerPrivacySituation(ths);
                    if (!ths.mSituation.Start())
                    {
                        return(false);
                    }
                }

                if (!ths.Actor.RouteToSlotAndCheckInUse(ths.Target, Slot.RoutingSlot_0))
                {
                    if (ths.mSituation != null)
                    {
                        ths.mSituation.Exit();
                        ths.mSituation = null;
                    }
                    return(false);
                }

                bool paramValue = false;
                ths.CancellableByPlayer = false;
                ths.StandardEntry();
                ths.EnterStateMachine("routinemachine_store", "EnterGetReady", "x", "routinemachine");
                ths.mCurrentStateMachine.SetParameter("tired", SimClock.IsTimeBetweenTimes(RoutineMachine.TeleportBase.kSleepyTimeStart, RoutineMachine.TeleportBase.kSleepyTimeEnd));

                if (ths.mSituation != null)
                {
                    ths.mSituation.StateMachine = ths.mCurrentStateMachine;
                }

                ths.AnimateSim("GetInMachine");

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Hunger) && (ths.Actor.Motives.GetValue(CommodityKind.Hunger) < ths.Actor.Motives.GetMax(CommodityKind.Hunger))) && (ths.Actor.Motives.GetValue(CommodityKind.Hunger) < RoutineMachine.TeleportBase.kThresholdHunger))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }
                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.AnimateSim("SatisfyHunger");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Hunger, RoutineMachine.TeleportBase.kChangeHungerTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyHungerDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                }

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Bladder) && (ths.Actor.Motives.GetValue(CommodityKind.Bladder) < ths.Actor.Motives.GetMax(CommodityKind.Bladder))) && (ths.Actor.Motives.GetValue(CommodityKind.Bladder) < RoutineMachine.TeleportBase.kThresholdBladder))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }
                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.Actor.EnableCensor(Sim.CensorType.LowerBody);
                    ths.AnimateSim("SatisfyBladder");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Bladder, RoutineMachine.TeleportBase.kChangeBladderTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyBladderDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                }

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Hygiene) && (ths.Actor.Motives.GetValue(CommodityKind.Hygiene) < ths.Actor.Motives.GetMax(CommodityKind.Hygiene))) && (ths.Actor.Motives.GetValue(CommodityKind.Hygiene) < RoutineMachine.TeleportBase.kThresholdHygiene))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }

                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.AddSynchronousOneShotScriptEventHandler(0x3e9, ths.ShowerStartEvent);
                    ths.AddSynchronousOneShotScriptEventHandler(0x3ea, ths.ShowerEndEvent);
                    OutfitCategories naked = OutfitCategories.Naked;
                    if (ths.Actor.TraitManager.HasElement(TraitNames.NeverNude))
                    {
                        naked = OutfitCategories.Swimwear;
                    }
                    else
                    {
                        ths.Actor.EnableCensor(Sim.CensorType.FullBody);
                    }

                    using (Sim.SwitchOutfitHelper helper = new Sim.SwitchOutfitHelper(ths.Actor, Sim.ClothesChangeReason.GoingToBathe, naked, false))
                    {
                        helper.Start();
                        helper.Wait(false);
                        helper.ChangeOutfit();
                    }

                    flag2 = true;
                    ths.AnimateSim("SatisfyHygenie");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Hygiene, RoutineMachine.TeleportBase.kChangeHygieneTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyHygieneDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                    BuffManager buffManager = ths.Actor.BuffManager;
                    buffManager.RemoveElement(BuffNames.Singed);
                    buffManager.RemoveElement(BuffNames.SingedElectricity);
                    buffManager.RemoveElement(BuffNames.GarlicBreath);
                    if (ths.Actor.SimDescription.IsMummy)
                    {
                        buffManager.AddElement(BuffNames.Soaked, Origin.FromShower);
                    }
                    if (ths.Actor.HasTrait(TraitNames.Hydrophobic))
                    {
                        ths.Actor.PlayReaction(ReactionTypes.Cry, ths.Target, ReactionSpeed.AfterInteraction);
                    }
                }

                if (ths.Actor.GetOutfitForClothingChange(ths.NewClothesStyle, out categories2) || flag2)
                {
                    ths.mCurrentStateMachine.SetParameter("inAirIdle", paramValue);
                    ths.AnimateSim("PrepareToChangeClothes");
                    using (Sim.SwitchOutfitHelper helper2 = new Sim.SwitchOutfitHelper(ths.Actor, Sim.ClothesChangeReason.Force, categories2))
                    {
                        helper2.Start();
                        helper2.Wait(false);
                        helper2.ChangeOutfit();
                    }
                }

                ths.Actor.AutoEnableCensor();
                ths.AddSynchronousOneShotScriptEventHandler(0x64, ths.TeleportOutEvent);
                ths.AnimateSim("DropThroughPortal");
                ths.Target.StopSpeakerEffects();
                if (ths.mSituation != null)
                {
                    ths.mSituation.Exit();
                    ths.mSituation = null;
                }

                if (ths.Actor.Motives.GetValue(CommodityKind.Energy) < RoutineMachine.TeleportBase.kMinEnergyToTeleport)
                {
                    ths.Target.StartDreamscapeEffects();
                    ths.Target.Repairable.UpdateBreakage(0x64, ths.Actor);
                    ths.RunDreamscape();
                    ths.Target.StopDreamscapeEffects();
                }

                flag = ths.DoTeleport(obj2);
                ths.AnimateSim("ExitGetReady");
                ths.EnterStateMachine("routinemachine_store", "EnterBeTeleported", "x", "routinemachine");
                ths.AddSynchronousOneShotScriptEventHandler(0x64, ths.TeleportBackEvent);
                ths.AnimateSim("BeTeleported");
                ths.AnimateSim("ExitBeTeleported");
                ths.StandardExit();
            }

            ths.Target.StopPortalReturnVisualEffects();
            if (ths.mSituation != null)
            {
                ths.mSituation.Exit();
            }
            return(flag);
        }
Esempio n. 16
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);
            }
Esempio n. 17
0
        public static void SimulateRole(Role ths, float minPassed)
        {
            if (!Register.Settings.mAllowTourists)
            {
                ths.EndRole();
                return;
            }

            if (ths.IsActive)
            {
                List <Lot> baseCamps = new List <Lot>();

                foreach (Lot lot in LotManager.AllLots)
                {
                    if ((lot.IsBaseCampLotType) || (lot.CommercialLotSubType == CommercialLotSubType.kEP10_Resort))
                    {
                        baseCamps.Add(lot);
                    }
                }

                // Drop the EndRole alarm
                foreach (AlarmHandle handle in ths.mAlarmHandles)
                {
                    AlarmManager.Global.RemoveAlarm(handle);
                }

                ths.mAlarmHandles.Clear();

                if (baseCamps.Count > 0)
                {
                    Sim createdSim = ths.mSim != null ? ths.mSim.CreatedSim : null;
                    if (createdSim != null)
                    {
                        if (ths.mMinInLot >= RoleExplorer.kMinPassToAllowSwitchingLots)
                        {
                            if (SimClock.IsTimeBetweenTimes((float)SimClock.Hours24, RoleExplorer.kTimeToGoBackToBaseCamp, RoleExplorer.kTimeToReleaseFromBaseCamp) && (!createdSim.LotCurrent.IsBaseCampLotType))
                            {
                                if (RandomUtil.RandomChance(Register.Settings.mTouristChanceOfLeaving))
                                {
                                    RestoreFutureTrait(ths.mSim);

                                    ths.EndRole();
                                    return;
                                }
                            }

                            if (RandomUtil.CoinFlip())
                            {
                                if (!createdSim.InteractionQueue.Add(GoToLotThatSatisfiesMyRoleEx.Singleton.CreateInstance(createdSim, createdSim, new InteractionPriority(InteractionPriorityLevel.High), true, true)))
                                {
                                    Lot baseCamp = RandomUtil.GetRandomObjectFromList(baseCamps);

                                    createdSim.InteractionQueue.CancelAllInteractions();
                                    InteractionInstance instance = VisitCommunityLot.Singleton.CreateInstance(baseCamp, createdSim, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, true);
                                    createdSim.InteractionQueue.AddAfterCheckingForDuplicates(instance);
                                    ths.UpdateFulfillingLot(baseCamp.LotId);
                                    return;
                                }
                            }
                        }

                        if (createdSim.LotCurrent != null)
                        {
                            if (ths.mFulfillingLotId == 0x0L)
                            {
                                ths.mFulfillingLotId = createdSim.LotCurrent.LotId;
                                ths.mMinInLot       += minPassed;
                            }
                            else if (ths.mFulfillingLotId == createdSim.LotCurrent.LotId)
                            {
                                ths.mMinInLot += minPassed;
                            }
                            else if (!createdSim.IsRouting)
                            {
                                ths.UpdateFulfillingLot(createdSim.LotCurrent.LotId);
                            }
                        }
                    }
                }
                else
                {
                    // needs tuning check
                    if (SimClock.HoursUntil(16) <= 6)
                    {
                        if (ths.mSim != null && ths.mSim.CreatedSim != null && ths.mSim.CreatedSim.CurrentInteraction == null)
                        {
                            if (ths.mSim.HomeWorld == WorldName.FutureWorld && ths.mSim.CreatedSim.Posture != null && ths.mSim.CreatedSim.Posture.ReactionAllowed())
                            {
                                // this is fun but naturally it breaks because EA
                                // ths.mSim.CreatedSim.PlayReaction(ReactionTypes.StandingAwe, ReactionSpeed.NowOrLater);
                            }
                        }

                        ths.SimulateRole(minPassed);
                    }
                    else
                    {
                        if (ths.mSim != null)
                        {
                            RestoreFutureTrait(ths.mSim);
                        }

                        ths.EndRole();
                        return;
                    }
                }
            }
        }
Esempio n. 18
0
            public bool IsSimAllowedThrough(ulong descId)
            {
                IMiniSimDescription desc = SimDescription.Find(descId);

                if (desc == null)
                {
                    desc = MiniSimDescription.Find(descId) as MiniSimDescription;
                }

                Door door = GameObject.GetObject(mGUID) as Door;

                if (door != null && door.LotCurrent != null && desc != null)
                {
                    SimDescription desc2 = desc as SimDescription;
                    if (desc2 != null && desc2.CreatedSim != null)
                    {
                        if (desc2.Service != null)
                        {
                            List <Sim> sims = desc2.Service.GetSimsAssignedToLot(door.LotCurrent);
                            if (sims.Contains(desc2.CreatedSim) && GoHere.Settings.mServiceSimsIgnoreAllDoorOptions)
                            {
                                return(true);
                            }
                        }

                        if (desc2.HasActiveRole)
                        {
                            if (desc2.AssignedRole != null && desc2.AssignedRole.RoleGivingObject != null)
                            {
                                if (desc2.AssignedRole.RoleGivingObject.InWorld && desc2.AssignedRole.RoleGivingObject.LotCurrent != null)
                                {
                                    if (desc2.AssignedRole.RoleGivingObject.LotCurrent == door.LotCurrent && GoHere.Settings.mRoleSimsIgnoreAllDoorOptions)
                                    {
                                        return(true);
                                    }
                                }
                            }
                        }
                    }

                    if (GoHere.Settings.mGlobalIgnoreAllDoorOptionsFilterOption.Count > 0)
                    {
                        if (FilterHelper.DoesSimMatchFilters(descId, GoHere.Settings.mGlobalIgnoreAllDoorOptionsFilterOption, false))
                        {
                            return(true);
                        }
                    }

                    if (mDoorOpen != -1 && mDoorClose != -1)
                    {
                        bool allowed = true;
                        if (!SimClock.IsTimeBetweenTimes(mDoorOpen, mDoorClose))
                        {
                            allowed = false;

                            if (GoHere.Settings.mGlobalIgnoreDoorTimeLocksFilterOption.Count > 0)
                            {
                                allowed = FilterHelper.DoesSimMatchFilters(descId, GoHere.Settings.mGlobalIgnoreDoorTimeLocksFilterOption, false);
                            }

                            /*
                             * if (PlumbBob.SelectedActor != null && desc.HasSameHomeLot(PlumbBob.SelectedActor.SimDescription))
                             * {
                             *  allowed = true;
                             * }
                             *
                             * if (desc2 != null && desc2.CreatedSim != null)
                             * {
                             *  if (desc2.CareerManager != null)
                             *  {
                             *      if (desc2.CareerManager.OccupationAsActiveCareer != null)
                             *      {
                             *          if (desc2.CareerManager.OccupationAsActiveCareer.HasJobAtLot(door.LotCurrent))
                             *          {
                             *              allowed = true;
                             *          }
                             *      }
                             *
                             *      if (desc2.CreatedSim.CareerLocation != null)
                             *      {
                             *          if (desc2.CreatedSim.CareerLocation.LotCurrent == door.LotCurrent)
                             *          {
                             *              allowed = true;
                             *          }
                             *      }
                             *  }
                             * }
                             */
                        }

                        if (!allowed)
                        {
                            return(allowed);
                        }
                    }

                    if (FiltersEnabled > 0)
                    {
                        if (GoHere.Settings.mGlobalIgnoreDoorFiltersFilterOption.Count > 0)
                        {
                            if (FilterHelper.DoesSimMatchFilters(descId, GoHere.Settings.mGlobalIgnoreDoorFiltersFilterOption, false))
                            {
                                return(true);
                            }
                        }

                        if (mMatchAllFilters)
                        {
                            if (mType == SettingType.Allow)
                            {
                                return(FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, true));
                            }
                            else
                            {
                                return(!FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, true));
                            }
                        }
                        else
                        {
                            if (mType == SettingType.Allow)
                            {
                                return(FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, false));
                            }
                            else
                            {
                                return(!FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, false));
                            }
                        }
                    }
                }

                return(FiltersEnabled == 0);
            }
Esempio n. 19
0
        protected static void PopulateLotList(List<IceCreamTruckManager.LotData> data)
        {
            foreach (Lot lot in LotManager.AllLots)
            {
                if (!IsValidLot(lot, null)) continue;

                IceCreamTruckManager.LotData item = new IceCreamTruckManager.LotData(lot);

                item.mDistanceReduction = 0f;

                float openHour = 0f;
                float closingHour = 0f;
                if (lot.LotType == LotType.Commercial)
                {
                    if ((Bartending.TryGetHoursOfOperation(lot, ref openHour, ref closingHour)) && (SimClock.IsTimeBetweenTimes(SimClock.HoursPassedOfDay, openHour, closingHour)))
                    {
                        if (lot.CountObjects<ISchoolRabbitHole>() > 0x0)
                        {
                            item.mDistanceReduction += IceCreamTruckManager.kSchoolLotDistanceReduction;
                        }
                    }
                }

                if (lot.Household != null)
                {
                    item.mDistanceReduction += lot.Household.GetNumberOfKids() * IceCreamTruckManager.kKidsLotDistanceReduction;
                    if (lot.Household.IsActive)
                    {
                        item.mDistanceReduction += IceCreamTruckManager.kSelectableSimLotDistanceReduction;
                    }
                }

                switch (lot.CommercialLotSubType)
                {
                    case CommercialLotSubType.kSmallPark:
                    case CommercialLotSubType.kBigPark:
                    case CommercialLotSubType.kEP5_DogPark:
                    case CommercialLotSubType.kEP5_CatJungle:
                    case CommercialLotSubType.kEP11_RecreationPark:
                        item.mDistanceReduction += IceCreamTruckManager.kParkLotDistanceReduction;
                        break;
                }

                data.Add(item);
            }
        }