Exemple #1
0
        public static void SellRentalLot(ManagerMoney manager, Sim seller, Lot lot)
        {
            PropertyData data = seller.Household.RealEstateManager.FindProperty(lot);

            if (data == null)
            {
                return;
            }

            int cost = data.TotalValue;

            // There is a prompt in SellHome()
            if (SimTypes.IsSelectable(seller))
            {
                data.SellHome(seller);
                if (seller.Household.RealEstateManager.FindProperty(lot) != null)
                {
                    return;
                }
            }
            else
            {
                data.Owner.SellProperty(data, false);
                if (seller.Household != null)
                {
                    foreach (Sim sim in seller.Household.AllActors)
                    {
                        sim.ResetMapTagManager();
                    }
                }
            }

            manager.Lots.ClearWorth(lot);

            Household sellerHouse = seller.SimDescription.Household;

            manager.AdjustAccounting(sellerHouse, "Income", -cost);
            manager.AdjustAccounting(sellerHouse, "PropertySold", cost);

            if (Common.IsAwayFromHomeworld())
            {
                return;
            }

            Household resident = lot.Household;

            if (resident == null)
            {
                return;
            }

            // Family living on lot buys the lot
            manager.AdjustFunds(resident, "PropertyBought", -cost);
        }