public void ProcessAbandonHouse(Household oldHouse, Household newHouse) { if (HouseholdsEx.NumHumans(oldHouse) != 1) { return; } Lots.ProcessAbandonLot(oldHouse.LotHome); foreach (PropertyData data in oldHouse.RealEstateManager.AllProperties) { ManagerMoney.TransferProperty(oldHouse, newHouse, data); } }
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); }