Ejemplo n.º 1
0
        public static bool ExportHouseholdForTravel(Household household)
        {
            try
            {
                foreach (Sim sim in Households.AllSims(household))
                {
                    sim.SetObjectToReset();

                    DreamCatcher.PruneDreamManager(sim);
                }

                Common.Sleep();

                ulong id = DownloadContent.GenerateGUID();
                HouseholdContentsProxy householdContents = new HouseholdContentsProxy(household);
                householdContents.Contents.ContentId = id;
                if (DownloadContent.StoreHouseholdContents(householdContents, id))
                {
                    DownloadContent.ExportLotContentsToTravelBin(id);
                    return(true);
                }
            }
            catch (Exception e)
            {
                Common.Exception("ExportHouseholdForTravel", e);
            }

            return(false);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public static void Import(ExportBinContents ths, bool origImport)
        {
            switch (ths.mExportBinType)
            {
            case ExportBinType.Household:
                ulong lotId = DownloadContent.ImportHouseholdContentsFromExportBin(ths.mPackageName);
                if (lotId != 0x0L)
                {
                    // Custom
                    HouseholdContentsProxy proxy = new HouseholdContentsProxy();
                    if (DownloadContent.ImportHouseholdContents(proxy, lotId))
                    {
                        ths.mHouseholdContents           = proxy.Contents;
                        ths.mHouseholdContents.ContentId = lotId;
                    }
                }
                break;

            case ExportBinType.HouseholdLot:
            case ExportBinType.Lot:
                ulong oldLotContentId = 0x0L;
                ulong lotContendId    = DownloadContent.ImportLotContentsFromExportBin(ths.mPackageName, ref oldLotContentId);
                if (lotContendId != 0x0L)
                {
                    if (ths.mExportBinType == ExportBinType.HouseholdLot)
                    {
                        // Custom
                        HouseholdContentsProxy proxy = new HouseholdContentsProxy();
                        ths.mHouseholdContents = proxy.Contents;

                        if (DownloadContent.ImportHouseholdContents(proxy, lotContendId))
                        {
                            ths.mHouseholdContents.ContentId = lotContendId;
                        }
                    }

                    LotContents contents2 = new LotContents(ths.mPackageName, lotContendId, ths.mHouseholdContents, ths.mLotContentsWorth, ths.LotType, ths.LotContentsSizeX, ths.LotContentsSizeY, ths.IsHouseboatLot, ths.mLotMaxLevel, oldLotContentId, ths.mResidentialLotSubType, ths.mCommercialLotSubType);
                    ths.mLotContents = contents2;
                }
                break;
            }

            if (origImport || (ths.mIndexMap == null))
            {
                ths.mIndexMap = CreateIndexMap(ths.Household);
            }
        }
Ejemplo n.º 4
0
        public static HouseholdContents ImportHouseholdForTravel()
        {
            try
            {
                ulong lotId = DownloadContent.ImportHouseholdContentsFromTravelBin();
                if (lotId != 0x0L)
                {
                    HouseholdContentsProxy householdContents = new HouseholdContentsProxy();
                    if (DownloadContent.ImportHouseholdContents(householdContents, lotId))
                    {
                        householdContents.Contents.ContentId = lotId;
                        return(householdContents.Contents);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("ImportHouseholdForTravel", e);
            }

            return(null);
        }
Ejemplo n.º 5
0
        public static string ExportHousehold(Bin ths, Household household, bool includeLotContents, bool isMovingPacked)
        {
            try
            {
                string str = null;
                if (GameUtils.IsInstalled(ProductVersion.EP4))
                {
                    OccultImaginaryFriend.ForceHouseholdImaginaryFriendsBackToInventory(household);
                }

                foreach (Sim sim in household.AllActors)
                {
                    sim.SetObjectToReset();
                }

                Common.Sleep();

                if (includeLotContents)
                {
                    Lot lotHome = household.LotHome;
                    if (lotHome != null)
                    {
                        int num  = household.FamilyFunds;
                        int num2 = World.GetEmptyLotWorth(lotHome.LotId) + ((int)World.GetLotAdditionalPropertyValue(lotHome.LotId));
                        household.SetFamilyFunds(household.FamilyFunds + num2, false);
                        EditTownModel.SendObjectsToProperLot(lotHome);
                        ulong contentId = DownloadContent.StoreLotContents(lotHome, lotHome.LotId);
                        if (contentId != 0x0L)
                        {
                            ThumbnailHelper.GenerateLotThumbnailSet(lotHome.LotId, contentId, ThumbnailSizeMask.ExtraLarge);
                            ThumbnailHelper.GenerateLotThumbnail(lotHome.LotId, contentId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.Medium);
                            ThumbnailSizeMask mask = ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium;
                            ThumbnailManager.GenerateHouseholdThumbnail(household.HouseholdId, contentId, mask);
                            ths.GenerateSimThumbnails(household, contentId, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge);
                            HouseholdContentsProxy contents = new HouseholdContentsProxy(household);
                            if (DownloadContent.StoreHouseholdContents(contents, contentId))
                            {
                                str = DownloadContent.ExportLotContentsToExportBin(contentId);
                            }
                            ThumbnailManager.InvalidateLotThumbnails(lotHome.LotId, contentId, ThumbnailSizeMask.ExtraLarge);
                            ThumbnailManager.InvalidateLotThumbnailsForGroup(lotHome.LotId, contentId, ThumbnailSizeMask.Medium, 0x0);
                            ThumbnailManager.InvalidateHouseholdThumbnail(household.HouseholdId, contentId, mask);
                            ths.InvalidateSimThumbnails(household, contentId);
                        }
                        household.SetFamilyFunds(num, false);
                    }
                    return(str);
                }

                int familyFunds     = household.FamilyFunds;
                int realEstateFunds = 0;
                if (household.RealEstateManager != null)
                {
                    foreach (IPropertyData data in household.RealEstateManager.AllProperties)
                    {
                        realEstateFunds += data.TotalValue;
                    }
                }
                if (household.LotHome != null)
                {
                    int lotWorth = 0;
                    if (isMovingPacked)
                    {
                        lotWorth = World.GetUnfurnishedLotWorth(household.LotHome.LotId) + realEstateFunds;
                    }
                    else
                    {
                        lotWorth = World.GetLotWorth(household.LotHome.LotId) + realEstateFunds;
                    }

                    household.SetFamilyFunds(household.FamilyFunds + lotWorth, false);
                }

                if (household.FamilyFunds < 0x4e20)
                {
                    household.SetFamilyFunds(0x4e20, false);
                }

                ulong cacheId = DownloadContent.GenerateGUID();
                HouseholdContentsProxy householdContents = new HouseholdContentsProxy(household);
                householdContents.Contents.ContentId = cacheId;
                ThumbnailSizeMask sizeMask = ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium;
                ThumbnailManager.GenerateHouseholdThumbnail(household.HouseholdId, cacheId, sizeMask);
                ths.GenerateSimThumbnails(household, cacheId, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge);
                if (DownloadContent.StoreHouseholdContents(householdContents, cacheId))
                {
                    str = DownloadContent.ExportLotContentsToExportBin(cacheId);
                }

                ThumbnailManager.InvalidateHouseholdThumbnail(household.HouseholdId, cacheId, sizeMask);
                ths.InvalidateSimThumbnails(household, cacheId);
                household.SetFamilyFunds(familyFunds, false);
                return(str);
            }
            catch (Exception e)
            {
                Common.Exception("ExportHousehold", e);
                return(null);
            }
        }