示例#1
0
        public bool Allow(Common.IStatGenerator stats, Lot lot, ICollection <SimDescription> sims, FindLotFlags flags, bool allowRentable)
        {
            LotOptions lotData = Options.GetLotOptions(lot);

            if (UnchartedIslandMarker.IsUnchartedIsland(lot))
            {
                stats.IncStat("Find Lot: Uncharted");
                return(false);
            }
            else if (!lotData.GetValue <AllowLotUseOption, bool>())
            {
                stats.IncStat("Find Lot: Lot Allow Denied");
                return(false);
            }
            else if (!PassesHomeInspection(stats, lot, sims, flags))
            {
                stats.IncStat("Find Lot: Home Inspection");
                return(false);
            }

            if (!allowRentable)
            {
                if (Money.GetDeedOwner(lot) != null)
                {
                    return(false);
                }
            }

            return(lotData.AllowCastes(stats, sims));
        }
示例#2
0
        public bool AllowSim(Common.IStatGenerator stats, Sim sim, Lot lot)
        {
            if (sim == null)
            {
                return(false);
            }

            if (!lot.IsOpenVenue())
            {
                stats.IncStat("Not Open Venue");
                return(false);
            }
            else if (UnchartedIslandMarker.IsUnchartedIsland(lot))
            {
                stats.IncStat("Uncharted");
                return(false);
            }

            LotOptions lotOptions = GetLotOptions(lot);

            if (!lotOptions.GetValue <AllowLotPushOption, bool>())
            {
                stats.IncStat("Lot Push Denied");
                return(false);
            }

            if (!lotOptions.AllowCastes(stats, sim.SimDescription))
            {
                return(false);
            }

            switch (lot.CommercialLotSubType)
            {
            case CommercialLotSubType.kEP2_JunkyardNoVisitors:
            case CommercialLotSubType.kMisc_NoVisitors:
                stats.IncStat("No Visitors");
                return(false);

            case CommercialLotSubType.kArtGallery:
            case CommercialLotSubType.kTheatre:
                if (sim.TraitManager.HasElement(TraitNames.CantStandArt))
                {
                    stats.IncStat("CantStandArt");
                    return(false);
                }
                break;

            case CommercialLotSubType.kBeach:
            case CommercialLotSubType.kEP3_DanceClubPool:
            case CommercialLotSubType.kPool:
            case CommercialLotSubType.kFishingSpot:
                if (sim.TraitManager.HasElement(TraitNames.CantStandArt))
                {
                    stats.IncStat("CantStandArt");
                    return(false);
                }
                break;

            case CommercialLotSubType.kGym:
                if (sim.TraitManager.HasElement(TraitNames.CouchPotato))
                {
                    stats.IncStat("CouchPotato");
                    return(false);
                }
                break;

            case CommercialLotSubType.kGraveyard:
                if (sim.TraitManager.HasElement(TraitNames.Coward))
                {
                    stats.IncStat("Coward");
                    return(false);
                }
                break;
            }

            CarryingChildPosture posture = sim.CarryingChildPosture;

            if (posture != null)
            {
                if (!AllowSim(stats, posture.Child, lot))
                {
                    stats.IncStat("Child Fail");
                    return(false);
                }
            }

            return(true);
        }