Esempio n. 1
0
        public static void GetPossibleSpecies(Scenario scenario, Lot lot, SimDescription head, bool forceInspection, List <CASAgeGenderFlags> species)
        {
            bool success = true;

            if ((lot != null) && ((forceInspection) || (scenario.GetValue <RequireInspectionOption, bool>())))
            {
                success = ((lot.CountObjects <IPetBed>() + lot.CountObjects <IPetHouse>()) > 0);
            }

            if (success)
            {
                if (scenario.AddScoring("LikesCats", head) > 0)
                {
                    species.Add(CASAgeGenderFlags.Cat);
                }

                if (scenario.AddScoring("LikesDogs", head) > 0)
                {
                    species.Add(CASAgeGenderFlags.Dog);
                    species.Add(CASAgeGenderFlags.LittleDog);
                }
            }
            else
            {
                scenario.IncStat("No Pet House");
            }

            if (scenario.AddScoring("LikesHorses", head) > 0)
            {
                if ((lot != null) && (lot.CountObjects <IBoxStall>() > 0))
                {
                    species.Add(CASAgeGenderFlags.Horse);
                }
                else
                {
                    scenario.IncStat("No Horse Stalls");
                }
            }
        }
Esempio n. 2
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. 3
0
        protected override bool Allow(Lot lot)
        {
            if (lot == Household.ActiveHouseholdLot)
            {
                IncStat("Active");
                return(false);
            }

            if (lot.CountObjects <JunkyardSpawner>() > 0)
            {
                IncStat("Junkyard");
                return(false);
            }

            return(base.Allow(lot));
        }
Esempio n. 4
0
        protected override bool PrivateSatisfies(ManagerCareer manager, SimDescription sim, Lot newLot, bool inspecting)
        {
            if (!inspecting)
            {
                if (sim.Occupation is Retired)
                {
                    return(false);
                }

                if (ManagerSituation.FindLotType(CommercialLotSubType.kEP2_Salon) == null)
                {
                    return(false);
                }
            }

            if ((newLot == null) || (newLot.CountObjects <DraftingTable>() == 0))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 5
0
        protected override bool PrivateSatisfies(ManagerCareer manager, SimDescription sim, Lot newLot, bool inspecting)
        {
            if (!inspecting)
            {
                if (sim.Occupation is Retired)
                {
                    return(false);
                }

                if (ManagerSituation.FindRabbitHole(RabbitHoleType.CityHall) == null)
                {
                    return(false);
                }
            }

            if ((newLot == null) || (newLot.CountObjects <DraftingTable>() == 0))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 6
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <AncientPortal>() > 0);
 }
Esempio n. 7
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <SaunaClassic>() > 0);
 }
Esempio n. 8
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <AllInOneBathroom>() > 0);
 }
Esempio n. 9
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <HayStack>() > 0);
 }
Esempio n. 10
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <UnderwaterCave>() > 0);
 }
Esempio n. 11
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <ShowerOutdoor>() > 0);
 }
Esempio n. 12
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <ToiletStall>() > 0u);
 }
Esempio n. 13
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <Igloo>() > 0);
 }
Esempio n. 14
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <BoxOfMystery>() > 0);
 }
Esempio n. 15
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <ElevatorDoors>() > 0);
 }
 public override bool HasLocation(Lot lot)
 {
     return (lot.CountObjects<ShowerOutdoor>() > 0);
 }
Esempio n. 17
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <TimeMachine>() > 0);
 }
Esempio n. 18
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <BedDouble>() > 0);
 }
Esempio n. 19
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <PhotoBooth>() > 0);
 }
Esempio n. 20
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <RabbitHole>() > 0);
 }
Esempio n. 21
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <Wardrobe>() > 0);
 }
Esempio n. 22
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <GypsyCaravan>() > 0);
 }
Esempio n. 23
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. 24
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <HoverTrainStation>() > 0);
 }
Esempio n. 25
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <Treehouse>() > 0);
 }
        public override bool HasLocation(Lot lot)
        {
			return (lot.CountObjects<EiffelTower>() > 0);
        }
Esempio n. 27
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <EiffelTower>() > 0);
 }
Esempio n. 28
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <BoxStall>() > 0);
 }
