protected override Scenario.GatherResult Gather(List <Scenario> list, ref int continueChance, ref int maximum, ref bool random) { List <Household> houses = null; if (mHoles == null) { houses = Household.GetHouseholdsLivingInWorld(); List <RabbitHole> holes = new List <RabbitHole>(Sims3.Gameplay.Queries.GetObjects <RabbitHole>()); mHoles = new List <RabbitHole>(); foreach (RabbitHole hole in holes) { if (!hole.RabbitHoleTuning.kCanInvestHere) { continue; } bool found = false; foreach (Household house in houses) { if (house.RealEstateManager == null) { continue; } PropertyData data = house.RealEstateManager.FindProperty(hole); if (data == null) { continue; } if (data.IsFullOwner) { found = true; break; } } if (!found) { mHoles.Add(hole); } } } if (mLots == null) { if (houses != null) { houses = Household.GetHouseholdsLivingInWorld(); } mLots = new List <Lot>(); foreach (Lot lot in LotManager.AllLots) { if (!RealEstateData.IsPurchaseableVenue(lot)) { continue; } if (RealEstateData.GetVenuePurchaseCost(lot) < 0) { continue; } bool found = false; foreach (Household house in houses) { if (house.RealEstateManager == null) { continue; } PropertyData data = house.RealEstateManager.FindProperty(lot); if (data == null) { continue; } if (data.IsFullOwner) { found = true; break; } } if (!found) { mLots.Add(lot); } } } if ((mHoles.Count == 0) && (mLots.Count == 0)) { return(GatherResult.Failure); } return(base.Gather(list, ref continueChance, ref maximum, ref random)); }
protected override bool PrivateUpdate(ScenarioFrame frame) { int totalFunds = Sim.FamilyFunds - MinimumWealth; AddStat("Total Funds", totalFunds); List <OccupationNames> careers = new List <OccupationNames>(); Careers.GetPotentialCareers(this, Sim, careers, false); List <RabbitHole> choices = new List <RabbitHole>(); foreach (RabbitHole hole in mHoles) { if (totalFunds < hole.RabbitHoleTuning.kInvestCost) { IncStat("Hole Too Expensive"); continue; } if (Sim.Household.RealEstateManager.FindProperty(hole) != null) { IncStat("Hole Already Owned"); continue; } choices.Add(hole); } if (choices.Count > 0) { AddStat("Hole Choices", choices.Count); mRabbitHole = RandomUtil.GetRandomObjectFromList(choices); return(true); } List <Lot> lots = new List <Lot>(); foreach (Lot lot in mLots) { if (totalFunds < RealEstateData.GetVenuePurchaseCost(lot)) { IncStat("Venue Too Expensive"); continue; } if (Sim.Household.RealEstateManager.FindProperty(lot) != null) { IncStat("Venue Already Owned"); continue; } lots.Add(lot); } if (lots.Count > 0) { AddStat("Venue Choices", lots.Count); mLot = RandomUtil.GetRandomObjectFromList(lots); return(true); } IncStat("No Choices"); return(false); }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, Lot target, List <InteractionObjectPair> results) { results.Add(new InteractionObjectPair(new Definition(RealEstateData.GetPurchaseCost(target) == 0), target)); }