Exemple #1
0
        public int Assets(Household house)
        {
            int assets = 0;

            if (house == null)
            {
                return(0);
            }
            else
            {
                assets = house.FamilyFunds + Lots.GetLotCost(house.LotHome);
            }

            if (house.RealEstateManager != null)
            {
                foreach (PropertyData data in house.RealEstateManager.AllProperties)
                {
                    Lot lot = LotManager.GetLot(data.LotId);
                    if (lot == null)
                    {
                        assets += data.TotalValue;
                    }
                    else if (lot.ResidentialLotSubType == ResidentialLotSubType.kEP1_PlayerOwnable)
                    {
                        assets += data.TotalValue;
                    }
                    else
                    {
                        assets += ManagerLot.GetUnfurnishedLotCost(lot, 0);
                    }
                }
            }

            return(assets);
        }
        protected override ManagerLot.CheckResult OnLotPriceCheck(Common.IStatGenerator stats, Lot lot, int currentLotCost, int availableFunds)
        {
            if (availableFunds < Lots.GetLotCost(lot))
            {
                stats.IncStat("Find Lot: Too expensive");
                return(ManagerLot.CheckResult.Failure);
            }

            return(ManagerLot.CheckResult.Success);
        }
Exemple #3
0
        protected ManagerLot.CheckResult OnLotPriceCheck(Common.IStatGenerator stats, Lot lot, int currentLotCost, int availableFunds)
        {
            Vector2 range = GetValue <ImmigrantMoveInScenario.LotPriceRangeOption, Vector2>();

            if ((range.x == 0) && (range.y == 0))
            {
                return(ManagerLot.CheckResult.IgnoreCost);
            }

            int cost = Lots.GetLotCost(lot);

            if ((range.x <= cost) && (cost <= range.y))
            {
                return(ManagerLot.CheckResult.IgnoreCost);
            }
            else
            {
                stats.IncStat("Out of Range");
                return(ManagerLot.CheckResult.Failure);
            }
        }
Exemple #4
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            ManagerLot.FindLotFlags flags = Inspect;
            if (CheapestHome)
            {
                flags |= ManagerLot.FindLotFlags.CheapestHome;
            }

            Lot lot = Lots.FindLot(this, mMovers, MaximumLoan, flags, OnLotPriceCheck);

            if (lot == null)
            {
                IncStat("No Lot");
                return(false);
            }
            else if (lot.Household != null)
            {
                IncStat("Occupied");
                return(false);
            }

            int lotCost = Lots.GetLotCost(lot);

            AddStat("Lot Cost", lotCost);

            List <SimDescription> sims = new List <SimDescription>(mMovers);

            Dictionary <Household, bool> oldHouses = new Dictionary <Household, bool>();

            House = null;

            foreach (SimDescription sim in sims)
            {
                if (House == null)
                {
                    if (SimTypes.IsSpecial(sim))
                    {
                        break;
                    }
                    else if (HouseholdsEx.NumSims(sim.Household) == sims.Count)
                    {
                        House = sim.Household;
                    }
                }
                else if (House != sim.Household)
                {
                    House = null;
                    break;
                }
            }

            int newFunds = 0;

            Lot oldLot = null;

            mNewHouse = false;
            if (House == null)
            {
                House = Household.Create();
                House.ModifyFamilyFunds(-House.FamilyFunds);

                House.SetName(sims[0].LastName);

                SetValue <AcountingOption, AccountingData>(House, new AccountingData());

                mNewHouse = true;
            }
            else if (House.LotHome != null)
            {
                oldLot = House.LotHome;

                newFunds = Lots.GetLotCost(House.LotHome);

                Lots.ProcessAbandonLot(oldLot);

                House.MoveOut();
            }

            if (OnPresetLotHome != null)
            {
                OnPresetLotHome(lot, House);
            }
            lot.MoveIn(House);

            ManagerSim.ForceRecount();

            Money.AdjustFunds(House, "SellLot", newFunds);

            AddStat("New Home Funds", House.FamilyFunds);

            SetValue <InspectedOption, bool>(House, false);

            if (mNewHouse)
            {
                foreach (SimDescription sim in sims)
                {
                    if (sim.Household != null)
                    {
                        AdjustFundsMoveInLot(sim, oldHouses);
                    }

                    Households.MoveSim(sim, House);

                    if (sim.IsMale)
                    {
                        House.Name = sim.LastName;
                    }
                }
            }

            if (OnLotPriceCheck(this, lot, newFunds, newFunds) != ManagerLot.CheckResult.IgnoreCost)
            {
                PayForMoveInLot(oldHouses, lotCost);
            }

            AddStat("Remaining Funds", House.FamilyFunds);

            foreach (SimDescription sim in sims)
            {
                Sims.Instantiate(sim, lot, true);
            }

            EventTracker.SendEvent(new HouseholdUpdateEvent(EventTypeId.kFamilyMovedInToNewHouse, House));

            if ((oldLot != null) && (GetValue <NotifyOnMoveOption, bool>(House)))
            {
                if (AcceptCancelDialog.Show(Common.Localize("NotifyOnMove:Prompt", false, new object[] { oldLot.Name, oldLot.Address })))
                {
                    if (CameraController.IsMapViewModeEnabled())
                    {
                        Sims3.Gameplay.Core.Camera.ToggleMapView();
                    }

                    Camera.FocusOnLot(oldLot.LotId, 0f);
                }
            }

            SetValue <NotifyOnMoveOption, bool>(House, false);

            return(true);
        }