Пример #1
0
        protected static Household GetImportSelection(Lot lot)
        {
            BinModel.Singleton.PopulateExportBin();

            ExportBinContents contents = new ImportSelection(BinModel.Singleton.ExportBinContents).SelectSingle() as ExportBinContents;

            if (contents == null)
            {
                return(null);
            }

            List <Household> houses = new List <Household>();

            Household household = null;

            ProgressDialog.Show(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/Global:Processing", new object[0x0]), false);

            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> >();

                HouseholdContentsProxy houseContents = HouseholdContentsProxy.Import(contents.PackageName);

                household = houseContents.Household;
                if (household == null)
                {
                    return(null);
                }

                List <ulong> indexMap = ExportBinContentsEx.CreateIndexMap(household);

                lot.MoveIn(household);

                CreateActors(lot);

                BinCommonEx.CreateInventories(household, houseContents.Contents, indexMap);

                BinCommon.UpdateImportedUrnstones(household, lot);

                household.FixupGenealogy();
            }
            finally
            {
                News.sNewsTuning.mNamedArticles = namedArticles;

                try
                {
                    ProgressDialog.Close();
                }
                catch
                { }
            }

            SpeedTrap.Sleep();

            return(household);
        }
Пример #2
0
        public static PlaceResult PlaceFromExportBin(Household household, ExportBinContents exportBinItem, Lot lot, PlaceAction action, bool buyFurnished, GetLotCost onLotCost, ref Sim newActiveSim)
        {
            if (household == null)
            {
                return(PlaceResult.InvalidBinHousehold);
            }
            else if (lot == null)
            {
                return(PlaceResult.InvalidLot);
            }
            else if (exportBinItem == null)
            {
                return(PlaceResult.ContentFailure);
            }

            bool flag = exportBinItem.IsLoaded();

            if (!flag)
            {
                ExportBinContentsEx.Import(exportBinItem, false);
            }

            PlaceResult contentFailure = PlaceResult.ContentFailure;

            if (household != null)
            {
                if (((action & PlaceAction.PlaceAndPay) != PlaceAction.PlaceOnly) && !PayForLot(household, lot, buyFurnished, onLotCost))
                {
                    if (!flag)
                    {
                        ExportBinContentsEx.Flush(exportBinItem);
                    }
                    Household.CleanupOldIdToNewSimDescriptionMap();
                    return(PlaceResult.InsufficientFunds);
                }

                if ((!buyFurnished) && (!lot.IsApartmentLot))
                {
                    lot.MakeLotUnfurnished();
                    Common.Sleep();
                    lot.UpdateCachedValues();
                }

                CreateActors(household, lot, false);
                CreateInventories(household, exportBinItem.HouseholdContents, exportBinItem.IndexMap);
                Common.Sleep();
                BinCommon.UpdateImportedUrnstones(household, lot);
                household.PostImport();

                if ((action & PlaceAction.MoveIn) != PlaceAction.PlaceOnly)
                {
                    BinCommon.MoveIn(household, lot);
                }
                if ((action & PlaceAction.Activate) != PlaceAction.PlaceOnly)
                {
                    newActiveSim = BinCommon.ActivateSim(exportBinItem.Household, lot);
                }

                ThumbnailManager.GenerateHouseholdThumbnail(household.HouseholdId, household.HouseholdId, ThumbnailSizeMask.Large | ThumbnailSizeMask.Medium);
                contentFailure = PlaceResult.Success;
            }

            if (!flag)
            {
                ExportBinContentsEx.Flush(exportBinItem);
            }

            return(contentFailure);
        }