Esempio n. 29
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            if (mCheckRequired)
            {
                if (!mRequirement.mRequired)
                {
                    return(false);
                }
            }

            List <CASAgeGenderFlags> ageGenderRequirements = new List <CASAgeGenderFlags>();

            if ((!mRequirement.mNeedMale) && (!mRequirement.mNeedFemale))
            {
                if (BabyGenderScenario.GetGenderByFirstBorn(Manager, GetValue <GenderOption, BabyGenderScenario.FirstBornGender>(), false) == CASAgeGenderFlags.Male)
                {
                    mRequirement.mNeedMale = true;
                }
                else
                {
                    mRequirement.mNeedFemale = true;
                }
            }

            bool teenMoveIn = false;

            if (mRequirement.mMate == null)
            {
                if (RandomUtil.RandomChance(GetValue <TeenChanceOption, int>()))
                {
                    teenMoveIn = true;
                }
            }
            else if (mRequirement.mMate.Teen)
            {
                teenMoveIn = true;
            }

            if (mRequirement.mNeedMale)
            {
                CASAgeGenderFlags age = CASAgeGenderFlags.Male | CASAgeGenderFlags.Human;
                if (teenMoveIn)
                {
                    age |= CASAgeGenderFlags.Teen;
                }
                else //if ((mRequirement.CareerLevel != null) && (mRequirement.CareerLevel.Level > 5))
                {
                    age |= CASAgeGenderFlags.YoungAdult;
                    age |= CASAgeGenderFlags.Adult;
                }

                ageGenderRequirements.Add(age);
            }

            if (mRequirement.mNeedFemale)
            {
                CASAgeGenderFlags age = CASAgeGenderFlags.Female | CASAgeGenderFlags.Human;
                if (teenMoveIn)
                {
                    age |= CASAgeGenderFlags.Teen;
                }
                else if (mRequirement.mFertile)
                {
                    age |= CASAgeGenderFlags.YoungAdult;
                }
                else //((mRequirement.CareerLevel != null) && (mRequirement.CareerLevel.Level > 5) && )
                {
                    age |= CASAgeGenderFlags.YoungAdult;
                    age |= CASAgeGenderFlags.Adult;
                }

                ageGenderRequirements.Add(age);
            }

            bool singleParent = false;

            Lot familyLot = null;

            if (((mRequirement.mMate == null) || (!mCheckRequired)) && (GetValue <WholeFamilyOption, int>() > 0) && (!RandomUtil.RandomChance(GetValue <SingleSimOption, int>())))
            {
                IncStat("WholeFamily");

                familyLot = Lots.FindLot(this, null, 0, ManagerLot.FindLotFlags.CheapestHome | ManagerLot.FindLotFlags.Inspect, OnLotPriceCheck);
                if (familyLot == null)
                {
                    return(false);
                }

                if (RandomUtil.RandomChance(GetValue <ChanceOfSingleOption, int>()))
                {
                    IncStat("Single Parent");
                    singleParent = true;
                }
                else if (familyLot.CountObjects <IBedDouble>() == 0)
                {
                    if (familyLot.CountObjects <IBedSingle>() > 1)
                    {
                        IncStat("Single Parent");
                        singleParent = true;
                    }
                    else
                    {
                        IncStat("No Double Bed");
                        familyLot = null;
                    }
                }
            }

            using (SimFromBin <ManagerLot> simBin = new SimFromBin <ManagerLot>(this, Lots))
            {
                List <SimDescription> sims = new List <SimDescription>();

                CASAgeGenderFlags genders = CASAgeGenderFlags.Male | CASAgeGenderFlags.Female;

                if (familyLot != null)
                {
                    BabyGenderScenario.FirstBornGender genderPref = GetValue <GenderOption, BabyGenderScenario.FirstBornGender>();

                    bool bothGenders = true;
                    if ((genderPref == BabyGenderScenario.FirstBornGender.Male) ||
                        (genderPref == BabyGenderScenario.FirstBornGender.Female))
                    {
                        bothGenders = false;
                    }
                    else if (RandomUtil.RandomChance(GetValue <ManagerFlirt.ChanceOfGaySim, int>()))
                    {
                        bothGenders = false;
                    }

                    if (ageGenderRequirements.Count == 1)
                    {
                        if (bothGenders)
                        {
                            if ((ageGenderRequirements[0] & CASAgeGenderFlags.Male) == CASAgeGenderFlags.Male)
                            {
                                ageGenderRequirements.Add(CASAgeGenderFlags.Female | (ageGenderRequirements[0] & CASAgeGenderFlags.AgeMask));
                            }
                            else
                            {
                                ageGenderRequirements.Add(CASAgeGenderFlags.Male | (ageGenderRequirements[0] & CASAgeGenderFlags.AgeMask));
                            }
                        }
                        else
                        {
                            genders = ageGenderRequirements[0] & CASAgeGenderFlags.GenderMask;

                            ageGenderRequirements.Add(ageGenderRequirements[0]);
                        }
                    }
                }

                foreach (CASAgeGenderFlags ageGender in ageGenderRequirements)
                {
                    SimDescription sim = simBin.CreateNewSim(ageGender & CASAgeGenderFlags.AgeMask, ageGender & CASAgeGenderFlags.GenderMask, CASAgeGenderFlags.Human);
                    if (sim == null)
                    {
                        IncStat("Creation Failure");
                    }
                    else
                    {
                        sims.Add(sim);
                    }
                }

                if (familyLot == null)
                {
                    if (sims.Count > 0)
                    {
                        Add(frame, new ImmigrantMailOrderScenario(mRequirement, sims), ScenarioResult.Start);
                    }
                }
                else
                {
                    bool createChildren = true;

                    SimDescription otherParent = null;

                    List <SimDescription> parents = new List <SimDescription>(sims);
                    if (parents.Count > 1)
                    {
                        otherParent = parents[1];

                        if (parents[1].IsMale)
                        {
                            parents[0].InternalIncreaseGenderPreferenceMale();
                        }
                        else
                        {
                            parents[0].InternalIncreaseGenderPreferenceFemale();
                        }

                        if (parents[0].IsMale)
                        {
                            parents[1].InternalIncreaseGenderPreferenceMale();
                        }
                        else
                        {
                            parents[1].InternalIncreaseGenderPreferenceFemale();
                        }

                        Relationship relation = Relationship.Get(parents[0], parents[1], true);
                        if (relation != null)
                        {
                            relation.MakeAcquaintances();
                        }

                        if (GameUtils.IsUniversityWorld())
                        {
                            createChildren = true;
                            IncStat("Immigrant Friends");
                        }
                        else if (!RandomUtil.RandomChance(GetValue <ChanceOfFriendsOption, int>()))
                        {
                            Dictionary <string, List <News.NewsTuning.ArticleTuning> > namedArticles = News.sNewsTuning.mNamedArticles;

                            try
                            {
                                // Doing so stops Marriage notices of imported sims from appearing in the newspaper
                                News.sNewsTuning.mNamedArticles = new Dictionary <string, List <News.NewsTuning.ArticleTuning> >();

                                if (RandomUtil.RandomChance(GetValue <ChanceOfPartnerOption, int>()))
                                {
                                    IncStat("Immigrant Partners");

                                    while (relation.CurrentLTR != LongTermRelationshipTypes.Partner)
                                    {
                                        if (!Romances.BumpToHigherState(this, parents[0], parents[1]))
                                        {
                                            break;
                                        }
                                    }
                                }
                                else
                                {
                                    if (!Romances.BumpToHighestState(this, parents[0], parents[1]))
                                    {
                                        IncStat("Unmarriable");
                                        createChildren = false;
                                    }
                                    else
                                    {
                                        parents[1].LastName = parents[0].LastName;
                                    }
                                }
                            }
                            finally
                            {
                                News.sNewsTuning.mNamedArticles = namedArticles;
                            }
                        }
                        else
                        {
                            createChildren = false;
                            IncStat("Immigrant Friends");
                        }
                    }

                    if (createChildren)
                    {
                        Lot.LotMetrics metrics = new Lot.LotMetrics();
                        familyLot.GetLotMetrics(ref metrics);

                        int totalChildren = GetValue <WholeFamilyOption, int>();
                        if (totalChildren > Options.GetValue <MaximumSizeOption, int>())
                        {
                            totalChildren = Options.GetValue <MaximumSizeOption, int>();
                        }

                        totalChildren -= parents.Count;

                        totalChildren = RandomUtil.GetInt(totalChildren - 1) + 1;

                        AddStat("Allowed Children", totalChildren);

                        int totalBeds = metrics.BedCount - parents.Count;
                        if (totalBeds > totalChildren)
                        {
                            totalBeds = totalChildren;
                        }

                        AddStat("Available Beds", totalBeds);

                        if (!GameUtils.IsUniversityWorld())
                        {
                            int numCribs = RandomUtil.GetInt((int)familyLot.CountObjects <Sims3.Gameplay.Objects.Beds.Crib>());

                            // Create the children
                            if (numCribs > 2)
                            {
                                numCribs = 2;
                            }

                            if (numCribs > totalChildren)
                            {
                                numCribs = totalChildren;
                            }

                            AddStat("Available Cribs", numCribs);

                            for (int i = 0; i < numCribs; i++)
                            {
                                SimDescription sim = simBin.CreateNewSim(parents[0], otherParent, CASAgeGenderFlags.Toddler, genders, parents[0].Species, true);
                                if (sim == null)
                                {
                                    IncStat("Creation Failure");
                                }
                                else
                                {
                                    sims.Add(sim);

                                    totalBeds--;
                                }
                            }

                            if ((!parents[0].Teen) && ((otherParent == null) || (!otherParent.Teen)))
                            {
                                for (int i = 0; i < totalBeds; i++)
                                {
                                    SimDescription sim = simBin.CreateNewSim(parents[0], otherParent, CASAgeGenderFlags.Child | CASAgeGenderFlags.Teen, genders, parents[0].Species, true);
                                    if (sim == null)
                                    {
                                        IncStat("Creation Failure");
                                    }
                                    else
                                    {
                                        sims.Add(sim);
                                    }
                                }
                            }
                        }
                        else
                        {
                            for (int i = 0; i < totalBeds; i++)
                            {
                                SimDescription sim = simBin.CreateNewSim(CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Adult, genders, parents[0].Species);
                                if (sim == null)
                                {
                                    IncStat("Creation Failure");
                                }
                                else
                                {
                                    sims.Add(sim);
                                }
                            }
                        }

                        if ((singleParent) && (otherParent != null))
                        {
                            sims.Remove(otherParent);

                            parents.Remove(otherParent);

                            if (otherParent.Partner != null)
                            {
                                otherParent.Partner.Partner = null;
                                otherParent.Partner         = null;
                            }

                            otherParent.Dispose(true, false, true);
                        }
                    }
                }

                if ((GameUtils.IsInstalled(ProductVersion.EP5)) &&
                    (RandomUtil.RandomChance(GetValue <PetChanceOption, int>())))
                {
                    List <CASAgeGenderFlags> choices = new List <CASAgeGenderFlags>();

                    foreach (SimDescription sim in sims)
                    {
                        PetAdoptionBaseScenario.GetPossibleSpecies(this, familyLot, sim, false, choices);
                    }

                    AddStat("Pet Choices", choices.Count);

                    if (choices.Count > 0)
                    {
                        int numberPets = RandomUtil.GetInt(1, GetValue <MaximumPetsOption, int>() - 1);

                        AddStat("Pet Immigrants", numberPets);

                        for (int i = 0; i < numberPets; i++)
                        {
                            CASAgeGenderFlags species = RandomUtil.GetRandomObjectFromList(choices);
                            if (Sims.HasEnough(this, species))
                            {
                                continue;
                            }

                            SimDescription pet = simBin.CreateNewSim(CASAgeGenderFlags.Child | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder, CASAgeGenderFlags.Male | CASAgeGenderFlags.Female, species);
                            if (pet != null)
                            {
                                pet.LastName = sims[0].LastName;

                                sims.Add(pet);
                            }
                            else
                            {
                                IncStat("Pet Creation Fail");
                            }
                        }
                    }
                }

                Add(frame, new ImmigrantMoveInScenario(sims), ScenarioResult.Start);
                Add(frame, new NewImmigrantScenario(sims, mRequirement), ScenarioResult.Success);
            }

            return(true);
        }
Esempio n. 30
0
        protected override bool PrivateSatisfies(ManagerCareer manager, SimDescription sim, Lot newLot, bool inspecting)
        {
            if (!inspecting)
            {
                if (sim.Occupation is Retired) return false;

                if (ManagerSituation.FindLotType(CommercialLotSubType.kEP2_Salon) == null) return false;
            }

            if ((newLot == null) || (newLot.CountObjects<DraftingTable>() == 0)) return false;

            return true;
        }
Esempio n. 31
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <IBotMakingStation>() > 0);
 }
Esempio n. 32
0
        protected override bool PrivateSatisfies(ManagerCareer manager, SimDescription sim, Lot newLot, bool inspecting)
        {
            if (!inspecting)
            {
                if (sim.Occupation is Retired) return false;

                if (ManagerSituation.FindRabbitHole(RabbitHoleType.CityHall) == null) return false;
            }

            if ((newLot == null) || (newLot.CountObjects<DraftingTable>() == 0)) return false;

            return true;
        }
Esempio n. 33
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <ActorTrailer>() > 0);
 }
Esempio n. 34
0
 public override bool HasLocation(Lot lot)
 {
     return(lot.CountObjects <ISarcophagus>() > 0);
 }